Skip to content

Commit a385ff1

Browse files
authored
UI: Fix VPC network offerings listing on VPC tier creation (#9557)
1 parent a8ab47b commit a385ff1

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

ui/src/views/network/VpcTiersTab.vue

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ export default {
522522
}).then(async json => {
523523
var lbNetworks = json.listnetworksresponse.network || []
524524
if (lbNetworks.length > 0) {
525-
this.publicLBExists = true
525+
this.publicLBExists = false
526526
for (var idx = 0; idx < lbNetworks.length; idx++) {
527527
const lbNetworkOffering = await this.getNetworkOffering(lbNetworks[idx].networkofferingid)
528528
const index = lbNetworkOffering.service.map(svc => { return svc.name }).indexOf('Lb')
@@ -546,16 +546,23 @@ export default {
546546
}).then(json => {
547547
this.networkOfferings = json.listnetworkofferingsresponse.networkoffering || []
548548
var filteredOfferings = []
549-
if (this.publicLBExists) {
550-
for (var index in this.networkOfferings) {
551-
const offering = this.networkOfferings[index]
552-
const idx = offering.service.map(svc => { return svc.name }).indexOf('Lb')
553-
if (idx === -1 || this.lbProviderMap.publicLb.vpc.indexOf(offering.service.map(svc => { return svc.provider[0].name })[idx]) === -1) {
549+
const vpcLbServiceIndex = this.resource.service.map(svc => { return svc.name }).indexOf('Lb')
550+
for (var index in this.networkOfferings) {
551+
const offering = this.networkOfferings[index]
552+
const idx = offering.service.map(svc => { return svc.name }).indexOf('Lb')
553+
if (this.publicLBExists && (idx === -1 || this.lbProviderMap.publicLb.vpc.indexOf(offering.service.map(svc => { return svc.provider[0].name })[idx]) === -1)) {
554+
filteredOfferings.push(offering)
555+
} else if (!this.publicLBExists && vpcLbServiceIndex > -1) {
556+
const vpcLbServiceProvider = vpcLbServiceIndex === -1 ? undefined : this.resource.service[vpcLbServiceIndex].provider[0].name
557+
const offeringLbServiceProvider = idx === -1 ? undefined : offering.service[idx].provider[0].name
558+
if (vpcLbServiceProvider && (!offeringLbServiceProvider || (offeringLbServiceProvider && vpcLbServiceProvider === offeringLbServiceProvider))) {
554559
filteredOfferings.push(offering)
555560
}
561+
} else {
562+
filteredOfferings.push(offering)
556563
}
557-
this.networkOfferings = filteredOfferings
558564
}
565+
this.networkOfferings = filteredOfferings
559566
this.form.networkOffering = this.networkOfferings[0].id
560567
}).catch(error => {
561568
this.$notifyError(error)

0 commit comments

Comments
 (0)