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,39 +1155,45 @@ export default {
|
||||
return dataIdentifier
|
||||
},
|
||||
handleResponse (response, resourceName, resource, action, showLoading = true) {
|
||||
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))
|
||||
})
|
||||
} else {
|
||||
if (this.selectedItems.length > 0) {
|
||||
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'success')
|
||||
if (resource) {
|
||||
this.selectedItems.filter(item => item === resource)
|
||||
return new Promise(resolve => {
|
||||
let jobId = null
|
||||
for (const obj in response) {
|
||||
if (obj.includes('response')) {
|
||||
if (response[obj].jobid) {
|
||||
jobId = response[obj].jobid
|
||||
} else {
|
||||
if (this.selectedItems.length > 0) {
|
||||
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'success')
|
||||
if (resource) {
|
||||
this.selectedItems.filter(item => item === resource)
|
||||
}
|
||||
}
|
||||
var message = action.successMessage ? this.$t(action.successMessage) : this.$t(action.label) +
|
||||
(resourceName ? ' - ' + resourceName : '')
|
||||
var duration = 2
|
||||
if (action.additionalMessage) {
|
||||
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
|
||||
}
|
||||
var message = action.successMessage ? this.$t(action.successMessage) : this.$t(action.label) +
|
||||
(resourceName ? ' - ' + resourceName : '')
|
||||
var duration = 2
|
||||
if (action.additionalMessage) {
|
||||
message = message + ' - ' + this.$t(action.successMessage)
|
||||
duration = 5
|
||||
}
|
||||
break
|
||||
}
|
||||
if (['addLdapConfiguration', 'deleteLdapConfiguration'].includes(action.api)) {
|
||||
this.$store.dispatch('UpdateConfiguration')
|
||||
}
|
||||
if (jobId) {
|
||||
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'InProgress', jobId)
|
||||
resolve(this.pollActionCompletion(jobId, action, resourceName, resource, showLoading))
|
||||
}
|
||||
resolve(false)
|
||||
}
|
||||
if (['addLdapConfiguration', 'deleteLdapConfiguration'].includes(action.api)) {
|
||||
this.$store.dispatch('UpdateConfiguration')
|
||||
}
|
||||
if (jobId) {
|
||||
return resolve(this.pollActionCompletion(jobId, action, resourceName, showLoading))
|
||||
}
|
||||
|
||||
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