Skip to content
Merged
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
10 changes: 8 additions & 2 deletions ui/src/utils/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand All @@ -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) {
Expand All @@ -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)
Expand Down