Merge "Applying auto-file-discovery partially"

This commit is contained in:
Jenkins 2015-07-01 03:29:09 +00:00 committed by Gerrit Code Review
commit e217e041d4
7 changed files with 37 additions and 258 deletions

View File

@ -47,4 +47,4 @@ if settings.DEBUG:
url(r'^qunit/$', url(r'^qunit/$',
TemplateView.as_view(template_name="horizon/qunit.html"), TemplateView.as_view(template_name="horizon/qunit.html"),
name='qunit_tests'), name='qunit_tests'),
url(r'^jasmine/(.*?)$', jasmine.dispatcher)) url(r'^jasmine/.*?$', jasmine.dispatcher))

View File

@ -20,6 +20,7 @@
<script src="{{ STATIC_URL }}horizon/lib/angular/smart-table.js"></script> <script src="{{ STATIC_URL }}horizon/lib/angular/smart-table.js"></script>
<script src="{{ STATIC_URL }}horizon/lib/angular/lrdragndrop.js"></script> <script src="{{ STATIC_URL }}horizon/lib/angular/lrdragndrop.js"></script>
<script src="{{ STATIC_URL }}horizon/lib/d3.js"></script> <script src="{{ STATIC_URL }}horizon/lib/d3.js"></script>
<script src="{{ STATIC_URL }}horizon/js/horizon.js"></script>
<script type="text/javascript"> <script type="text/javascript">
/* Load angular modules extensions list before we include angular/horizon.js */ /* Load angular modules extensions list before we include angular/horizon.js */
@ -27,28 +28,18 @@
</script> </script>
<!-- source files --> <!-- source files -->
{% for file in sources %}
<script src="{{ STATIC_URL }}{{ file }}"></script>
{% endfor %}
<!-- spec files -->
{% for file in specs %}
<script src="{{ STATIC_URL }}{{ file }}"></script>
{% endfor %}
<!-- plugin source files -->
{% for file in HORIZON_CONFIG.js_files %} {% for file in HORIZON_CONFIG.js_files %}
<script src='{{ STATIC_URL }}{{ file }}'></script> <script src='{{ STATIC_URL }}{{ file }}'></script>
{% endfor %} {% endfor %}
<!-- plugin spec files -->
{% for file in HORIZON_CONFIG.js_spec_files %}
<script src='{{ STATIC_URL }}{{ file }}'></script>
{% endfor %}
<!-- Magic Search library must be after magic-search override widget --> <!-- Magic Search library must be after magic-search override widget -->
<script src="{{ STATIC_URL }}horizon/lib/magic_search/magic_search.js"></script> <script src="{{ STATIC_URL }}horizon/lib/magic_search/magic_search.js"></script>
<!-- test files - mock and spec -->
{% for file in HORIZON_CONFIG.js_spec_files %}
<script src='{{ STATIC_URL }}{{ file }}'></script>
{% endfor %}
</head> </head>
<body> <body>
<div id="main_content" class="hidden" style="visibility:hidden; height: 0"> <div id="main_content" class="hidden" style="visibility:hidden; height: 0">
@ -62,8 +53,8 @@
// Caching all external angular templates // Caching all external angular templates
var templates = [ var templates = [
{% for externalTemplate in externalTemplates %} {% for external_template in HORIZON_CONFIG.external_templates %}
'{{ STATIC_URL }}{{ externalTemplate }}', '{{ STATIC_URL }}{{ external_template }}',
{% endfor %} {% endfor %}
]; ];

View File

@ -10,38 +10,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import inspect
import sys
import django.shortcuts import django.shortcuts
import django.views.defaults
def dispatcher(request, test_name): def dispatcher(request):
# import is included in this non-standard location to avoid
# problems importing mox. See bug/1288245
from horizon.test.jasmine import jasmine_tests as tests
classes = inspect.getmembers(sys.modules[tests.__name__],
inspect.isclass)
if not test_name:
return django.shortcuts.render(
request,
"horizon/jasmine/index.html",
{'classes': (cls_name for cls_name, _ in classes)}
)
else:
for cls_name, cls in classes:
if cls_name == test_name:
template = cls.template_name
if not template:
template = "horizon/jasmine/jasmine.html" template = "horizon/jasmine/jasmine.html"
return django.shortcuts.render(request, template)
return django.shortcuts.render(
request,
template,
{'specs': cls.specs, 'sources': cls.sources,
'externalTemplates': cls.externalTemplates})
return django.views.defaults.page_not_found(request)

