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'),
|
catchMessage = i18n.t('label.error.caught'),
|
||||||
catchMethod = () => {},
|
catchMethod = () => {},
|
||||||
action = null,
|
action = null,
|
||||||
bulkAction = false,
|
bulkAction = false
|
||||||
originalPage = null
|
|
||||||
} = options
|
} = options
|
||||||
|
|
||||||
store.dispatch('AddHeaderNotice', {
|
store.dispatch('AddHeaderNotice', {
|
||||||
|
|||||||
@ -1155,14 +1155,12 @@ export default {
|
|||||||
return dataIdentifier
|
return dataIdentifier
|
||||||
},
|
},
|
||||||
handleResponse (response, resourceName, resource, action, showLoading = true) {
|
handleResponse (response, resourceName, resource, action, showLoading = true) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
let jobId = null
|
||||||
for (const obj in response) {
|
for (const obj in response) {
|
||||||
if (obj.includes('response')) {
|
if (obj.includes('response')) {
|
||||||
if (response[obj].jobid) {
|
if (response[obj].jobid) {
|
||||||
return new Promise(resolve => {
|
jobId = response[obj].jobid
|
||||||
const jobid = response[obj].jobid
|
|
||||||
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'InProgress', jobid)
|
|
||||||
resolve(this.pollActionCompletion(jobid, action, resourceName, resource, showLoading))
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
if (this.selectedItems.length > 0) {
|
if (this.selectedItems.length > 0) {
|
||||||
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'success')
|
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'success')
|
||||||
@ -1177,6 +1175,13 @@ export default {
|
|||||||
message = message + ' - ' + this.$t(action.successMessage)
|
message = message + ' - ' + this.$t(action.successMessage)
|
||||||
duration = 5
|
duration = 5
|
||||||
}
|
}
|
||||||
|
if (this.selectedItems.length === 0) {
|
||||||
|
this.$message.success({
|
||||||
|
content: message,
|
||||||
|
key: action.label + resourceName,
|
||||||
|
duration: duration
|
||||||
|
})
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1184,10 +1189,11 @@ export default {
|
|||||||
this.$store.dispatch('UpdateConfiguration')
|
this.$store.dispatch('UpdateConfiguration')
|
||||||
}
|
}
|
||||||
if (jobId) {
|
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) {
|
execSubmit (e) {
|
||||||
|
|||||||
@ -613,10 +613,8 @@ describe('Views > compute > MigrateWizard.vue', () => {
|
|||||||
await wrapper.vm.submitForm()
|
await wrapper.vm.submitForm()
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
expect(actions.AddAsyncJob).toHaveBeenCalled()
|
|
||||||
expect(mocks.$pollJob).toHaveBeenCalled()
|
expect(mocks.$pollJob).toHaveBeenCalled()
|
||||||
expect(wrapper.emitted()['close-action'][0]).toEqual([])
|
expect(wrapper.emitted()['close-action'][0]).toEqual([])
|
||||||
|
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user