fix launch instance GBP issue

Change-Id: Ieb10c59d4b06c56e4cfde9f80c34d17b6bf9eb74
(cherry picked from commit 3e823ad3dc)
This commit is contained in:
Pulkit vajpayee 2022-07-20 11:48:33 +05:30 committed by pulkit vajpayee
parent eae2d5c646
commit edc775c980
2 changed files with 17 additions and 4 deletions

View File

@ -22,12 +22,25 @@
.factory('gbpui.group-member.launch-context.service', launchContextService);
launchContextService.$inject = [];
launchContextService.$inject = [
'$location',
'horizon.framework.util.http.service',
];
function launchContextService() {
function launchContextService($location,apiService) {
var policyGroups = {'data':[],'status':0};
!$location.absUrl().includes('login') && apiService
.get('project/policytargets/policy_target_groups')
.error(function () {
policyGroups.status = 1
}).then(data => {
policyGroups.data = data.data;
policyGroups.status = 1;
});
return {
launchContext: {
defaults: []
defaults: [],
policyGroups,
}
};
}

View File

@ -39,7 +39,7 @@
// This check can be potentially made more restrictive to specifically
// check if policy_target is in the URL
if (launchContextService.launchContext.successUrl != '/dashboard/project/instances/' && launchContextService.launchContext.successUrl != '/dashboard/project/network_topology/' && launchContextService.launchContext.successUrl != '/project/instances/' && launchContextService.launchContext.successUrl != '/project/network_topology/') {
if (launchContextService.launchContext.policyGroups.data.length && launchContextService.launchContext.successUrl != '/dashboard/project/instances/' && launchContextService.launchContext.successUrl != '/dashboard/project/network_topology/' && launchContextService.launchContext.successUrl != '/project/instances/' && launchContextService.launchContext.successUrl != '/project/network_topology/') {
// Finds and replaces the Network and Port wizard pages with
// the GBP wizard page
var networkIndex = -1;