This is an automated email from the ASF dual-hosted git repository.
dahn pushed a commit to branch 4.15
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.15 by this push:
new c4388d7 ui: Refresh only on current / parent page (#5214)
c4388d7 is described below
commit c4388d78e07c511815f86ba9215c791ae23422fc
Author: davidjumani <[email protected]>
AuthorDate: Wed Jul 21 15:05:30 2021 +0530
ui: Refresh only on current / parent page (#5214)
---
ui/src/utils/plugins.js | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/ui/src/utils/plugins.js b/ui/src/utils/plugins.js
index c7a385c..60dfff2 100644
--- a/ui/src/utils/plugins.js
+++ b/ui/src/utils/plugins.js
@@ -53,7 +53,8 @@ export const pollJobPlugin = {
showLoading = true,
catchMessage = i18n.t('label.error.caught'),
catchMethod = () => {},
- action = null
+ action = null,
+ originalPage = null
} = options
store.dispatch('AddHeaderNotice', {
@@ -63,6 +64,7 @@ export const pollJobPlugin = {
status: 'progress'
})
+ options.originalPage = options.originalPage ? options.originalPage :
this.$router.currentRoute.path
api('queryAsyncJobResult', { jobId }).then(json => {
const result = json.queryasyncjobresultresponse
if (result.jobstatus === 1) {
@@ -85,7 +87,11 @@ export const pollJobPlugin = {
status: 'done',
duration: 2
})
- if (!action || !('isFetchData' in action) || (action.isFetchData)) {
+
+ // Ensure we refresh on the same / parent page
+ const currentPage = this.$router.currentRoute.path
+ const samePage = originalPage === currentPage ||
originalPage.startsWith(currentPage + '/')
+ if (samePage && (!action || !('isFetchData' in action) ||
(action.isFetchData))) {
eventBus.$emit('async-job-complete')
}
successMethod(result)