Merge "Show project name at launch instance dialog"
This commit is contained in:
commit
29260bbf13
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -4,6 +4,12 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<div class="form-group">
|
||||
<label class="control-label" translate for="project_name">Project Name</label>
|
||||
<input id="project_name" name="project_name" type="text" class="form-control themable-disabled"
|
||||
disabled="disabled" value="{$ ctrl.projectName $}">
|
||||
</div>
|
||||
|
||||
<div class="form-group"
|
||||
ng-class="{ 'has-error': launchInstanceDetailsForm.name.$invalid && launchInstanceDetailsForm.name.$dirty }">
|
||||
<label for="name" class="control-label">
|
||||
|
@ -20,5 +20,10 @@
|
||||
.themable-checkbox {
|
||||
padding-top: $padding-base-vertical;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.form-control {
|
||||
&.themable-disabled {
|
||||
background-color: $input-bg;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user