Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ui/src/views/compute/DeployVM.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2319,7 +2319,9 @@ export default {
this.owner.domainid = null
this.owner.projectid = OwnerOptions.selectedProject
}
this.resetData()
if (OwnerOptions.initialized) {
this.resetData()
}
},
fetchZones (zoneId, listZoneAllow) {
this.zones = []
Expand Down
30 changes: 25 additions & 5 deletions ui/src/views/compute/wizard/OwnershipSelection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<a-form layout="vertical" >
<a-form-item :label="$t('label.owner.type')">
<a-select
@change="changeDomain"
@change="changeAccountTypeOrDomain"
v-model:value="selectedAccountType"
defaultValue="account"
autoFocus
Expand All @@ -37,7 +37,7 @@
</a-form-item>
<a-form-item :label="$t('label.domain')" required>
<a-select
@change="changeDomain"
@change="changeAccountTypeOrDomain"
v-model:value="selectedDomain"
showSearch
optionFilterProp="label"
Expand Down Expand Up @@ -136,14 +136,16 @@ export default {
components: { ResourceIcon },
data () {
return {
initialized: false,
domains: [],
accounts: [],
projects: [],
selectedAccountType: this.$store.getters.project?.id ? 'Project' : 'Account',
selectedDomain: null,
selectedAccount: null,
selectedProject: null,
loading: false
loading: false,
requestToken: 0
}
},
props: {
Expand Down Expand Up @@ -177,7 +179,7 @@ export default {
const domainIds = this.domains?.map(domain => 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)
Expand All @@ -186,8 +188,13 @@ export default {
this.loading = false
})
},
incrementAndGetRequestToken () {
this.requestToken += 1
return this.requestToken
},
fetchAccounts () {
this.loading = true
const currentToken = this.incrementAndGetRequestToken()
api('listAccounts', {
response: 'json',
domainId: this.selectedDomain,
Expand All @@ -196,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))
Expand All @@ -214,10 +224,12 @@ export default {
})
.finally(() => {
this.loading = false
this.initialized = true
})
},
fetchProjects () {
this.loading = true
const currentToken = this.incrementAndGetRequestToken()
api('listProjects', {
response: 'json',
domainId: this.selectedDomain,
Expand All @@ -227,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))
Expand All @@ -240,9 +255,14 @@ export default {
})
.finally(() => {
this.loading = false
this.initialized = true
})
},
changeDomain () {
changeAccountTypeOrDomain () {
this.initialized = true
this.fetchOwnerData()
Comment on lines +262 to +263
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be

Suggested change
this.initialized = true
this.fetchOwnerData()
this.fetchOwnerData()
this.initialized = true

or

Suggested change
this.initialized = true
this.fetchOwnerData()
this.initialized = false
this.fetchOwnerData()

?

Copy link
Contributor Author

@shwstppr shwstppr Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is fine as it is. The method changeAccountTypeOrDomain will be called only when the user changes the value in the select boxes

},
fetchOwnerData () {
if (this.selectedAccountType === 'Account') {
this.fetchAccounts()
} else {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/network/CreateIsolatedNetworkForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ export default {
this.owner.domainid = null
this.owner.projectid = OwnerOptions.selectedProject
}
if (isAdminOrDomainAdmin()) {
if (OwnerOptions.initialized && isAdminOrDomainAdmin()) {
this.updateVPCCheckAndFetchNetworkOfferingData()
}
},
Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/network/CreateL2NetworkForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export default {
this.owner.domainid = null
this.owner.projectid = OwnerOptions.selectedProject
}
if (isAdminOrDomainAdmin()) {
if (OwnerOptions.initialized && this.isAdminOrDomainAdmin()) {
this.updateVPCCheckAndFetchNetworkOfferingData()
}
},
Expand Down
8 changes: 3 additions & 5 deletions ui/src/views/storage/CreateSharedFS.vue
Original file line number Diff line number Diff line change
Expand Up @@ -272,23 +272,21 @@ export default {
},
fetchOwnerOptions (OwnerOptions) {
this.owner = {}
console.log('fetching owner')
if (OwnerOptions.selectedAccountType === 'Account') {
if (!OwnerOptions.selectedAccount) {
return
}
console.log('fetched account')
this.owner.account = OwnerOptions.selectedAccount
this.owner.domainid = OwnerOptions.selectedDomain
} else if (OwnerOptions.selectedAccountType === 'Project') {
if (!OwnerOptions.selectedProject) {
return
}
console.log('fetched project')
this.owner.projectid = OwnerOptions.selectedProject
}
console.log('fetched owner')
this.fetchData()
if (OwnerOptions.initialized) {
this.fetchData()
}
},
fetchData () {
this.minCpu = store.getters.features.sharedfsvmmincpucount
Expand Down
4 changes: 3 additions & 1 deletion ui/src/views/storage/CreateVolume.vue
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@ export default {
}
this.owner.projectid = OwnerOptions.selectedProject
}
this.fetchData()
if (OwnerOptions.initialized) {
this.fetchData()
}
},
fetchData () {
if (this.createVolumeFromSnapshot) {
Expand Down
Loading