diff --git a/horizon/templates/horizon/_scripts.html b/horizon/templates/horizon/_scripts.html index 1d4d6cc465..2791f58f19 100644 --- a/horizon/templates/horizon/_scripts.html +++ b/horizon/templates/horizon/_scripts.html @@ -19,8 +19,6 @@ - - diff --git a/openstack_dashboard/enabled/_10_project.py b/openstack_dashboard/enabled/_10_project.py index 532d14e313..c5ab9ef407 100644 --- a/openstack_dashboard/enabled/_10_project.py +++ b/openstack_dashboard/enabled/_10_project.py @@ -39,6 +39,9 @@ ADD_JS_FILES = [ LAUNCH_INST + 'keypair/keypair.js', LAUNCH_INST + 'configuration/configuration.js', LAUNCH_INST + 'configuration/load-edit.js', + + 'dashboard/tech-debt/tech-debt.module.js', + 'dashboard/tech-debt/image-form-controller.js', ] ADD_JS_SPEC_FILES = [ diff --git a/openstack_dashboard/enabled/_20_admin.py b/openstack_dashboard/enabled/_20_admin.py index b36079e0ee..4f9676634c 100644 --- a/openstack_dashboard/enabled/_20_admin.py +++ b/openstack_dashboard/enabled/_20_admin.py @@ -1,3 +1,17 @@ +# Copyright 2015, Rackspace, US, Inc. +# +# 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. + # The slug of the dashboard to be added to HORIZON['dashboards']. Required. DASHBOARD = 'admin' @@ -5,3 +19,9 @@ DASHBOARD = 'admin' ADD_INSTALLED_APPS = [ 'openstack_dashboard.dashboards.admin', ] + +ADD_JS_FILES = [ + 'dashboard/tech-debt/tech-debt.module.js', + 'dashboard/tech-debt/namespace-controller.js', + 'dashboard/tech-debt/image-form-controller.js', +] diff --git a/openstack_dashboard/karma.conf.js b/openstack_dashboard/karma.conf.js index 3bdb7e0d0a..005b6aaa22 100644 --- a/openstack_dashboard/karma.conf.js +++ b/openstack_dashboard/karma.conf.js @@ -67,6 +67,7 @@ module.exports = function(config){ "dashboard/dashboard.module.js", "dashboard/workflow/workflow.js", "dashboard/launch-instance/launch-instance.js", + "dashboard/tech-debt/tech-debt.module.js", "dashboard/**/*.js", // Templates. diff --git a/openstack_dashboard/static/dashboard/dashboard.module.js b/openstack_dashboard/static/dashboard/dashboard.module.js index 66f12f49b9..29a2211e33 100644 --- a/openstack_dashboard/static/dashboard/dashboard.module.js +++ b/openstack_dashboard/static/dashboard/dashboard.module.js @@ -1,11 +1,12 @@ (function () { - 'use strict'; + 'use strict'; - var module = angular.module('hz.dashboard', [ + angular.module('hz.dashboard', [ 'hz.dashboard.launch-instance', + 'hz.dashboard.tech-debt', 'hz.dashboard.workflow' - ]); + ]) - module.constant('dashboardBasePath', '/static/dashboard/'); + .constant('dashboardBasePath', '/static/dashboard/'); })(); diff --git a/horizon/static/dashboard-app/controllers/image-form-controller.js b/openstack_dashboard/static/dashboard/tech-debt/image-form-controller.js similarity index 90% rename from horizon/static/dashboard-app/controllers/image-form-controller.js rename to openstack_dashboard/static/dashboard/tech-debt/image-form-controller.js index 1907fe4ffe..d230816bd3 100644 --- a/horizon/static/dashboard-app/controllers/image-form-controller.js +++ b/openstack_dashboard/static/dashboard/tech-debt/image-form-controller.js @@ -1,7 +1,7 @@ (function () { 'use strict'; - angular.module('horizon.dashboard-app') + angular.module('hz.dashboard.tech-debt') .controller('ImageFormCtrl', ['$scope', function ($scope) { $scope.selectImageFormat = function (path) { if (!path) { return; } @@ -15,4 +15,4 @@ }; }]); -}()); \ No newline at end of file +}()); diff --git a/horizon/static/dashboard-app/controllers/namespace-controller.js b/openstack_dashboard/static/dashboard/tech-debt/namespace-controller.js similarity index 86% rename from horizon/static/dashboard-app/controllers/namespace-controller.js rename to openstack_dashboard/static/dashboard/tech-debt/namespace-controller.js index a4d3d376eb..5572b5c19c 100644 --- a/horizon/static/dashboard-app/controllers/namespace-controller.js +++ b/openstack_dashboard/static/dashboard/tech-debt/namespace-controller.js @@ -1,6 +1,6 @@ (function () { 'use strict'; - angular.module('horizon.dashboard-app') + angular.module('hz.dashboard.tech-debt') .controller('hzNamespaceResourceTypeFormController', function($scope, $window) { $scope.resource_types = $window.resource_types; @@ -8,4 +8,4 @@ $scope.resource_types = JSON.stringify($scope.resource_types); }; }); -}()); \ No newline at end of file +}()); diff --git a/openstack_dashboard/static/dashboard/tech-debt/tech-debt.module.js b/openstack_dashboard/static/dashboard/tech-debt/tech-debt.module.js new file mode 100644 index 0000000000..ef893dc7c3 --- /dev/null +++ b/openstack_dashboard/static/dashboard/tech-debt/tech-debt.module.js @@ -0,0 +1,6 @@ +(function () { + 'use strict'; + + angular.module('hz.dashboard.tech-debt', []); + +})(); diff --git a/openstack_dashboard/utils/settings.py b/openstack_dashboard/utils/settings.py index 1bec1b8fce..c374fd0bb3 100644 --- a/openstack_dashboard/utils/settings.py +++ b/openstack_dashboard/utils/settings.py @@ -116,7 +116,10 @@ def update_dashboards(modules, horizon_config, installed_apps): + exc_list)) angular_modules.extend(config.get('ADD_ANGULAR_MODULES', [])) - js_files.extend(config.get('ADD_JS_FILES', [])) + # avoid pulling in dashboard javascript dependencies multiple times + existing = set(js_files) + js_files.extend([f for f in config.get('ADD_JS_FILES', []) + if f not in existing]) js_spec_files.extend(config.get('ADD_JS_SPEC_FILES', [])) update_horizon_config.update( config.get('UPDATE_HORIZON_CONFIG', {}))