From f45267174a1c49e38ced5fd7cecaf71726369cda Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 13 Jun 2024 11:58:36 +0530 Subject: [PATCH] ui: list only accessible networks during import (#9194) * ui: list only accessible networks during import Fixes #8612 Signed-off-by: Abhishek Kumar * fix Signed-off-by: Abhishek Kumar * space Signed-off-by: Abhishek Kumar * changes --------- Signed-off-by: Abhishek Kumar --- .../compute/wizard/MultiNetworkSelection.vue | 32 ++++++++++++++++--- .../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 @@