This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch 4.19
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.19 by this push:
     new a385ff1a214 UI: Fix VPC network offerings listing on VPC tier creation 
(#9557)
a385ff1a214 is described below

commit a385ff1a214f432944cba78f721da35473ba6004
Author: Nicolas Vazquez <[email protected]>
AuthorDate: Wed Sep 18 08:04:12 2024 -0300

    UI: Fix VPC network offerings listing on VPC tier creation (#9557)
---
 ui/src/views/network/VpcTiersTab.vue | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

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)

Reply via email to