Restore network/port options for create instance dialog
An earlier commit:
d86c6ea3cc
patched the "create instance" dialog such that even when
its launched from Project -> Compute -> Instances, the "GBP" workflow step
is shown instead of the expected "Networks" and "Ports" steps. The former
should be shown only in the case when the dialog is launched from GBP and
the original behavior should be preserved when the dialog is launched from
Compute. This is being fixed here.
Change-Id: Ie9af2cca451942d51ea254bdf14bc2345743f938
This commit is contained in:
parent
99332501f0
commit
c0f6597c7f
|
@ -25,7 +25,8 @@
|
||||||
$provide.decorator(
|
$provide.decorator(
|
||||||
'horizon.dashboard.project.workflow.launch-instance.workflow',
|
'horizon.dashboard.project.workflow.launch-instance.workflow',
|
||||||
["$delegate", 'horizon.app.core.workflow.factory',
|
["$delegate", 'horizon.app.core.workflow.factory',
|
||||||
function($delegate, dashboardWorkflow)
|
'gbpui.group-member.launch-context.service',
|
||||||
|
function($delegate, dashboardWorkflow, launchContextService)
|
||||||
{
|
{
|
||||||
var steps = $delegate.steps;
|
var steps = $delegate.steps;
|
||||||
var gbstep = {
|
var gbstep = {
|
||||||
|
@ -36,24 +37,28 @@
|
||||||
formName: 'gbpForm'
|
formName: 'gbpForm'
|
||||||
};
|
};
|
||||||
|
|
||||||
// Finds and replaces the Network and Port wizard pages with
|
// This check can be potentially made more restrictive to specifically
|
||||||
// the GBP wizard page
|
// check if policy_target is in the URL
|
||||||
var networkIndex = -1;
|
if (launchContextService.launchContext.successUrl != '/dashboard/project/instances/') {
|
||||||
var portIndex = -1;
|
// Finds and replaces the Network and Port wizard pages with
|
||||||
angular.forEach(steps, function (step) {
|
// the GBP wizard page
|
||||||
if(step.id == 'networks') {
|
var networkIndex = -1;
|
||||||
networkIndex = steps.indexOf(step)
|
var portIndex = -1;
|
||||||
} else if(step.id == 'ports') {
|
angular.forEach(steps, function (step) {
|
||||||
portIndex = steps.indexOf(step);
|
if(step.id == 'networks') {
|
||||||
|
networkIndex = steps.indexOf(step)
|
||||||
|
} else if(step.id == 'ports') {
|
||||||
|
portIndex = steps.indexOf(step);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(networkIndex > -1) {
|
||||||
|
steps.splice(networkIndex, 1, gbstep);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
if(networkIndex > -1) {
|
if(portIndex > -1) {
|
||||||
steps.splice(networkIndex, 1, gbstep);
|
steps.splice(portIndex, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(portIndex > -1) {
|
|
||||||
steps.splice(portIndex, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = dashboardWorkflow($delegate);
|
var result = dashboardWorkflow($delegate);
|
||||||
|
|
Loading…
Reference in New Issue