mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
ui: Fix refresh issue (#5232)
This commit is contained in:
parent
c23cbdff8d
commit
b065e79ae3
@ -55,7 +55,8 @@ export const pollJobPlugin = {
|
||||
catchMessage = i18n.t('label.error.caught'),
|
||||
catchMethod = () => {},
|
||||
action = null,
|
||||
bulkAction = false
|
||||
bulkAction = false,
|
||||
originalPage = null
|
||||
} = options
|
||||
|
||||
store.dispatch('AddHeaderNotice', {
|
||||
@ -65,6 +66,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) {
|
||||
@ -87,8 +89,12 @@ export const pollJobPlugin = {
|
||||
status: 'done',
|
||||
duration: 2
|
||||
})
|
||||
if (!action || !('isFetchData' in action) || (action.isFetchData)) {
|
||||
eventBus.$emit('async-job-complete', action)
|
||||
|
||||
// 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)
|
||||
} else if (result.jobstatus === 2) {
|
||||
|
||||
@ -1256,7 +1256,13 @@ export default {
|
||||
args = [action.api, params]
|
||||
}
|
||||
api(...args).then(json => {
|
||||
this.handleResponse(json, resourceName, this.getDataIdentifier(params), action).then(jobId => {
|
||||
var response = this.handleResponse(json, resourceName, this.getDataIdentifier(params), action)
|
||||
if (!response) {
|
||||
this.fetchData()
|
||||
this.closeAction()
|
||||
return
|
||||
}
|
||||
response.then(jobId => {
|
||||
hasJobId = jobId
|
||||
if ((action.icon === 'delete' || ['archiveEvents', 'archiveAlerts', 'unmanageVirtualMachine'].includes(action.api)) && this.dataView) {
|
||||
this.$router.go(-1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user