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

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


The following commit(s) were added to refs/heads/main by this push:
     new 19250403e64 ui: fix create k8s cluster multiple listing (#8539)
19250403e64 is described below

commit 19250403e645c76f60b17aa4aeb4dc915f5ca206
Author: Abhishek Kumar <[email protected]>
AuthorDate: Mon Jan 22 10:26:40 2024 +0530

    ui: fix create k8s cluster multiple listing (#8539)
    
    Fixes #8536
    
    Signed-off-by: Abhishek Kumar <[email protected]>
---
 ui/src/views/compute/CreateKubernetesCluster.vue | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/ui/src/views/compute/CreateKubernetesCluster.vue 
b/ui/src/views/compute/CreateKubernetesCluster.vue
index 1240531ddd7..ca1e424cca4 100644
--- a/ui/src/views/compute/CreateKubernetesCluster.vue
+++ b/ui/src/views/compute/CreateKubernetesCluster.vue
@@ -259,18 +259,12 @@ export default {
     this.apiParams = this.$getApiParams('createKubernetesCluster')
   },
   created () {
-    this.networks = [
-      {
-        id: null,
-        name: ''
-      }
-    ]
-    this.keyPairs = [
-      {
-        id: null,
-        name: ''
-      }
-    ]
+    this.emptyEntry = {
+      id: null,
+      name: ''
+    }
+    this.networks = [this.emptyEntry]
+    this.keyPairs = [this.emptyEntry]
     this.initForm()
     this.fetchData()
   },
@@ -322,7 +316,6 @@ export default {
     },
     fetchData () {
       this.fetchZoneData()
-      this.fetchNetworkData()
       this.fetchKeyPairData()
     },
     isValidValueForKey (obj, key) {
@@ -417,14 +410,16 @@ export default {
         params.zoneid = this.selectedZone.id
       }
       this.networkLoading = true
+      this.networks = []
       api('listNetworks', params).then(json => {
         var listNetworks = json.listnetworksresponse.network
         if (this.arrayHasItems(listNetworks)) {
           listNetworks = listNetworks.filter(n => n.type !== 'L2')
-          this.networks = this.networks.concat(listNetworks)
+          this.networks = listNetworks
         }
       }).finally(() => {
         this.networkLoading = false
+        this.networks = [this.emptyEntry].concat(this.networks)
         if (this.arrayHasItems(this.networks)) {
           this.form.networkid = 0
         }

Reply via email to