From 432d0c19adfa5b2e445def67e1e566cc26ed2bea Mon Sep 17 00:00:00 2001 From: Hoang Nguyen Date: Mon, 5 Oct 2020 18:46:57 +0700 Subject: [PATCH] Fix reload data after delete vm (#761) * fix reload data after delete vm * fix call fetchData after pollJob success response Signed-off-by: Rohit Yadav --- ui/src/utils/plugins.js | 4 ++-- ui/src/views/AutogenView.vue | 7 ++++++- ui/src/views/compute/DestroyVM.vue | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ui/src/utils/plugins.js b/ui/src/utils/plugins.js index 8647c317ecf..b3a911ce6d2 100644 --- a/ui/src/utils/plugins.js +++ b/ui/src/utils/plugins.js @@ -66,7 +66,7 @@ export const pollJobPlugin = { key: jobId, duration: 2 }) - eventBus.$emit('async-job-complete') + eventBus.$emit('async-job-complete', action) successMethod(result) } else if (result.jobstatus === 2) { message.error({ @@ -88,7 +88,7 @@ export const pollJobPlugin = { key: jobId, duration: 0 }) - eventBus.$emit('async-job-complete') + eventBus.$emit('async-job-complete', action) errorMethod(result) } else if (result.jobstatus === 0) { if (showLoading) { diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue index f607ea59d5f..c913fcd503f 100644 --- a/ui/src/views/AutogenView.vue +++ b/ui/src/views/AutogenView.vue @@ -402,7 +402,12 @@ export default { this.fetchData() } }) - eventBus.$on('async-job-complete', () => { + eventBus.$on('async-job-complete', (action) => { + if (this.$route.path.includes('/vm/')) { + if (action && 'api' in action && ['destroyVirtualMachine'].includes(action.api)) { + return + } + } this.fetchData() }) eventBus.$on('exec-action', (action, isGroupAction) => { diff --git a/ui/src/views/compute/DestroyVM.vue b/ui/src/views/compute/DestroyVM.vue index a20f6141a03..b466bee243c 100644 --- a/ui/src/views/compute/DestroyVM.vue +++ b/ui/src/views/compute/DestroyVM.vue @@ -141,6 +141,9 @@ export default { } else { this.parentFetchData() } + }, + action: { + api: 'destroyVirtualMachine' } }) this.closeAction()