View File

@ -1,136 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from horizon.test import helpers as test
class ServicesTests(test.JasmineTests):
sources = [
'horizon/js/horizon.js',
'openstack-service-api/openstack-service-api.module.js',
'openstack-service-api/settings.service.js',
'openstack-service-api/cinder.service.js',
'openstack-service-api/glance.service.js',
'openstack-service-api/keystone.service.js',
'openstack-service-api/neutron.service.js',
'openstack-service-api/nova.service.js',
'openstack-service-api/policy.service.js',
'openstack-service-api/security-group.service.js',
'auth/auth.module.js',
'auth/login/login.module.js',
'auth/login/login.controller.js',
'auth/login/login-finder.directive.js',
'framework/framework.module.js',
'framework/conf/conf.js',
'framework/util/util.module.js',
'framework/util/bind-scope/bind-scope.js',
'framework/util/filters/filters.js',
'framework/util/http/http.js',
'framework/util/i18n/i18n.js',
'framework/util/validators/validators.js',
'framework/util/workflow/workflow.js',
'framework/util/tech-debt/tech-debt.module.js',
'framework/util/tech-debt/helper-functions.js',
'framework/util/tech-debt/image-file-on-change.js',
'framework/widgets/widgets.module.js',
'framework/widgets/action-list/action-list.module.js',
'framework/widgets/action-list/action.directive.js',
'framework/widgets/action-list/action-list.directive.js',
'framework/widgets/action-list/button-tooltip.directive.js',
'framework/widgets/action-list/menu.directive.js',
'framework/widgets/charts/charts.module.js',
'framework/widgets/charts/chart-tooltip.directive.js',
'framework/widgets/charts/pie-chart.directive.js',
'framework/widgets/help-panel/help-panel.js',
'framework/widgets/magic-search/magic-search.js',
'framework/widgets/metadata-tree/metadata-tree.module.js',
'framework/widgets/metadata-tree/metadata-tree-service.js',
'framework/widgets/modal/modal.module.js',
'framework/widgets/modal/modal.controller.js',
'framework/widgets/modal/modal.factory.js',
'framework/widgets/modal-wait-spinner/modal-wait-spinner.module.js',
'framework/widgets/modal-wait-spinner/modal-wait-spinner.directive.js',
'framework/widgets/modal-wait-spinner/modal-wait-spinner.factory.js',
'framework/widgets/table/table.module.js',
'framework/widgets/table/basic-table.js',
'framework/widgets/transfer-table/transfer-table.module.js',
'framework/widgets/transfer-table/transfer-table.controller.js',
'framework/widgets/transfer-table/transfer-table.directive.js',
'framework/widgets/wizard/wizard.js',
'framework/widgets/metadata-display/metadata-display.module.js',
'framework/widgets/metadata-display/hz-metadata-display.controller.js',
'framework/widgets/metadata-display/hz-metadata-display.directive.js',
'framework/widgets/toast/toast.module.js',
'framework/widgets/toast/toast.directive.js',
'framework/widgets/toast/toast.factory.js',
]
specs = [
'auth/login/login.spec.js',
'openstack-service-api/common-test.spec.js',
'openstack-service-api/settings.service.spec.js',
'openstack-service-api/cinder.service.spec.js',
'openstack-service-api/glance.service.spec.js',
'openstack-service-api/keystone.service.spec.js',
'openstack-service-api/neutron.service.spec.js',
'openstack-service-api/nova.service.spec.js',
'openstack-service-api/policy.service.spec.js',
'openstack-service-api/security-group.service.spec.js',
'framework/util/bind-scope/bind-scope.spec.js',
'framework/util/filters/filters.spec.js',
'framework/util/http/http.spec.js',
'framework/util/i18n/i18n.spec.js',
'framework/util/tech-debt/helper-functions.spec.js',
'framework/util/validators/validators.spec.js',
'framework/util/workflow/workflow.spec.js',
'framework/widgets/action-list/action-list.spec.js',
'framework/widgets/charts/charts.spec.js',
'framework/widgets/charts/chart-tooltip.spec.js',
'framework/widgets/charts/pie-chart.spec.js',
'framework/widgets/help-panel/help-panel.spec.js',
'framework/widgets/magic-search/magic-search.spec.js',
'framework/widgets/modal/modal.spec.js',
'framework/widgets/modal-wait-spinner/modal-wait-spinner.spec.js',
'framework/widgets/table/table.spec.js',
'framework/widgets/table/basic-table.spec.js',
'framework/widgets/transfer-table/transfer-table.spec.js',
'framework/widgets/wizard/wizard.spec.js',
'framework/widgets/metadata-tree/metadata-tree.spec.js',
'framework/widgets/metadata-display/metadata-display.spec.js',
'framework/widgets/toast/toast.spec.js',
]
externalTemplates = [
'framework/widgets/action-list/action.html',
'framework/widgets/action-list/menu-item.html',
'framework/widgets/action-list/menu.html',
'framework/widgets/action-list/single-button.html',
'framework/widgets/action-list/split-button.html',
'framework/widgets/charts/chart-tooltip.html',
'framework/widgets/charts/pie-chart.html',
'framework/widgets/help-panel/help-panel.html',
'framework/widgets/magic-search/magic-search.html',
'framework/widgets/table/search-bar.html',
'framework/widgets/transfer-table/transfer-table.html',
'framework/widgets/wizard/wizard.html',
'framework/widgets/metadata-tree/metadata-tree.html',
'framework/widgets/metadata-tree/metadata-tree-item.html',
'framework/widgets/metadata-display/metadata-display.html',
'framework/widgets/toast/toast.html',
]

