diff --git a/horizon/site_urls.py b/horizon/site_urls.py
index 5dc78e8cb5..2f3fbaa757 100644
--- a/horizon/site_urls.py
+++ b/horizon/site_urls.py
@@ -47,4 +47,4 @@ if settings.DEBUG:
url(r'^qunit/$',
TemplateView.as_view(template_name="horizon/qunit.html"),
name='qunit_tests'),
- url(r'^jasmine/(.*?)$', jasmine.dispatcher))
+ url(r'^jasmine/.*?$', jasmine.dispatcher))
diff --git a/horizon/templates/horizon/jasmine/jasmine.html b/horizon/templates/horizon/jasmine/jasmine.html
index c352c30cf8..c24ce3a031 100644
--- a/horizon/templates/horizon/jasmine/jasmine.html
+++ b/horizon/templates/horizon/jasmine/jasmine.html
@@ -20,6 +20,7 @@
+
- {% for file in sources %}
-
- {% endfor %}
-
-
- {% for file in specs %}
-
- {% endfor %}
-
-
{% for file in HORIZON_CONFIG.js_files %}
{% endfor %}
-
- {% for file in HORIZON_CONFIG.js_spec_files %}
-
- {% endfor %}
-
+
+ {% for file in HORIZON_CONFIG.js_spec_files %}
+
+ {% endfor %}
+
@@ -62,8 +53,8 @@
// Caching all external angular templates
var templates = [
- {% for externalTemplate in externalTemplates %}
- '{{ STATIC_URL }}{{ externalTemplate }}',
+ {% for external_template in HORIZON_CONFIG.external_templates %}
+ '{{ STATIC_URL }}{{ external_template }}',
{% endfor %}
];
diff --git a/horizon/test/jasmine/jasmine.py b/horizon/test/jasmine/jasmine.py
index 2a724a596f..5cbe8d6679 100644
--- a/horizon/test/jasmine/jasmine.py
+++ b/horizon/test/jasmine/jasmine.py
@@ -10,38 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-import inspect
-import sys
-
import django.shortcuts
-import django.views.defaults
-def dispatcher(request, test_name):
- # 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"
-
- return django.shortcuts.render(
- request,
- template,
- {'specs': cls.specs, 'sources': cls.sources,
- 'externalTemplates': cls.externalTemplates})
-
- return django.views.defaults.page_not_found(request)
+def dispatcher(request):
+ template = "horizon/jasmine/jasmine.html"
+ return django.shortcuts.render(request, template)
diff --git a/horizon/test/jasmine/jasmine_tests.py b/horizon/test/jasmine/jasmine_tests.py
deleted file mode 100644
index 81527df27c..0000000000
--- a/horizon/test/jasmine/jasmine_tests.py
+++ /dev/null
@@ -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',
- ]
diff --git a/horizon/test/urls.py b/horizon/test/urls.py
index d004255956..7a5ebada6d 100644
--- a/horizon/test/urls.py
+++ b/horizon/test/urls.py
@@ -40,7 +40,7 @@ urlpatterns = patterns(
url(r'^qunit/$',
TemplateView.as_view(template_name="horizon/qunit.html"),
name='qunit_tests'),
- url(r'^jasmine/(.*?)$', jasmine.dispatcher)
+ url(r'^jasmine/.*?$', jasmine.dispatcher)
)
urlpatterns += staticfiles_urlpatterns()
diff --git a/openstack_dashboard/settings.py b/openstack_dashboard/settings.py
index b37ac938d7..2a6db55fbe 100644
--- a/openstack_dashboard/settings.py
+++ b/openstack_dashboard/settings.py
@@ -65,6 +65,7 @@ HORIZON_CONFIG = {
'angular_modules': [],
'js_files': [],
'js_spec_files': [],
+ 'external_templates': [],
}
# Set to True to allow users to upload images to glance via Horizon server.
@@ -286,6 +287,29 @@ STATICFILES_DIRS.append(
('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
import openstack_dashboard.enabled
import openstack_dashboard.local.enabled
diff --git a/openstack_dashboard/templates/horizon/_scripts.html b/openstack_dashboard/templates/horizon/_scripts.html
index 93428c06a5..a3498dcd42 100644
--- a/openstack_dashboard/templates/horizon/_scripts.html
+++ b/openstack_dashboard/templates/horizon/_scripts.html
@@ -13,87 +13,17 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -102,7 +32,6 @@
-