mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge remote-tracking branch 'origin/4.15' into main
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> Conflicts: ui/src/utils/plugins.js ui/src/views/AutogenView.vue ui/tests/mockData/ActionButton.mock.json ui/tests/unit/views/compute/MigrateWizard.spec.js
This commit is contained in:
commit
db31e67d51
@ -145,7 +145,6 @@ export default {
|
|||||||
this.actionBadge = {}
|
this.actionBadge = {}
|
||||||
const arrAsync = []
|
const arrAsync = []
|
||||||
const actionBadge = this.actions.filter(action => action.showBadge === true)
|
const actionBadge = this.actions.filter(action => action.showBadge === true)
|
||||||
if ((actionBadge.dataView ? actionBadge.dataView : false) !== this.dataView) return
|
|
||||||
|
|
||||||
if (actionBadge && actionBadge.length > 0) {
|
if (actionBadge && actionBadge.length > 0) {
|
||||||
const dataLength = actionBadge.length
|
const dataLength = actionBadge.length
|
||||||
|
|||||||
@ -66,7 +66,7 @@ export const pollJobPlugin = {
|
|||||||
status: 'progress'
|
status: 'progress'
|
||||||
})
|
})
|
||||||
|
|
||||||
options.originalPage = options.originalPage ? options.originalPage : this.$router.currentRoute.path
|
options.originalPage = options.originalPage || this.$router.currentRoute.path
|
||||||
api('queryAsyncJobResult', { jobId }).then(json => {
|
api('queryAsyncJobResult', { jobId }).then(json => {
|
||||||
const result = json.queryasyncjobresultresponse
|
const result = json.queryasyncjobresultresponse
|
||||||
if (result.jobstatus === 1) {
|
if (result.jobstatus === 1) {
|
||||||
@ -92,7 +92,7 @@ export const pollJobPlugin = {
|
|||||||
|
|
||||||
// Ensure we refresh on the same / parent page
|
// Ensure we refresh on the same / parent page
|
||||||
const currentPage = this.$router.currentRoute.path
|
const currentPage = this.$router.currentRoute.path
|
||||||
const samePage = originalPage === currentPage || originalPage.startsWith(currentPage + '/')
|
const samePage = options.originalPage === currentPage || options.originalPage.startsWith(currentPage + '/')
|
||||||
if (samePage && (!action || !('isFetchData' in action) || (action.isFetchData))) {
|
if (samePage && (!action || !('isFetchData' in action) || (action.isFetchData))) {
|
||||||
eventBus.$emit('async-job-complete')
|
eventBus.$emit('async-job-complete')
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1177,19 +1177,18 @@ export default {
|
|||||||
message = message + ' - ' + this.$t(action.successMessage)
|
message = message + ' - ' + this.$t(action.successMessage)
|
||||||
duration = 5
|
duration = 5
|
||||||
}
|
}
|
||||||
this.$message.success({
|
break
|
||||||
content: message,
|
|
||||||
key: action.label + resourceName,
|
|
||||||
duration: duration
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
if (['addLdapConfiguration', 'deleteLdapConfiguration'].includes(action.api)) {
|
||||||
if (['addLdapConfiguration', 'deleteLdapConfiguration'].includes(action.api)) {
|
this.$store.dispatch('UpdateConfiguration')
|
||||||
this.$store.dispatch('UpdateConfiguration')
|
}
|
||||||
}
|
if (jobId) {
|
||||||
return false
|
return resolve(this.pollActionCompletion(jobId, action, resourceName, showLoading))
|
||||||
|
}
|
||||||
|
|
||||||
|
return resolve(false)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
execSubmit (e) {
|
execSubmit (e) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|||||||
@ -326,7 +326,7 @@ export default {
|
|||||||
params.dns1 = this.prefillContent.ipv4Dns1.value
|
params.dns1 = this.prefillContent.ipv4Dns1.value
|
||||||
params.dns2 = this.prefillContent.ipv4Dns2 ? this.prefillContent.ipv4Dns2.value : null
|
params.dns2 = this.prefillContent.ipv4Dns2 ? this.prefillContent.ipv4Dns2.value : null
|
||||||
params.ip6dns1 = this.prefillContent.ipv6Dns1 ? this.prefillContent.ipv6Dns1.value : null
|
params.ip6dns1 = this.prefillContent.ipv6Dns1 ? this.prefillContent.ipv6Dns1.value : null
|
||||||
params.ip6dns2 = this.prefillContent.ipv6Dns1 ? this.prefillContent.ipv6Dns1.value : null
|
params.ip6dns2 = this.prefillContent.ipv6Dns2 ? this.prefillContent.ipv6Dns2.value : null
|
||||||
params.internaldns1 = this.prefillContent.internalDns1 ? this.prefillContent.internalDns1.value : null
|
params.internaldns1 = this.prefillContent.internalDns1 ? this.prefillContent.internalDns1.value : null
|
||||||
params.internaldns2 = this.prefillContent.internalDns2 ? this.prefillContent.internalDns2.value : null
|
params.internaldns2 = this.prefillContent.internalDns2 ? this.prefillContent.internalDns2.value : null
|
||||||
params.domain = this.prefillContent.networkDomain ? this.prefillContent.networkDomain.value : null
|
params.domain = this.prefillContent.networkDomain ? this.prefillContent.networkDomain.value : null
|
||||||
|
|||||||
@ -36,9 +36,6 @@ const state = {
|
|||||||
store = common.createMockStore(state)
|
store = common.createMockStore(state)
|
||||||
i18n = common.createMockI18n('en', mockData.messages)
|
i18n = common.createMockI18n('en', mockData.messages)
|
||||||
|
|
||||||
const actions = {
|
|
||||||
AddAsyncJob: jest.fn((jobId) => {})
|
|
||||||
}
|
|
||||||
const spyConsole = {
|
const spyConsole = {
|
||||||
log: null,
|
log: null,
|
||||||
warn: null
|
warn: null
|
||||||
@ -2814,8 +2811,8 @@ describe('Views > AutogenView.vue', () => {
|
|||||||
}, 1000)
|
}, 1000)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('check pollActionCompletion() and action AddAsyncJob is called when api is called and response have jobId result', async (done) => {
|
it('check pollActionCompletion() is called when api is called and response have jobId result', async (done) => {
|
||||||
store = common.createMockStore(state, actions)
|
store = common.createMockStore(state)
|
||||||
wrapper = factory({
|
wrapper = factory({
|
||||||
store: store,
|
store: store,
|
||||||
data: {
|
data: {
|
||||||
@ -2851,14 +2848,13 @@ describe('Views > AutogenView.vue', () => {
|
|||||||
wrapper.vm.execSubmit(event)
|
wrapper.vm.execSubmit(event)
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
expect(actions.AddAsyncJob).toHaveBeenCalled()
|
|
||||||
expect(spyPollAction).toHaveBeenCalled()
|
expect(spyPollAction).toHaveBeenCalled()
|
||||||
|
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('check $notification when api is called and response have not jobId result', async (done) => {
|
it('check $message, fetchData() is called when api response have not jobId result', async (done) => {
|
||||||
wrapper = factory({
|
wrapper = factory({
|
||||||
data: {
|
data: {
|
||||||
showAction: true,
|
showAction: true,
|
||||||
@ -2888,6 +2884,7 @@ describe('Views > AutogenView.vue', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const spyFetchData = jest.spyOn(wrapper.vm, 'fetchData')
|
||||||
mockAxios.mockResolvedValue(mockData)
|
mockAxios.mockResolvedValue(mockData)
|
||||||
spyConsole.log = jest.spyOn(console, 'log').mockImplementation(() => {})
|
spyConsole.log = jest.spyOn(console, 'log').mockImplementation(() => {})
|
||||||
|
|
||||||
@ -2903,6 +2900,7 @@ describe('Views > AutogenView.vue', () => {
|
|||||||
key: 'labelnametest-name-value',
|
key: 'labelnametest-name-value',
|
||||||
duration: 2
|
duration: 2
|
||||||
})
|
})
|
||||||
|
expect(spyFetchData).toHaveBeenCalled()
|
||||||
|
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
|||||||
@ -25,9 +25,6 @@ jest.mock('axios', () => mockAxios)
|
|||||||
let wrapper, i18n, store, mocks, router
|
let wrapper, i18n, store, mocks, router
|
||||||
|
|
||||||
const state = {}
|
const state = {}
|
||||||
const actions = {
|
|
||||||
AddAsyncJob: jest.fn((jobObject) => {})
|
|
||||||
}
|
|
||||||
mocks = {
|
mocks = {
|
||||||
$message: {
|
$message: {
|
||||||
error: jest.fn((message) => {})
|
error: jest.fn((message) => {})
|
||||||
@ -56,7 +53,7 @@ mocks = {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
i18n = common.createMockI18n('en', mockData.messages)
|
i18n = common.createMockI18n('en', mockData.messages)
|
||||||
store = common.createMockStore(state, actions)
|
store = common.createMockStore(state)
|
||||||
|
|
||||||
const factory = (opts = {}) => {
|
const factory = (opts = {}) => {
|
||||||
i18n = opts.i18n || i18n
|
i18n = opts.i18n || i18n
|
||||||
@ -564,7 +561,6 @@ 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([])
|
||||||
|
|
||||||
@ -572,7 +568,7 @@ describe('Views > compute > MigrateWizard.vue', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('check store dispatch `AddAsyncJob` and $pollJob have successMethod() is called with requiresStorageMotion is false', async (done) => {
|
it('check $pollJob have successMethod() is called with requiresStorageMotion is false', async (done) => {
|
||||||
const mockData = {
|
const mockData = {
|
||||||
migratevirtualmachineresponse: {
|
migratevirtualmachineresponse: {
|
||||||
jobid: 'test-job-id-case-2'
|
jobid: 'test-job-id-case-2'
|
||||||
@ -670,7 +666,6 @@ 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([])
|
||||||
|
|
||||||
@ -678,7 +673,7 @@ describe('Views > compute > MigrateWizard.vue', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('check store dispatch `AddAsyncJob` and $pollJob have errorMethod() is called', async (done) => {
|
it('check $pollJob have errorMethod() is called', async (done) => {
|
||||||
const mockData = {
|
const mockData = {
|
||||||
migratesystemvmresponse: {
|
migratesystemvmresponse: {
|
||||||
jobid: 'test-job-id-case-3'
|
jobid: 'test-job-id-case-3'
|
||||||
@ -713,7 +708,6 @@ 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([])
|
||||||
|
|
||||||
@ -721,7 +715,7 @@ describe('Views > compute > MigrateWizard.vue', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('check store dispatch `AddAsyncJob` and $pollJob have catchMethod() is called', async (done) => {
|
it('check $pollJob have catchMethod() is called', async (done) => {
|
||||||
const mockData = {
|
const mockData = {
|
||||||
migratesystemvmresponse: {
|
migratesystemvmresponse: {
|
||||||
jobid: 'test-job-id-case-4'
|
jobid: 'test-job-id-case-4'
|
||||||
@ -750,7 +744,6 @@ 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([])
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user