View File

@ -40,7 +40,7 @@ urlpatterns = patterns(
url(r'^qunit/$', url(r'^qunit/$',
TemplateView.as_view(template_name="horizon/qunit.html"), TemplateView.as_view(template_name="horizon/qunit.html"),
name='qunit_tests'), name='qunit_tests'),
url(r'^jasmine/(.*?)$', jasmine.dispatcher) url(r'^jasmine/.*?$', jasmine.dispatcher)
) )
urlpatterns += staticfiles_urlpatterns() urlpatterns += staticfiles_urlpatterns()

View File

@ -65,6 +65,7 @@ HORIZON_CONFIG = {
'angular_modules': [], 'angular_modules': [],
'js_files': [], 'js_files': [],
'js_spec_files': [], 'js_spec_files': [],
'external_templates': [],
} }
# Set to True to allow users to upload images to glance via Horizon server. # Set to True to allow users to upload images to glance via Horizon server.
@ -286,6 +287,29 @@ STATICFILES_DIRS.append(
('custom', CUSTOM_THEME), ('custom', CUSTOM_THEME),
) )
# populate HORIZON_CONFIG with auto-discovered JavaScript sources, mock files,
# specs files and external templates.
from horizon.utils import file_discovery as fd
# note the path must end in a '/' or the resultant file paths will have a
# leading "/"
fd.populate_horizon_config(
HORIZON_CONFIG,
os.path.join(ROOT_PATH, '..', 'horizon', 'static/')
)
# filter out non-angular javascript code and lib
HORIZON_CONFIG['js_files'] = ([f for f in HORIZON_CONFIG['js_files']
if not f.startswith('horizon/')])
# note the path must end in a '/' or the resultant file paths will have a
# leading "/"
fd.populate_horizon_config(
HORIZON_CONFIG,
os.path.join(ROOT_PATH, 'static/'),
sub_path='openstack-service-api/'
)
# Load the pluggable dashboard settings # Load the pluggable dashboard settings
import openstack_dashboard.enabled import openstack_dashboard.enabled
import openstack_dashboard.local.enabled import openstack_dashboard.local.enabled

