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

bstoyanov 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 f45267174a1 ui: list only accessible networks during import (#9194)
f45267174a1 is described below

commit f45267174a1c49e38ced5fd7cecaf71726369cda
Author: Abhishek Kumar <abhishek.mr...@gmail.com>
AuthorDate: Thu Jun 13 11:58:36 2024 +0530

    ui: list only accessible networks during import (#9194)
    
    * ui: list only accessible networks during import
    
    Fixes #8612
    
    Signed-off-by: Abhishek Kumar <abhishek.mr...@gmail.com>
    
    * fix
    
    Signed-off-by: Abhishek Kumar <abhishek.mr...@gmail.com>
    
    * space
    
    Signed-off-by: Abhishek Kumar <abhishek.mr...@gmail.com>
    
    * changes
    
    ---------
    
    Signed-off-by: Abhishek Kumar <abhishek.mr...@gmail.com>
---
 .../views/compute/wizard/MultiNetworkSelection.vue | 32 +++++++++++++++++++---
 ui/src/views/tools/ImportUnmanagedInstance.vue     |  6 +++-
 2 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/ui/src/views/compute/wizard/MultiNetworkSelection.vue 
b/ui/src/views/compute/wizard/MultiNetworkSelection.vue
index 048a70671d9..92d4a437599 100644
--- a/ui/src/views/compute/wizard/MultiNetworkSelection.vue
+++ b/ui/src/views/compute/wizard/MultiNetworkSelection.vue
@@ -99,6 +99,14 @@ export default {
       type: String,
       default: () => ''
     },
+    domainid: {
+      type: String,
+      default: ''
+    },
+    account: {
+      type: String,
+      default: ''
+    },
     selectionEnabled: {
       type: Boolean,
       default: true
@@ -144,7 +152,8 @@ export default {
       ipAddressesEnabled: {},
       ipAddresses: {},
       indexNum: 1,
-      sendValuesTimer: null
+      sendValuesTimer: null,
+      accountNetworkUpdateTimer: null
     }
   },
   computed: {
@@ -184,6 +193,14 @@ export default {
     },
     zoneId () {
       this.fetchNetworks()
+    },
+    account () {
+      clearTimeout(this.accountNetworkUpdateTimer)
+      this.accountNetworkUpdateTimer = setTimeout(() => {
+        if (this.account) {
+          this.fetchNetworks()
+        }
+      }, 750)
     }
   },
   created () {
@@ -196,13 +213,20 @@ export default {
         return
       }
       this.loading = true
-      api('listNetworks', {
+      var params = {
         zoneid: this.zoneId,
         listall: true
-      }).then(response => {
+      }
+      if (this.domainid && this.account) {
+        params.domainid = this.domainid
+        params.account = this.account
+      }
+      api('listNetworks', params).then(response => {
         this.networks = response.listnetworksresponse.network || []
-        this.orderNetworks()
+      }).catch(() => {
+        this.networks = []
       }).finally(() => {
+        this.orderNetworks()
         this.loading = false
       })
     },
diff --git a/ui/src/views/tools/ImportUnmanagedInstance.vue 
b/ui/src/views/tools/ImportUnmanagedInstance.vue
index 9eb74877365..4fb559b2628 100644
--- a/ui/src/views/tools/ImportUnmanagedInstance.vue
+++ b/ui/src/views/tools/ImportUnmanagedInstance.vue
@@ -297,6 +297,8 @@
                 <multi-network-selection
                   :items="nics"
                   :zoneId="cluster.zoneid"
+                  :domainid="form.domainid"
+                  :account="form.account"
                   :selectionEnabled="false"
                   :filterUnimplementedNetworks="true"
                   :hypervisor="this.cluster.hypervisortype"
@@ -693,7 +695,9 @@ export default {
       this.form = reactive({
         rootdiskid: 0,
         migrateallowed: this.switches.migrateAllowed,
-        forced: this.switches.forced
+        forced: this.switches.forced,
+        domainid: null,
+        account: null
       })
       this.rules = reactive({
         displayname: [{ required: true, message: 
this.$t('message.error.input.value') }],

Reply via email to