mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
ui: Refresh only on current / parent page (#5214)
This commit is contained in:
parent
535761b2b9
commit
c4388d78e0
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user