View File

@ -13,87 +13,17 @@
<script src='{{ STATIC_URL }}horizon/lib/angular/angular-sanitize.js'></script> <script src='{{ STATIC_URL }}horizon/lib/angular/angular-sanitize.js'></script>
<script src="{{ STATIC_URL }}horizon/lib/angular/lrdragndrop.js"></script> <script src="{{ STATIC_URL }}horizon/lib/angular/lrdragndrop.js"></script>
<script src="{{ STATIC_URL }}horizon/lib/angular/smart-table.js"></script> <script src="{{ STATIC_URL }}horizon/lib/angular/smart-table.js"></script>
<script src="{{ STATIC_URL }}auth/auth.module.js"></script>
<script src="{{ STATIC_URL }}auth/login/login.module.js"></script>
<script src="{{ STATIC_URL }}auth/login/login.controller.js"></script>
<script src="{{ STATIC_URL }}auth/login/login-finder.directive.js"></script>
<script src='{{ STATIC_URL }}openstack-service-api/openstack-service-api.module.js'></script>
<script src='{{ STATIC_URL }}openstack-service-api/cinder.service.js'></script>
<script src='{{ STATIC_URL }}openstack-service-api/glance.service.js'></script>
<script src='{{ STATIC_URL }}openstack-service-api/keystone.service.js'></script>
<script src='{{ STATIC_URL }}openstack-service-api/neutron.service.js'></script>
<script src='{{ STATIC_URL }}openstack-service-api/nova.service.js'></script>
<script src='{{ STATIC_URL }}openstack-service-api/policy.service.js'></script>
<script src='{{ STATIC_URL }}openstack-service-api/security-group.service.js'></script>
<script src='{{ STATIC_URL }}openstack-service-api/settings.service.js'></script>
<script src="{{ STATIC_URL }}horizon/lib/d3.js"></script> <script src="{{ STATIC_URL }}horizon/lib/d3.js"></script>
<script src='{{ STATIC_URL }}framework/framework.module.js'></script>
<script src='{{ STATIC_URL }}framework/conf/conf.js'></script>
<script src='{{ STATIC_URL }}framework/util/util.module.js'></script>
<script src='{{ STATIC_URL }}framework/util/bind-scope/bind-scope.js'></script>
<script src='{{ STATIC_URL }}framework/util/filters/filters.js'></script>
<script src='{{ STATIC_URL }}framework/util/http/http.js'></script>
<script src='{{ STATIC_URL }}framework/util/i18n/i18n.js'></script>
<script src='{{ STATIC_URL }}framework/util/validators/validators.js'></script>
<script src='{{ STATIC_URL }}framework/util/workflow/workflow.js'></script>
<script src='{{ STATIC_URL }}framework/util/tech-debt/tech-debt.module.js'></script>
<script src='{{ STATIC_URL }}framework/util/tech-debt/dummy.js'></script>
<script src='{{ STATIC_URL }}framework/util/tech-debt/helper-functions.js'></script>
<script src='{{ STATIC_URL }}framework/util/tech-debt/image-file-on-change.js'></script>
<script src='{{ STATIC_URL }}framework/util/tech-debt/modal-form-update-metadata-ctrl.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/widgets.module.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/help-panel/help-panel.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/wizard/wizard.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/action-list/action-list.module.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/action-list/action.directive.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/action-list/action-list.directive.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/action-list/button-tooltip.directive.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/action-list/menu.directive.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/table/table.module.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/table/basic-table.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/modal/modal.module.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/modal/modal.controller.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/modal/modal.factory.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/modal-wait-spinner/modal-wait-spinner.module.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/modal-wait-spinner/modal-wait-spinner.directive.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/modal-wait-spinner/modal-wait-spinner.factory.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/transfer-table/transfer-table.module.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/transfer-table/transfer-table.controller.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/transfer-table/transfer-table.directive.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/charts/charts.module.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/charts/chart-tooltip.directive.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/charts/pie-chart.directive.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/metadata-tree/metadata-tree.module.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/metadata-tree/metadata-tree-service.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/metadata-display/metadata-display.module.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/metadata-display/hz-metadata-display.controller.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/metadata-display/hz-metadata-display.directive.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/magic-search/magic-search.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/toast/toast.module.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/toast/toast.directive.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/toast/toast.factory.js'></script>
<script src='{{ STATIC_URL }}horizon/lib/jquery/jquery.quicksearch.js'></script> <script src='{{ STATIC_URL }}horizon/lib/jquery/jquery.quicksearch.js'></script>
<script src="{{ STATIC_URL }}horizon/lib/jquery/jquery.tablesorter.js"></script> <script src="{{ STATIC_URL }}horizon/lib/jquery/jquery.tablesorter.js"></script>
<script src="{{ STATIC_URL }}horizon/lib/spin.js"></script> <script src="{{ STATIC_URL }}horizon/lib/spin.js"></script>
<script src="{{ STATIC_URL }}horizon/lib/spin.jquery.js"></script> <script src="{{ STATIC_URL }}horizon/lib/spin.jquery.js"></script>
<script src="{{ STATIC_URL }}horizon/lib/jquery-ui/ui/jquery-ui.js"></script> <script src="{{ STATIC_URL }}horizon/lib/jquery-ui/ui/jquery-ui.js"></script>
<script src="{{ STATIC_URL }}horizon/lib/jquery/jquery.bootstrap.wizard.js"></script> <script src="{{ STATIC_URL }}horizon/lib/jquery/jquery.bootstrap.wizard.js"></script>
<script src="{{ STATIC_URL }}bootstrap/js/bootstrap.js"></script> <script src="{{ STATIC_URL }}bootstrap/js/bootstrap.js"></script>
<script src='{{ STATIC_URL }}horizon/lib/bootstrap_datepicker/bootstrap-datepicker.js'></script> <script src='{{ STATIC_URL }}horizon/lib/bootstrap_datepicker/bootstrap-datepicker.js'></script>
<script src="{{ STATIC_URL }}horizon/lib/magic_search/magic_search.js"></script> <script src="{{ STATIC_URL }}horizon/lib/magic_search/magic_search.js"></script>
<script src="{{ STATIC_URL }}horizon/lib/hogan.js"></script> <script src="{{ STATIC_URL }}horizon/lib/hogan.js"></script>
<script src='{{ STATIC_URL }}horizon/js/horizon.accordion_nav.js'></script> <script src='{{ STATIC_URL }}horizon/js/horizon.accordion_nav.js'></script>
<script src='{{ STATIC_URL }}horizon/js/horizon.communication.js'></script> <script src='{{ STATIC_URL }}horizon/js/horizon.communication.js'></script>
<script src='{{ STATIC_URL }}horizon/js/horizon.datepickers.js'></script> <script src='{{ STATIC_URL }}horizon/js/horizon.datepickers.js'></script>
@ -102,7 +32,6 @@
<script src='{{ STATIC_URL }}horizon/js/horizon.instances.js'></script> <script src='{{ STATIC_URL }}horizon/js/horizon.instances.js'></script>
<script src='{{ STATIC_URL }}horizon/js/horizon.messages.js'></script> <script src='{{ STATIC_URL }}horizon/js/horizon.messages.js'></script>
<script src='{{ STATIC_URL }}horizon/js/horizon.modals.js'></script> <script src='{{ STATIC_URL }}horizon/js/horizon.modals.js'></script>
<script type="text/javascript"> <script type="text/javascript">
horizon.modals.MODAL_BACKDROP = "{% firstof HORIZON_CONFIG.modal_backdrop 'static' %}"; horizon.modals.MODAL_BACKDROP = "{% firstof HORIZON_CONFIG.modal_backdrop 'static' %}";
</script> </script>