Skip to content

Commit 2af3738

Browse files
committed
handle deleteDomain as async job and poll job result
1 parent 68e7d88 commit 2af3738

File tree

2 files changed

+27
-21
lines changed

2 files changed

+27
-21
lines changed

ui/public/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2970,7 +2970,7 @@
29702970
"message.delete.account.success": "Successfully deleted account",
29712971
"message.delete.account.warning": "Deleting this account will delete all of the instances, volumes and snapshots associated with the account.",
29722972
"message.delete.domain.confirm": "Please confirm that you want to delete this domain by entering the name of the domain below.",
2973-
"message.delete.domain.warning": "Deleting this domain will permanently delete all associated accounts. All active and inactive virtual machines will be powered off and removed. This action cannot be undone.",
2973+
"message.delete.domain.warning": "This domain may contain accounts, users, or sub-domains. All of these must be removed before the domain can be deleted. This action cannot be undone.",
29742974
"message.delete.domain.failed": "Delete domain failed",
29752975
"message.delete.acl.processing": "Removing ACL rule...",
29762976
"message.delete.acl.rule": "Remove ACL rule",

ui/src/views/iam/DomainView.vue

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -334,30 +334,36 @@ export default {
334334
this.showAction = false
335335
},
336336
confirmDeleteDomain () {
337-
const params = { id: this.deleteDomainResource.id }
337+
const domain = this.deleteDomainResource
338+
const params = { id: domain.id }
338339
339-
api('deleteDomain', params)
340-
.then(() => {
341-
this.$notification.success({
342-
message: 'Domain Deleted',
343-
description: `Domain ${this.deleteDomainResource.name} has been successfully deleted.`
344-
})
345-
if (this.$route.params.id === this.deleteDomainResource.id) {
346-
this.$router.push({ path: '/domain' })
340+
api('deleteDomain', params).then(json => {
341+
const jobId = json.deletedomainresponse.jobid
342+
343+
this.$pollJob({
344+
jobId,
345+
title: this.$t('label.action.delete.domain'),
346+
description: domain.name,
347+
loadingMessage: `${this.$t('label.action.delete.domain')} ${domain.name}`,
348+
successMessage: `${this.$t('label.action.delete.domain')} ${domain.name}`,
349+
catchMessage: this.$t('error.fetching.async.job.result'),
350+
successMethod: () => {
351+
if (this.$route.params.id === domain.id) {
352+
this.$router.push({ path: '/domain' })
353+
}
354+
this.fetchData()
347355
}
348-
this.fetchData()
349-
})
350-
.catch(error => {
351-
this.$notification.error({
352-
message: 'Failed to delete domain',
353-
description: error.response?.headers['x-description'] || this.$t('message.request.failed')
354-
})
355356
})
356-
.finally(() => {
357-
this.showDeleteConfirm = false
358-
this.deleteDomainResource = null
359-
this.treeDeletedKey = this.deleteDomainResource?.id || null
357+
}).catch(error => {
358+
this.$notification.error({
359+
message: this.$t('message.request.failed'),
360+
description: error.response?.headers['x-description'] || this.$t('message.request.failed')
360361
})
362+
}).finally(() => {
363+
this.showDeleteConfirm = false
364+
this.deleteDomainResource = null
365+
this.treeDeletedKey = null
366+
})
361367
},
362368
forceRerender () {
363369
this.treeViewKey += 1

0 commit comments

Comments
 (0)