mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
ui: Fix failing UI (#5263)
This commit is contained in:
parent
db31e67d51
commit
66e7bdedac
@ -55,8 +55,7 @@ export const pollJobPlugin = {
|
||||
catchMessage = i18n.t('label.error.caught'),
|
||||
catchMethod = () => {},
|
||||
action = null,
|
||||
bulkAction = false,
|
||||
originalPage = null
|
||||
bulkAction = false
|
||||
} = options
|
||||
|
||||
store.dispatch('AddHeaderNotice', {
|
||||
|
||||
@ -1155,14 +1155,12 @@ export default {
|
||||
return dataIdentifier
|
||||
},
|
||||
handleResponse (response, resourceName, resource, action, showLoading = true) {
|
||||
return new Promise(resolve => {
|
||||
let jobId = null
|
||||
for (const obj in response) {
|
||||
if (obj.includes('response')) {
|
||||
if (response[obj].jobid) {
|
||||
return new Promise(resolve => {
|
||||
const jobid = response[obj].jobid
|
||||
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'InProgress', jobid)
|
||||
resolve(this.pollActionCompletion(jobid, action, resourceName, resource, showLoading))
|
||||
})
|
||||
jobId = response[obj].jobid
|
||||
} else {
|
||||
if (this.selectedItems.length > 0) {
|
||||
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'success')
|
||||
@ -1177,6 +1175,13 @@ export default {
|
||||
message = message + ' - ' + this.$t(action.successMessage)
|
||||
duration = 5
|
||||
}
|
||||
if (this.selectedItems.length === 0) {
|
||||
this.$message.success({
|
||||
content: message,
|
||||
key: action.label + resourceName,
|
||||
duration: duration
|
||||
})
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -1184,10 +1189,11 @@ export default {
|
||||
this.$store.dispatch('UpdateConfiguration')
|
||||
}
|
||||
if (jobId) {
|
||||
return resolve(this.pollActionCompletion(jobId, action, resourceName, showLoading))
|
||||
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'InProgress', jobId)
|
||||
resolve(this.pollActionCompletion(jobId, action, resourceName, resource, showLoading))
|
||||
}
|
||||
resolve(false)
|
||||
}
|
||||
|
||||
return resolve(false)
|
||||
})
|
||||
},
|
||||
execSubmit (e) {
|
||||
|
||||
@ -613,10 +613,8 @@ describe('Views > compute > MigrateWizard.vue', () => {
|
||||
await wrapper.vm.submitForm()
|
||||
|
||||
setTimeout(() => {
|
||||
expect(actions.AddAsyncJob).toHaveBeenCalled()
|
||||
expect(mocks.$pollJob).toHaveBeenCalled()
|
||||
expect(wrapper.emitted()['close-action'][0]).toEqual([])
|
||||
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user