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 = {}
|
||||
const arrAsync = []
|
||||
const actionBadge = this.actions.filter(action => action.showBadge === true)
|
||||
if ((actionBadge.dataView ? actionBadge.dataView : false) !== this.dataView) return
|
||||
|
||||
if (actionBadge && actionBadge.length > 0) {
|
||||
const dataLength = actionBadge.length
|
||||
|
||||
@ -66,7 +66,7 @@ export const pollJobPlugin = {
|
||||
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 => {
|
||||
const result = json.queryasyncjobresultresponse
|
||||
if (result.jobstatus === 1) {
|
||||
@ -92,7 +92,7 @@ export const pollJobPlugin = {
|
||||
|
||||
// Ensure we refresh on the same / parent page
|
||||
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))) {
|
||||
eventBus.$emit('async-job-complete')
|
||||
}
|
||||
|
||||
@ -1177,19 +1177,18 @@ export default {
|
||||
message = message + ' - ' + this.$t(action.successMessage)
|
||||
duration = 5
|
||||
}
|
||||
this.$message.success({
|
||||
content: message,
|
||||
key: action.label + resourceName,
|
||||
duration: duration
|
||||
})
|
||||
break
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
if (['addLdapConfiguration', 'deleteLdapConfiguration'].includes(action.api)) {
|
||||
this.$store.dispatch('UpdateConfiguration')
|
||||
}
|
||||
return 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) {
|
||||
e.preventDefault()
|
||||
|
||||
@ -326,7 +326,7 @@ export default {
|
||||
params.dns1 = this.prefillContent.ipv4Dns1.value
|
||||
params.dns2 = this.prefillContent.ipv4Dns2 ? this.prefillContent.ipv4Dns2.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.internaldns2 = this.prefillContent.internalDns2 ? this.prefillContent.internalDns2.value : null
|
||||
params.domain = this.prefillContent.networkDomain ? this.prefillContent.networkDomain.value : null
|
||||
|
||||
@ -33,4 +33,4 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,9 +36,6 @@ const state = {
|
||||
store = common.createMockStore(state)
|
||||
i18n = common.createMockI18n('en', mockData.messages)
|
||||
|
||||
const actions = {
|
||||
AddAsyncJob: jest.fn((jobId) => {})
|
||||
}
|
||||
const spyConsole = {
|
||||
log: null,
|
||||
warn: null
|
||||
@ -2814,8 +2811,8 @@ describe('Views > AutogenView.vue', () => {
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
it('check pollActionCompletion() and action AddAsyncJob is called when api is called and response have jobId result', async (done) => {
|
||||
store = common.createMockStore(state, actions)
|
||||
it('check pollActionCompletion() is called when api is called and response have jobId result', async (done) => {
|
||||
store = common.createMockStore(state)
|
||||
wrapper = factory({
|
||||
store: store,
|
||||
data: {
|
||||
@ -2851,14 +2848,13 @@ describe('Views > AutogenView.vue', () => {
|
||||
wrapper.vm.execSubmit(event)
|
||||
|
||||
setTimeout(() => {
|
||||
expect(actions.AddAsyncJob).toHaveBeenCalled()
|
||||
expect(spyPollAction).toHaveBeenCalled()
|
||||
|
||||
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({
|
||||
data: {
|
||||
showAction: true,
|
||||
@ -2888,6 +2884,7 @@ describe('Views > AutogenView.vue', () => {
|
||||
}
|
||||
}
|
||||
|
||||
const spyFetchData = jest.spyOn(wrapper.vm, 'fetchData')
|
||||
mockAxios.mockResolvedValue(mockData)
|
||||
spyConsole.log = jest.spyOn(console, 'log').mockImplementation(() => {})
|
||||
|
||||
@ -2903,6 +2900,7 @@ describe('Views > AutogenView.vue', () => {
|
||||
key: 'labelnametest-name-value',
|
||||
duration: 2
|
||||
})
|
||||
expect(spyFetchData).toHaveBeenCalled()
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
@ -25,9 +25,6 @@ jest.mock('axios', () => mockAxios)
|
||||
let wrapper, i18n, store, mocks, router
|
||||
|
||||
const state = {}
|
||||
const actions = {
|
||||
AddAsyncJob: jest.fn((jobObject) => {})
|
||||
}
|
||||
mocks = {
|
||||
$message: {
|
||||
error: jest.fn((message) => {})
|
||||
@ -56,7 +53,7 @@ mocks = {
|
||||
})
|
||||
}
|
||||
i18n = common.createMockI18n('en', mockData.messages)
|
||||
store = common.createMockStore(state, actions)
|
||||
store = common.createMockStore(state)
|
||||
|
||||
const factory = (opts = {}) => {
|
||||
i18n = opts.i18n || i18n
|
||||
@ -564,7 +561,6 @@ 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([])
|
||||
|
||||
@ -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 = {
|
||||
migratevirtualmachineresponse: {
|
||||
jobid: 'test-job-id-case-2'
|
||||
@ -670,7 +666,6 @@ 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([])
|
||||
|
||||
@ -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 = {
|
||||
migratesystemvmresponse: {
|
||||
jobid: 'test-job-id-case-3'
|
||||
@ -713,7 +708,6 @@ 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([])
|
||||
|
||||
@ -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 = {
|
||||
migratesystemvmresponse: {
|
||||
jobid: 'test-job-id-case-4'
|
||||
@ -750,7 +744,6 @@ 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([])
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user