Tabs in launch server wizard not depending on OPENSTACK_NOVA_EXTENSIONS_BLACKLIST
OPENSTACK_NOVA_EXTENSIONS_BLACKLIST is used to disable specific extension.
In the launch instance wizard, by example the Server Group tab should be hidden
when the extension "ServerGroups" is blacklisted but it isn't.
It could be interesting to make these tabs dependent of the supported extensions.
Change-Id: I15ea0f1010e3889c217c63e98f1752a4c1ad9ceb
Closes-Bug: #1745367
(cherry picked from commit c7bc9242b9
)
This commit is contained in:
parent
2785a60bb4
commit
af6740ce20
|
@ -81,7 +81,8 @@
|
|||
title: gettext('Key Pair'),
|
||||
templateUrl: basePath + 'keypair/keypair.html',
|
||||
helpUrl: basePath + 'keypair/keypair.help.html',
|
||||
formName: 'launchInstanceKeypairForm'
|
||||
formName: 'launchInstanceKeypairForm',
|
||||
novaExtension: 'Keypairs'
|
||||
},
|
||||
{
|
||||
id: 'configuration',
|
||||
|
@ -96,7 +97,8 @@
|
|||
templateUrl: basePath + 'server-groups/server-groups.html',
|
||||
helpUrl: basePath + 'server-groups/server-groups.help.html',
|
||||
formName: 'launchInstanceServerGroupsForm',
|
||||
policy: stepPolicy.serverGroups
|
||||
policy: stepPolicy.serverGroups,
|
||||
novaExtension: 'ServerGroups'
|
||||
},
|
||||
{
|
||||
id: 'hints',
|
||||
|
@ -105,7 +107,8 @@
|
|||
helpUrl: basePath + 'scheduler-hints/scheduler-hints.help.html',
|
||||
formName: 'launchInstanceSchedulerHintsForm',
|
||||
policy: stepPolicy.schedulerHints,
|
||||
setting: 'LAUNCH_INSTANCE_DEFAULTS.enable_scheduler_hints'
|
||||
setting: 'LAUNCH_INSTANCE_DEFAULTS.enable_scheduler_hints',
|
||||
novaExtension: 'SchedulerHints'
|
||||
},
|
||||
{
|
||||
id: 'metadata',
|
||||
|
|
|
@ -71,13 +71,26 @@
|
|||
expect(launchInstanceWorkflow.steps[4].requiredServiceTypes).toEqual(['network']);
|
||||
});
|
||||
|
||||
it('has a nova extension the key pair step depends on', function() {
|
||||
expect(launchInstanceWorkflow.steps[6].novaExtension).toEqual("Keypairs");
|
||||
});
|
||||
|
||||
it('has a policy rule for the server groups step', function() {
|
||||
expect(launchInstanceWorkflow.steps[8].policy).toEqual(stepPolicy.serverGroups);
|
||||
});
|
||||
|
||||
it('has a nova extension the server groups step depends on', function() {
|
||||
expect(launchInstanceWorkflow.steps[8].novaExtension).toEqual("ServerGroups");
|
||||
});
|
||||
|
||||
it('has a policy rule for the scheduler hints step', function() {
|
||||
expect(launchInstanceWorkflow.steps[9].policy).toEqual(stepPolicy.schedulerHints);
|
||||
});
|
||||
|
||||
it('has a nova extension the scheduler hints step depends on', function() {
|
||||
expect(launchInstanceWorkflow.steps[9].novaExtension).toEqual("SchedulerHints");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
|
@ -50,12 +50,13 @@
|
|||
'$q',
|
||||
'horizon.app.core.openstack-service-api.serviceCatalog',
|
||||
'horizon.app.core.openstack-service-api.policy',
|
||||
'horizon.app.core.openstack-service-api.settings'
|
||||
'horizon.app.core.openstack-service-api.settings',
|
||||
'horizon.app.core.openstack-service-api.novaExtensions'
|
||||
];
|
||||
|
||||
/////////////
|
||||
|
||||
function dashboardWorkflowDecorator($q, serviceCatalog, policy, settings) {
|
||||
function dashboardWorkflowDecorator($q, serviceCatalog, policy, settings, novaExtensions) {
|
||||
return decorator;
|
||||
|
||||
function decorator(spec) {
|
||||
|
@ -81,6 +82,9 @@
|
|||
if (step.setting) {
|
||||
promises.push(settings.ifEnabled(step.setting, true, true));
|
||||
}
|
||||
if (step.novaExtension) {
|
||||
promises.push(novaExtensions.ifNameEnabled(step.novaExtension));
|
||||
}
|
||||
if (promises.length > 0) {
|
||||
step.checkReadiness = function () {
|
||||
return $q.all(promises);
|
||||
|
|
|
@ -17,12 +17,14 @@
|
|||
'use strict';
|
||||
|
||||
describe('Workflow Decorator', function () {
|
||||
var decoratorService, catalogService, policyService, settingsService, $scope, deferred;
|
||||
var decoratorService, catalogService, policyService, settingsService, $scope, deferred,
|
||||
novaExtensionsService;
|
||||
var steps = [
|
||||
{ id: '1' },
|
||||
{ id: '2', requiredServiceTypes: ['foo-service'] },
|
||||
{ id: '3', policy: 'foo-policy' },
|
||||
{ id: '4', setting: 'STEPS.step_4_enabled' }
|
||||
{ id: '4', setting: 'STEPS.step_4_enabled' },
|
||||
{ id: '5', novaExtension: 'foo-novaExtension'}
|
||||
];
|
||||
var spec = { steps: steps };
|
||||
|
||||
|
@ -38,9 +40,12 @@
|
|||
catalogService = $injector.get('horizon.app.core.openstack-service-api.serviceCatalog');
|
||||
policyService = $injector.get('horizon.app.core.openstack-service-api.policy');
|
||||
settingsService = $injector.get('horizon.app.core.openstack-service-api.settings');
|
||||
novaExtensionsService = $injector
|
||||
.get('horizon.app.core.openstack-service-api.novaExtensions');
|
||||
spyOn(catalogService, 'ifTypeEnabled').and.returnValue(deferred.promise);
|
||||
spyOn(policyService, 'ifAllowed').and.returnValue(deferred.promise);
|
||||
spyOn(settingsService, 'ifEnabled').and.returnValue(deferred.promise);
|
||||
spyOn(novaExtensionsService, 'ifNameEnabled').and.returnValue(deferred.promise);
|
||||
}));
|
||||
|
||||
it('is a function', function() {
|
||||
|
@ -58,6 +63,8 @@
|
|||
expect(policyService.ifAllowed).toHaveBeenCalledWith('foo-policy');
|
||||
expect(settingsService.ifEnabled.calls.count()).toBe(1);
|
||||
expect(settingsService.ifEnabled).toHaveBeenCalledWith('STEPS.step_4_enabled', true, true);
|
||||
expect(novaExtensionsService.ifNameEnabled.calls.count()).toBe(1);
|
||||
expect(novaExtensionsService.ifNameEnabled).toHaveBeenCalledWith('foo-novaExtension');
|
||||
});
|
||||
|
||||
it('step checkReadiness function returns correct results', function() {
|
||||
|
|
Loading…
Reference in New Issue