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,39 +1155,45 @@ export default {
|
|||||||
return dataIdentifier
|
return dataIdentifier
|
||||||
},
|
},
|
||||||
handleResponse (response, resourceName, resource, action, showLoading = true) {
|
handleResponse (response, resourceName, resource, action, showLoading = true) {
|
||||||
for (const obj in response) {
|
return new Promise(resolve => {
|
||||||
if (obj.includes('response')) {
|
let jobId = null
|
||||||
if (response[obj].jobid) {
|
for (const obj in response) {
|
||||||
return new Promise(resolve => {
|
if (obj.includes('response')) {
|
||||||
const jobid = response[obj].jobid
|
if (response[obj].jobid) {
|
||||||
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'InProgress', jobid)
|
jobId = response[obj].jobid
|
||||||
resolve(this.pollActionCompletion(jobid, action, resourceName, resource, showLoading))
|
} else {
|
||||||
})
|
if (this.selectedItems.length > 0) {
|
||||||
} else {
|
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'success')
|
||||||
if (this.selectedItems.length > 0) {
|
if (resource) {
|
||||||
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'success')
|
this.selectedItems.filter(item => item === resource)
|
||||||
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) {
|
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