diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/details/details.controller.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/details/details.controller.js index 29d5fc3f26..640af48e67 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/details/details.controller.js +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/details/details.controller.js @@ -33,13 +33,15 @@ '$scope', 'horizon.framework.widgets.charts.donutChartSettings', 'horizon.framework.widgets.charts.quotaChartDefaults', - 'horizon.app.core.openstack-service-api.nova' + 'horizon.app.core.openstack-service-api.nova', + 'horizon.app.core.openstack-service-api.userSession' ]; function LaunchInstanceDetailsController($scope, donutChartSettings, quotaChartDefaults, - novaAPI + novaAPI, + userSession ) { var ctrl = this; @@ -106,6 +108,11 @@ //////////////////// + userSession.get().then(setProject); + function setProject(session) { + ctrl.projectName = session.project_name; + } + function isDescriptionSupported(data) { ctrl.isDescriptionSupported = data.data; } diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/details/details.controller.spec.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/details/details.controller.spec.js index d25ee721ef..11d918b38e 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/details/details.controller.spec.js +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/details/details.controller.spec.js @@ -24,6 +24,7 @@ describe('LaunchInstanceDetailsController', function() { var $q, scope, ctrl, deferred; + var sessionObj = {project_name: 'alt_demo'}; var novaAPI = { isFeatureSupported: function() { var deferred = $q.defer(); @@ -43,6 +44,10 @@ $q = _$q_; deferred = $q.defer(); scope.initPromise = deferred.promise; + var session = $injector.get('horizon.app.core.openstack-service-api.userSession'); + var sessionDeferred = $q.defer(); + sessionDeferred.resolve(sessionObj); + spyOn(session, 'get').and.returnValue(sessionDeferred.promise); scope.model = { newInstanceSpec: { source: [], source_type: '' }, @@ -62,6 +67,11 @@ scope.$apply(); })); + it('sets ctrl.projectName', inject(function($timeout) { + $timeout.flush(); + expect(ctrl.projectName).toBe(sessionObj.project_name); + })); + it('should have isDescriptionSupported defined', function() { spyOn(novaAPI, 'isFeatureSupported').and.callFake(function () { var deferred = $q.defer(); diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/details/details.html b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/details/details.html index 31f2b0684e..849e805c2b 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/details/details.html +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/details/details.html @@ -4,6 +4,12 @@
+
+ + +
+