From e48c8c7eecdaf9ddbb0ff84c1f76360cf02f421c Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 24 Sep 2025 16:02:33 +0530 Subject: [PATCH 1/3] ui: fix form data double fetch/reset DeployVMFromBackup form data by ownership selection Related #11705 Signed-off-by: Abhishek Kumar --- ui/src/components/view/DeployVMFromBackup.vue | 4 +++- ui/src/views/compute/wizard/OwnershipSelection.vue | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/src/components/view/DeployVMFromBackup.vue b/ui/src/components/view/DeployVMFromBackup.vue index 8d929a1fed0f..5dc6d486fe60 100644 --- a/ui/src/components/view/DeployVMFromBackup.vue +++ b/ui/src/components/view/DeployVMFromBackup.vue @@ -2050,7 +2050,9 @@ export default { this.owner.domainid = null this.owner.projectid = OwnerOptions.selectedProject } - this.resetData() + if (OwnerOptions.initialized) { + this.resetData() + } }, fetchZones (zoneId, listZoneAllow) { this.zones = [] diff --git a/ui/src/views/compute/wizard/OwnershipSelection.vue b/ui/src/views/compute/wizard/OwnershipSelection.vue index 59f781a75aa5..40eebc4caa56 100644 --- a/ui/src/views/compute/wizard/OwnershipSelection.vue +++ b/ui/src/views/compute/wizard/OwnershipSelection.vue @@ -136,6 +136,7 @@ export default { components: { ResourceIcon }, data () { return { + initialized: false, domains: [], accounts: [], projects: [], @@ -214,6 +215,7 @@ export default { }) .finally(() => { this.loading = false + this.initialized = true }) }, fetchProjects () { @@ -240,6 +242,7 @@ export default { }) .finally(() => { this.loading = false + this.initialized = true }) }, changeDomain () { From 4b9f86c2022e25113b2657af58d3ea9272e8929a Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 25 Sep 2025 14:50:54 +0530 Subject: [PATCH 2/3] fix Signed-off-by: Abhishek Kumar --- .../compute/wizard/OwnershipSelection.vue | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/ui/src/views/compute/wizard/OwnershipSelection.vue b/ui/src/views/compute/wizard/OwnershipSelection.vue index 40eebc4caa56..3c0edd40e1c1 100644 --- a/ui/src/views/compute/wizard/OwnershipSelection.vue +++ b/ui/src/views/compute/wizard/OwnershipSelection.vue @@ -19,7 +19,7 @@ domain.id) const ownerDomainId = this.$store.getters.project?.domainid || this.$store.getters.userInfo.domainid this.selectedDomain = domainIds?.includes(ownerDomainId) ? ownerDomainId : this.domains?.[0]?.id - this.changeDomain() + this.fetchOwnerData() }) .catch((error) => { this.$notifyError(error) @@ -187,8 +188,13 @@ export default { this.loading = false }) }, + increamentAndGetRequestToken () { + this.requestToken += 1 + return this.requestToken + }, fetchAccounts () { this.loading = true + const currentToken = this.increamentAndGetRequestToken() getAPI('listAccounts', { response: 'json', domainId: this.selectedDomain, @@ -197,6 +203,9 @@ export default { isrecursive: false }) .then((response) => { + if (currentToken !== this.requestToken) { + return + } this.accounts = response.listaccountsresponse.account || [] if (this.override?.accounts && this.accounts) { this.accounts = this.accounts.filter(item => this.override.accounts.has(item.name)) @@ -220,6 +229,7 @@ export default { }, fetchProjects () { this.loading = true + const currentToken = this.increamentAndGetRequestToken() getAPI('listProjects', { response: 'json', domainId: this.selectedDomain, @@ -229,6 +239,9 @@ export default { isrecursive: false }) .then((response) => { + if (currentToken !== this.requestToken) { + return + } this.projects = response.listprojectsresponse.project if (this.override?.projects && this.projects) { this.projects = this.projects.filter(item => this.override.projects.has(item.id)) @@ -245,7 +258,11 @@ export default { this.initialized = true }) }, - changeDomain () { + changeAccountTypeOrDomain () { + this.initialized = true + this.fetchOwnerData() + }, + fetchOwnerData () { if (this.selectedAccountType === 'Account') { this.fetchAccounts() } else { From 84795f1450787ee628f7a04a352505ffe0484d62 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 25 Sep 2025 18:19:59 +0530 Subject: [PATCH 3/3] fix Signed-off-by: Abhishek Kumar --- ui/src/views/compute/wizard/OwnershipSelection.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/src/views/compute/wizard/OwnershipSelection.vue b/ui/src/views/compute/wizard/OwnershipSelection.vue index 3c0edd40e1c1..484ffdb690fc 100644 --- a/ui/src/views/compute/wizard/OwnershipSelection.vue +++ b/ui/src/views/compute/wizard/OwnershipSelection.vue @@ -188,13 +188,13 @@ export default { this.loading = false }) }, - increamentAndGetRequestToken () { + incrementAndGetRequestToken () { this.requestToken += 1 return this.requestToken }, fetchAccounts () { this.loading = true - const currentToken = this.increamentAndGetRequestToken() + const currentToken = this.incrementAndGetRequestToken() getAPI('listAccounts', { response: 'json', domainId: this.selectedDomain, @@ -229,7 +229,7 @@ export default { }, fetchProjects () { this.loading = true - const currentToken = this.increamentAndGetRequestToken() + const currentToken = this.incrementAndGetRequestToken() getAPI('listProjects', { response: 'json', domainId: this.selectedDomain,