diff --git a/ui/src/views/network/VpcTiersTab.vue b/ui/src/views/network/VpcTiersTab.vue index 214ea1afd6d..402f9f06115 100644 --- a/ui/src/views/network/VpcTiersTab.vue +++ b/ui/src/views/network/VpcTiersTab.vue @@ -522,7 +522,7 @@ export default { }).then(async json => { var lbNetworks = json.listnetworksresponse.network || [] if (lbNetworks.length > 0) { - this.publicLBExists = true + this.publicLBExists = false for (var idx = 0; idx < lbNetworks.length; idx++) { const lbNetworkOffering = await this.getNetworkOffering(lbNetworks[idx].networkofferingid) const index = lbNetworkOffering.service.map(svc => { return svc.name }).indexOf('Lb') @@ -546,16 +546,23 @@ export default { }).then(json => { this.networkOfferings = json.listnetworkofferingsresponse.networkoffering || [] var filteredOfferings = [] - if (this.publicLBExists) { - for (var index in this.networkOfferings) { - const offering = this.networkOfferings[index] - const idx = offering.service.map(svc => { return svc.name }).indexOf('Lb') - if (idx === -1 || this.lbProviderMap.publicLb.vpc.indexOf(offering.service.map(svc => { return svc.provider[0].name })[idx]) === -1) { + const vpcLbServiceIndex = this.resource.service.map(svc => { return svc.name }).indexOf('Lb') + for (var index in this.networkOfferings) { + const offering = this.networkOfferings[index] + const idx = offering.service.map(svc => { return svc.name }).indexOf('Lb') + if (this.publicLBExists && (idx === -1 || this.lbProviderMap.publicLb.vpc.indexOf(offering.service.map(svc => { return svc.provider[0].name })[idx]) === -1)) { + filteredOfferings.push(offering) + } else if (!this.publicLBExists && vpcLbServiceIndex > -1) { + const vpcLbServiceProvider = vpcLbServiceIndex === -1 ? undefined : this.resource.service[vpcLbServiceIndex].provider[0].name + const offeringLbServiceProvider = idx === -1 ? undefined : offering.service[idx].provider[0].name + if (vpcLbServiceProvider && (!offeringLbServiceProvider || (offeringLbServiceProvider && vpcLbServiceProvider === offeringLbServiceProvider))) { filteredOfferings.push(offering) } + } else { + filteredOfferings.push(offering) } - this.networkOfferings = filteredOfferings } + this.networkOfferings = filteredOfferings this.form.networkOffering = this.networkOfferings[0].id }).catch(error => { this.$notifyError(error)