Merge branch '4.15' into main

This commit is contained in:
davidjumani 2021-07-20 10:18:16 +05:30
commit 27d674df7d
62 changed files with 376 additions and 841 deletions

View File

@ -32,19 +32,19 @@
<a-button size="small" slot="description" @click="clearJobs">{{ $t('label.clear.list') }}</a-button>
</a-list-item-meta>
</a-list-item>
<a-list-item v-for="(job, index) in jobs" :key="index">
<a-list-item-meta :title="job.title">
<a-avatar :style="notificationAvatar[job.status].style" :icon="notificationAvatar[job.status].icon" slot="avatar"/><br/>
<span v-if="getResourceName(job.description, 'name') && job.path" slot="description"><router-link :to="{ path: job.path}"> {{ getResourceName(job.description, "name") + ' - ' }}</router-link></span>
<span v-if="getResourceName(job.description, 'name') && job.path" slot="description"> {{ getResourceName(job.description, "msg") }}</span>
<span v-else slot="description"> {{ job.description }} </span>
<a-list-item v-for="(notice, index) in notices" :key="index">
<a-list-item-meta :title="notice.title" :description="notice.description">
<a-avatar :style="notificationAvatar[notice.status].style" :icon="notificationAvatar[notice.status].icon" slot="avatar"/>
<span v-if="getResourceName(notice.description, 'name') && notice.path" slot="description"><router-link :to="{ path: notice.path}"> {{ getResourceName(notice.description, "name") + ' - ' }}</router-link></span>
<span v-if="getResourceName(notice.description, 'name') && notice.path" slot="description"> {{ getResourceName(notice.description, "msg") }}</span>
<span v-else slot="description"> {{ notice.description }} </span>
</a-list-item-meta>
</a-list-item>
</a-list>
</a-spin>
</template>
<span @click="showNotifications" class="header-notice-opener">
<a-badge :count="jobs.length">
<a-badge :count="notices.length">
<a-icon class="header-notice-icon" type="bell" />
</a-badge>
</span>
@ -52,7 +52,6 @@
</template>
<script>
import { api } from '@/api'
import store from '@/store'
export default {
@ -61,7 +60,7 @@ export default {
return {
loading: false,
visible: false,
jobs: [],
notices: [],
poller: null,
notificationAvatar: {
done: { icon: 'check-circle', style: 'backgroundColor:#87d068' },
@ -75,13 +74,8 @@ export default {
this.visible = !this.visible
},
clearJobs () {
this.jobs = this.jobs.filter(x => x.status === 'progress')
this.$store.commit('SET_ASYNC_JOB_IDS', this.jobs)
},
startPolling () {
this.poller = setInterval(() => {
this.pollJobs()
}, 4000)
this.notices = this.notices.filter(x => x.status === 'progress')
this.$store.commit('SET_HEADER_NOTICES', this.notices)
},
getResourceName (description, data) {
if (description) {
@ -92,61 +86,15 @@ export default {
const msg = description.substring(description.indexOf(')') + 1)
return msg
}
},
async pollJobs () {
var hasUpdated = false
for (var i in this.jobs) {
if (this.jobs[i].status === 'progress') {
await api('queryAsyncJobResult', { jobid: this.jobs[i].jobid }).then(json => {
var result = json.queryasyncjobresultresponse
if (result.jobstatus === 1 && this.jobs[i].status !== 'done') {
hasUpdated = true
const title = this.jobs[i].title
const description = this.jobs[i].description
this.$message.success({
content: title + (description ? ' - ' + description : ''),
key: this.jobs[i].jobid,
duration: 2
})
this.jobs[i].status = 'done'
} else if (result.jobstatus === 2 && this.jobs[i].status !== 'failed') {
hasUpdated = true
this.jobs[i].status = 'failed'
if (result.jobresult.errortext !== null) {
this.jobs[i].description = '(' + this.jobs[i].description + ') ' + result.jobresult.errortext
}
if (!this.jobs[i].bulkAction) {
this.$notification.error({
message: this.jobs[i].title,
description: this.jobs[i].description,
key: this.jobs[i].jobid,
duration: 0
})
}
}
}).catch(function (e) {
console.log(this.$t('error.fetching.async.job.result') + e)
})
}
}
if (hasUpdated) {
this.$store.commit('SET_ASYNC_JOB_IDS', this.jobs.reverse())
}
}
},
beforeDestroy () {
clearInterval(this.poller)
},
created () {
this.startPolling()
},
mounted () {
this.jobs = (store.getters.asyncJobIds || []).reverse()
this.notices = (store.getters.headerNotices || []).reverse()
this.$store.watch(
(state, getters) => getters.asyncJobIds,
(state, getters) => getters.headerNotices,
(newValue, oldValue) => {
if (oldValue !== newValue && newValue !== undefined) {
this.jobs = newValue.reverse()
this.notices = newValue.reverse()
}
}
)

View File

@ -145,6 +145,7 @@ 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

View File

@ -175,20 +175,13 @@ export default {
}).then(response => {
this.$pollJob({
jobId: response.releasededicatedzoneresponse.jobid,
title: this.$t('label.release.dedicated.zone'),
description: this.resource.id,
successMessage: this.$t('message.dedicated.zone.released'),
successMethod: () => {
this.parentFetchData()
this.dedicatedDomainId = null
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.dedicated.zone.released'),
jobid: response.releasededicatedzoneresponse.jobid,
status: 'progress'
})
},
errorMessage: this.$t('error.release.dedicate.zone'),
errorMethod: () => {
this.parentFetchData()
},
loadingMessage: this.$t('message.releasing.dedicated.zone'),
catchMessage: this.$t('error.fetching.async.job.result'),
catchMethod: () => {
@ -205,20 +198,13 @@ export default {
}).then(response => {
this.$pollJob({
jobId: response.releasededicatedpodresponse.jobid,
title: this.$t('label.release.dedicated.pod'),
description: this.resource.id,
successMessage: this.$t('message.pod.dedication.released'),
successMethod: () => {
this.parentFetchData()
this.dedicatedDomainId = null
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.pod.dedication.released'),
jobid: response.releasededicatedpodresponse.jobid,
status: 'progress'
})
},
errorMessage: this.$t('error.release.dedicate.pod'),
errorMethod: () => {
this.parentFetchData()
},
loadingMessage: this.$t('message.releasing.dedicated.pod'),
catchMessage: this.$t('error.fetching.async.job.result'),
catchMethod: () => {
@ -235,20 +221,13 @@ export default {
}).then(response => {
this.$pollJob({
jobId: response.releasededicatedclusterresponse.jobid,
title: this.$t('label.release.dedicated.cluster'),
description: this.resource.id,
successMessage: this.$t('message.cluster.dedication.released'),
successMethod: () => {
this.parentFetchData()
this.dedicatedDomainId = null
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.cluster.dedication.released'),
jobid: response.releasededicatedclusterresponse.jobid,
status: 'progress'
})
},
errorMessage: this.$t('error.release.dedicate.cluster'),
errorMethod: () => {
this.parentFetchData()
},
loadingMessage: this.$t('message.releasing.dedicated.cluster'),
catchMessage: this.$t('error.fetching.async.job.result'),
catchMethod: () => {
@ -265,20 +244,13 @@ export default {
}).then(response => {
this.$pollJob({
jobId: response.releasededicatedhostresponse.jobid,
title: this.$t('label.release.dedicated.host'),
description: this.resource.id,
successMessage: this.$t('message.host.dedication.released'),
successMethod: () => {
this.parentFetchData()
this.dedicatedDomainId = null
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.host.dedication.released'),
jobid: response.releasededicatedhostresponse.jobid,
status: 'progress'
})
},
errorMessage: this.$t('error.release.dedicate.host'),
errorMethod: () => {
this.parentFetchData()
},
loadingMessage: this.$t('message.releasing.dedicated.host'),
catchMessage: this.$t('error.fetching.async.job.result'),
catchMethod: () => {

View File

@ -93,22 +93,16 @@ export default {
}).then(response => {
this.$pollJob({
jobId: response.dedicatezoneresponse.jobid,
successMessage: this.$t('label.zone.dedicated'),
title: this.$t('label.dedicate.zone'),
description: `${this.$t('label.domain.id')} : ${this.domainId}`,
successMessage: `${this.$t('label.zone.dedicated')}`,
successMethod: () => {
this.parentFetchData()
this.fetchParentData()
this.dedicatedDomainId = this.domainId
this.dedicatedDomainModal = false
this.$store.dispatch('AddAsyncJob', {
title: this.$t('label.zone.dedicated'),
jobid: response.dedicatezoneresponse.jobid,
description: `${this.$t('label.domain.id')} : ${this.dedicatedDomainId}`,
status: 'progress'
})
},
errorMessage: this.$t('error.dedicate.zone.failed'),
errorMethod: () => {
this.parentFetchData()
this.fetchParentData()
this.dedicatedDomainModal = false
},
@ -137,22 +131,16 @@ export default {
}).then(response => {
this.$pollJob({
jobId: response.dedicatepodresponse.jobid,
title: this.$t('label.dedicate.pod'),
description: `${this.$t('label.domain.id')} : ${this.domainId}`,
successMessage: this.$t('label.pod.dedicated'),
successMethod: () => {
this.parentFetchData()
this.fetchParentData()
this.dedicatedDomainId = this.domainId
this.dedicatedDomainModal = false
this.$store.dispatch('AddAsyncJob', {
title: this.$t('label.pod.dedicated'),
jobid: response.dedicatepodresponse.jobid,
description: `${this.$t('label.domainid')}: ${this.dedicatedDomainId}`,
status: 'progress'
})
},
errorMessage: this.$t('error.dedicate.pod.failed'),
errorMethod: () => {
this.parentFetchData()
this.fetchParentData()
this.dedicatedDomainModal = false
},
@ -181,22 +169,16 @@ export default {
}).then(response => {
this.$pollJob({
jobId: response.dedicateclusterresponse.jobid,
title: this.$t('label.dedicate.cluster'),
description: `${this.$t('label.domain.id')} : ${this.domainId}`,
successMessage: this.$t('message.cluster.dedicated'),
successMethod: () => {
this.parentFetchData()
this.fetchParentData()
this.dedicatedDomainId = this.domainId
this.dedicatedDomainModal = false
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.cluster.dedicated'),
jobid: response.dedicateclusterresponse.jobid,
description: `${this.$t('label.domainid')}: ${this.dedicatedDomainId}`,
status: 'progress'
})
},
errorMessage: this.$t('error.dedicate.cluster.failed'),
errorMethod: () => {
this.parentFetchData()
this.fetchParentData()
this.dedicatedDomainModal = false
},
@ -225,22 +207,16 @@ export default {
}).then(response => {
this.$pollJob({
jobId: response.dedicatehostresponse.jobid,
title: this.$t('label.dedicate.host'),
description: `${this.$t('label.domain.id')} : ${this.domainId}`,
successMessage: this.$t('message.host.dedicated'),
successMethod: () => {
this.parentFetchData()
this.fetchParentData()
this.dedicatedDomainId = this.domainId
this.dedicatedDomainModal = false
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.host.dedicated'),
jobid: response.dedicatehostresponse.jobid,
description: `${this.$t('label.domainid')}: ${this.dedicatedDomainId}`,
status: 'progress'
})
},
errorMessage: this.$t('error.dedicate.host.failed'),
errorMethod: () => {
this.parentFetchData()
this.fetchParentData()
this.dedicatedDomainModal = false
},

View File

@ -31,7 +31,7 @@ import {
DEFAULT_FIXED_SIDEMENU,
DEFAULT_CONTENT_WIDTH_TYPE,
DEFAULT_MULTI_TAB,
ASYNC_JOB_IDS
HEADER_NOTICES
} from '@/store/mutation-types'
export default function Initializer () {
@ -47,5 +47,5 @@ export default function Initializer () {
store.commit('TOGGLE_MULTI_TAB', Vue.ls.get(DEFAULT_MULTI_TAB, config.multiTab))
store.commit('SET_TOKEN', Vue.ls.get(ACCESS_TOKEN))
store.commit('SET_PROJECT', Vue.ls.get(CURRENT_PROJECT))
store.commit('SET_ASYNC_JOB_IDS', Vue.ls.get(ASYNC_JOB_IDS) || [])
store.commit('SET_HEADER_NOTICES', Vue.ls.get(HEADER_NOTICES) || [])
}

View File

@ -30,7 +30,7 @@ const getters = {
userInfo: state => state.user.info,
addRouters: state => state.permission.addRouters,
multiTab: state => state.app.multiTab,
asyncJobIds: state => state.user.asyncJobIds,
headerNotices: state => state.user.headerNotices,
isLdapEnabled: state => state.user.isLdapEnabled,
cloudian: state => state.user.cloudian,
zones: state => state.user.zones,

View File

@ -32,7 +32,7 @@ import {
ZONES,
TIMEZONE_OFFSET,
USE_BROWSER_TIMEZONE,
ASYNC_JOB_IDS,
HEADER_NOTICES,
DOMAIN_STORE
} from '@/store/mutation-types'
@ -45,7 +45,7 @@ const user = {
apis: {},
features: {},
project: {},
asyncJobIds: [],
headerNotices: [],
isLdapEnabled: false,
cloudian: {},
zones: {},
@ -86,9 +86,9 @@ const user = {
SET_FEATURES: (state, features) => {
state.features = features
},
SET_ASYNC_JOB_IDS: (state, jobsJsonArray) => {
Vue.ls.set(ASYNC_JOB_IDS, jobsJsonArray)
state.asyncJobIds = jobsJsonArray
SET_HEADER_NOTICES: (state, noticeJsonArray) => {
Vue.ls.set(HEADER_NOTICES, noticeJsonArray)
state.headerNotices = noticeJsonArray
},
SET_LDAP: (state, isLdapEnabled) => {
state.isLdapEnabled = isLdapEnabled
@ -137,7 +137,7 @@ const user = {
commit('SET_AVATAR', '')
commit('SET_INFO', {})
commit('SET_PROJECT', {})
commit('SET_ASYNC_JOB_IDS', [])
commit('SET_HEADER_NOTICES', [])
commit('SET_FEATURES', {})
commit('SET_LDAP', {})
commit('SET_CLOUDIAN', {})
@ -264,7 +264,7 @@ const user = {
commit('SET_TOKEN', '')
commit('SET_APIS', {})
commit('SET_PROJECT', {})
commit('SET_ASYNC_JOB_IDS', [])
commit('SET_HEADER_NOTICES', [])
commit('SET_FEATURES', {})
commit('SET_LDAP', {})
commit('SET_CLOUDIAN', {})
@ -272,7 +272,7 @@ const user = {
commit('SET_DOMAIN_STORE', {})
Vue.ls.remove(CURRENT_PROJECT)
Vue.ls.remove(ACCESS_TOKEN)
Vue.ls.remove(ASYNC_JOB_IDS)
Vue.ls.remove(HEADER_NOTICES)
logout(state.token).then(() => {
message.destroy()
@ -286,10 +286,19 @@ const user = {
})
})
},
AddAsyncJob ({ commit }, jobJson) {
var jobsArray = Vue.ls.get(ASYNC_JOB_IDS, [])
jobsArray.push(jobJson)
commit('SET_ASYNC_JOB_IDS', jobsArray)
AddHeaderNotice ({ commit }, noticeJson) {
if (!noticeJson || !noticeJson.title) {
return
}
const noticeArray = Vue.ls.get(HEADER_NOTICES, [])
const noticeIdx = noticeArray.findIndex(notice => notice.key === noticeJson.key)
if (noticeIdx === -1) {
noticeArray.push(noticeJson)
} else {
noticeArray[noticeIdx] = noticeJson
}
commit('SET_HEADER_NOTICES', noticeArray)
},
ProjectView ({ commit }, projectid) {
return new Promise((resolve, reject) => {

View File

@ -29,7 +29,7 @@ export const DEFAULT_CONTENT_WIDTH_TYPE = 'DEFAULT_CONTENT_WIDTH_TYPE'
export const DEFAULT_MULTI_TAB = 'DEFAULT_MULTI_TAB'
export const APIS = 'APIS'
export const ZONES = 'ZONES'
export const ASYNC_JOB_IDS = 'ASYNC_JOB_IDS'
export const HEADER_NOTICES = 'HEADER_NOTICES'
export const TIMEZONE_OFFSET = 'TIMEZONE_OFFSET'
export const USE_BROWSER_TIMEZONE = 'USE_BROWSER_TIMEZONE'
export const DOMAIN_STORE = 'DOMAIN_STORE'

View File

@ -20,6 +20,7 @@ import { i18n } from '@/locales'
import { api } from '@/api'
import { message, notification } from 'ant-design-vue'
import eventBus from '@/config/eventBus'
import store from '@/store'
export const pollJobPlugin = {
install (Vue) {
@ -27,6 +28,8 @@ export const pollJobPlugin = {
/**
* @param {String} jobId
* @param {String} [name='']
* @param {String} [title='']
* @param {String} [description='']
* @param {String} [successMessage=Success]
* @param {Function} [successMethod=() => {}]
* @param {String} [errorMessage=Error]
@ -41,6 +44,8 @@ export const pollJobPlugin = {
const {
jobId,
name = '',
title = '',
description = '',
successMessage = i18n.t('label.success'),
successMethod = () => {},
errorMessage = i18n.t('label.error'),
@ -53,6 +58,13 @@ export const pollJobPlugin = {
bulkAction = false
} = options
store.dispatch('AddHeaderNotice', {
key: jobId,
title: title,
description: description,
status: 'progress'
})
api('queryAsyncJobResult', { jobId }).then(json => {
const result = json.queryasyncjobresultresponse
if (result.jobstatus === 1) {
@ -68,7 +80,16 @@ export const pollJobPlugin = {
key: jobId,
duration: 2
})
eventBus.$emit('async-job-complete', action)
store.dispatch('AddHeaderNotice', {
key: jobId,
title: title,
description: description,
status: 'done',
duration: 2
})
if (!action || !('isFetchData' in action) || (action.isFetchData)) {
eventBus.$emit('async-job-complete', action)
}
successMethod(result)
} else if (result.jobstatus === 2) {
if (!bulkAction) {
@ -94,7 +115,9 @@ export const pollJobPlugin = {
duration: 0
})
}
eventBus.$emit('async-job-complete', action)
if (!action || !('isFetchData' in action) || (action.isFetchData)) {
eventBus.$emit('async-job-complete', action)
}
errorMethod(result)
} else if (result.jobstatus === 0) {
if (showLoading) {
@ -116,7 +139,6 @@ export const pollJobPlugin = {
duration: 0
})
catchMethod && catchMethod()
// }
})
}
}

View File

@ -444,12 +444,18 @@ export default {
formModel: {},
confirmDirty: false,
firstIndex: 0,
modalWidth: '30vw'
modalWidth: '30vw',
promises: []
}
},
beforeCreate () {
this.form = this.$form.createForm(this)
},
beforeDestroy () {
eventBus.$off('vm-refresh-data')
eventBus.$off('async-job-complete')
eventBus.$off('exec-action')
},
created () {
eventBus.$on('vm-refresh-data', () => {
if (this.$route.path === '/vm' || this.$route.path.includes('/vm/')) {
@ -478,7 +484,7 @@ export default {
})
eventBus.$on('update-bulk-job-status', (items, action) => {
for (const item of items) {
this.$store.getters.asyncJobIds.map(function (j) {
this.$store.getters.headerNotices.map(function (j) {
if (j.jobid === item.jobid) {
j.bulkAction = action
}
@ -488,7 +494,7 @@ export default {
eventBus.$on('update-job-details', (jobId, resourceId) => {
const fullPath = this.$route.fullPath
const path = this.$route.path
var jobs = this.$store.getters.asyncJobIds.map(job => {
var jobs = this.$store.getters.headerNotices.map(job => {
if (job.jobid === jobId) {
if (resourceId && !path.includes(resourceId)) {
job.path = path + '/' + resourceId
@ -498,8 +504,7 @@ export default {
}
return job
})
this.$store.commit('SET_ASYNC_JOB_IDS', jobs)
this.$store.commit('SET_HEADER_NOTICES', jobs)
})
eventBus.$on('update-resource-state', (selectedItems, resource, state, jobid) => {
@ -1010,39 +1015,40 @@ export default {
},
pollActionCompletion (jobId, action, resourceName, resource, showLoading = true) {
eventBus.$emit('update-job-details', jobId, resource)
this.$pollJob({
jobId,
name: resourceName,
successMethod: result => {
this.fetchData()
if (this.selectedItems.length > 0) {
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'success')
}
if (action.response) {
const description = action.response(result.jobresult)
if (description) {
this.$notification.info({
message: this.$t(action.label),
description: (<span domPropsInnerHTML={description}></span>),
duration: 0
})
return new Promise((resolve) => {
this.$pollJob({
jobId,
title: this.$t(action.label),
description: resourceName,
name: resourceName,
successMethod: result => {
if (this.selectedItems.length > 0) {
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'success')
}
}
if ('successMethod' in action) {
action.successMethod(this, result)
}
},
errorMethod: () => {
this.fetchData()
if (this.selectedItems.length > 0) {
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'failed')
}
},
loadingMessage: `${this.$t(action.label)} - ${resourceName}`,
showLoading: showLoading,
catchMessage: this.$t('error.fetching.async.job.result'),
action,
bulkAction: `${this.selectedItems.length > 0}` && this.showGroupActionModal
if (action.response) {
const description = action.response(result.jobresult)
if (description) {
this.$notification.info({
message: this.$t(action.label),
description: (<span domPropsInnerHTML={description}></span>),
duration: 0
})
}
}
resolve(true)
},
errorMethod: () => {
if (this.selectedItems.length > 0) {
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'failed')
}
resolve(true)
},
loadingMessage: `${this.$t(action.label)} - ${resourceName}`,
showLoading: showLoading,
catchMessage: this.$t('error.fetching.async.job.result'),
action,
bulkAction: `${this.selectedItems.length > 0}` && this.showGroupActionModal
})
})
},
fillEditFormFieldValues () {
@ -1071,6 +1077,7 @@ export default {
this.message = {}
},
handleSubmit (e) {
this.promises = []
if (!this.dataView && this.currentAction.groupAction && this.selectedRowKeys.length > 0) {
if (this.selectedRowKeys.length > 0) {
this.selectedColumns = this.chosenColumns
@ -1100,18 +1107,17 @@ export default {
for (const params of paramsList) {
var resourceName = itemsNameMap[params.id || params.vmsnapshotid || params.username || params.name]
// Using a method for this since it's an async call and don't want wrong prarms to be passed
this.callGroupApi(params, resourceName)
this.promises.push(this.callGroupApi(params, resourceName))
}
this.$message.info({
content: this.$t(this.currentAction.label),
key: this.currentAction.label,
duration: 3
})
setTimeout(() => {
Promise.all(this.promises).finally(() => {
this.actionLoading = false
this.closeAction()
this.fetchData()
}, 500)
})
}
})
} else {
@ -1119,17 +1125,20 @@ export default {
}
},
callGroupApi (params, resourceName) {
const action = this.currentAction
api(action.api, params).then(json => {
this.handleResponse(json, resourceName, this.getDataIdentifier(params), action, false)
}).catch(error => {
if ([401].includes(error.response.status)) {
return
}
if (this.selectedItems.length !== 0) {
this.$notifyError(error)
eventBus.$emit('update-resource-state', this.selectedItems, this.getDataIdentifier(params), 'failed')
}
return new Promise((resolve, reject) => {
const action = this.currentAction
api(action.api, params).then(json => {
resolve(this.handleResponse(json, resourceName, this.getDataIdentifier(params), action, false))
this.closeAction()
}).catch(error => {
if ([401].includes(error.response.status)) {
return
}
if (this.selectedItems.length !== 0) {
this.$notifyError(error)
eventBus.$emit('update-resource-state', this.selectedItems, this.getDataIdentifier(params), 'failed')
}
})
})
},
getDataIdentifier (params) {
@ -1141,17 +1150,11 @@ export default {
for (const obj in response) {
if (obj.includes('response')) {
if (response[obj].jobid) {
const jobid = response[obj].jobid
this.$store.dispatch('AddAsyncJob', {
title: this.$t(action.label),
jobid: jobid,
description: resourceName,
status: 'progress',
bulkAction: this.selectedItems.length > 0 && this.showGroupActionModal
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))
})
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'InProgress', jobid)
this.pollActionCompletion(jobid, action, resourceName, resource, showLoading)
return true
} else {
if (this.selectedItems.length > 0) {
eventBus.$emit('update-resource-state', this.selectedItems, resource, 'success')
@ -1253,14 +1256,16 @@ export default {
args = [action.api, params]
}
api(...args).then(json => {
hasJobId = this.handleResponse(json, resourceName, this.getDataIdentifier(params), action)
if ((action.icon === 'delete' || ['archiveEvents', 'archiveAlerts', 'unmanageVirtualMachine'].includes(action.api)) && this.dataView) {
this.$router.go(-1)
} else {
if (!hasJobId) {
this.fetchData()
this.handleResponse(json, resourceName, this.getDataIdentifier(params), action).then(jobId => {
hasJobId = jobId
if ((action.icon === 'delete' || ['archiveEvents', 'archiveAlerts', 'unmanageVirtualMachine'].includes(action.api)) && this.dataView) {
this.$router.go(-1)
} else {
if (!hasJobId) {
this.fetchData()
}
}
}
})
this.closeAction()
}).catch(error => {
if ([401].includes(error.response.status)) {

View File

@ -56,7 +56,6 @@ export default {
required: true
}
},
inject: ['parentFetchData'],
data () {
return {
loading: false,
@ -131,14 +130,8 @@ export default {
if (jobId) {
this.$pollJob({
jobId,
successMethod: result => {
this.$store.dispatch('AddAsyncJob', {
title: title,
jobid: jobId,
status: this.$t('progress')
})
this.parentFetchData()
},
title: title,
description: values.id,
successMessage: `${this.$t('label.action.attach.iso')} ${this.$t('label.success')}`,
loadingMessage: `${title} ${this.$t('label.in.progress')}`,
catchMessage: this.$t('error.fetching.async.job.result')

View File

@ -460,23 +460,15 @@ export default {
api('createKubernetesCluster', params).then(json => {
const jobId = json.createkubernetesclusterresponse.jobid
this.$store.dispatch('AddAsyncJob', {
title: this.$t('label.kubernetes.cluster.create'),
jobid: jobId,
description: values.name,
status: 'progress'
})
this.$pollJob({
jobId,
title: this.$t('label.kubernetes.cluster.create'),
description: values.name,
loadingMessage: `${this.$t('label.kubernetes.cluster.create')} ${values.name} ${this.$t('label.in.progress')}`,
catchMessage: this.$t('error.fetching.async.job.result'),
successMessage: this.$t('message.success.create.kubernetes.cluter') + ' ' + values.name,
successMethod: result => {
this.$emit('refresh-data')
}
successMessage: this.$t('message.success.create.kubernetes.cluter') + ' ' + values.name
})
this.closeAction()
this.$emit('refresh-data')
}).catch(error => {
this.$notifyError(error)
}).finally(() => {

View File

@ -130,6 +130,8 @@ export default {
if (jobId) {
this.$pollJob({
jobId,
title: title,
description: description,
successMethod: result => {
const volumeId = result.jobresult.snapshot.volumeid
const snapshotId = result.jobresult.snapshot.id
@ -142,12 +144,6 @@ export default {
loadingMessage: `${title} ${this.$t('label.in.progress')}`,
catchMessage: this.$t('error.fetching.async.job.result')
})
this.$store.dispatch('AddAsyncJob', {
title: title,
jobid: jobId,
description: description,
status: 'progress'
})
}
}).catch(error => {
this.$notifyError(error)

View File

@ -1638,6 +1638,8 @@ export default {
if (jobId) {
this.$pollJob({
jobId,
title: title,
description: description,
successMethod: result => {
const vm = result.jobresult.virtualmachine
const name = vm.displayname || vm.name || vm.id
@ -1648,23 +1650,16 @@ export default {
duration: 0
})
}
eventBus.$emit('vm-refresh-data')
},
errorMethod: () => {
eventBus.$emit('vm-refresh-data')
},
loadingMessage: `${title} ${this.$t('label.in.progress')}`,
catchMessage: this.$t('error.fetching.async.job.result'),
catchMethod: () => {
eventBus.$emit('vm-refresh-data')
},
action: {
isFetchData: false
}
})
this.$store.dispatch('AddAsyncJob', {
title: title,
jobid: jobId,
description: description,
status: 'progress'
})
}
// Sending a refresh in case it hasn't picked up the new VM
new Promise(resolve => setTimeout(resolve, 3000)).then(() => {

View File

@ -116,14 +116,10 @@ export default {
api('destroyVirtualMachine', params).then(json => {
const jobId = json.destroyvirtualmachineresponse.jobid
this.$store.dispatch('AddAsyncJob', {
title: this.$t('label.action.destroy.instance'),
jobid: jobId,
description: this.resource.name,
status: 'progress'
})
this.$pollJob({
jobId,
title: this.$t('label.action.destroy.instance'),
description: this.resource.name,
loadingMessage: `${this.$t('message.deleting.vm')} ${this.resource.name}`,
catchMessage: this.$t('error.fetching.async.job.result'),
successMessage: `${this.$t('message.success.delete.vm')} ${this.resource.name}`,
@ -135,7 +131,7 @@ export default {
}
},
action: {
api: 'destroyVirtualMachine'
isFetchData: false
}
})
this.closeAction()

View File

@ -477,13 +477,11 @@ export default {
successMethod: () => {
this.loadingNic = false
this.closeModals()
this.parentFetchData()
},
errorMessage: this.$t('message.add.network.failed'),
errorMethod: () => {
this.loadingNic = false
this.closeModals()
this.parentFetchData()
},
loadingMessage: this.$t('message.add.network.processing'),
catchMessage: this.$t('error.fetching.async.job.result'),
@ -509,12 +507,10 @@ export default {
successMessage: `${this.$t('label.success.set')} ${item.networkname} ${this.$t('label.as.default')}. ${this.$t('message.set.default.nic.manual')}.`,
successMethod: () => {
this.loadingNic = false
this.parentFetchData()
},
errorMessage: `${this.$t('label.error.setting')} ${item.networkname} ${this.$t('label.as.default')}`,
errorMethod: () => {
this.loadingNic = false
this.parentFetchData()
},
loadingMessage: `${this.$t('label.setting')} ${item.networkname} ${this.$t('label.as.default')}...`,
catchMessage: this.$t('error.fetching.async.job.result'),
@ -541,13 +537,11 @@ export default {
successMethod: () => {
this.loadingNic = false
this.closeModals()
this.parentFetchData()
},
errorMessage: this.$t('label.error'),
errorMethod: () => {
this.loadingNic = false
this.closeModals()
this.parentFetchData()
},
loadingMessage: this.$t('message.update.ipaddress.processing'),
catchMessage: this.$t('error.fetching.async.job.result'),
@ -575,12 +569,10 @@ export default {
successMessage: this.$t('message.success.remove.nic'),
successMethod: () => {
this.loadingNic = false
this.parentFetchData()
},
errorMessage: this.$t('message.error.remove.nic'),
errorMethod: () => {
this.loadingNic = false
this.parentFetchData()
},
loadingMessage: this.$t('message.remove.nic.processing'),
catchMessage: this.$t('error.fetching.async.job.result'),
@ -611,13 +603,11 @@ export default {
successMethod: () => {
this.loadingNic = false
this.fetchSecondaryIPs(this.selectedNicId)
this.parentFetchData()
},
errorMessage: this.$t('message.error.add.secondary.ipaddress'),
errorMethod: () => {
this.loadingNic = false
this.fetchSecondaryIPs(this.selectedNicId)
this.parentFetchData()
},
loadingMessage: this.$t('message.add.secondary.ipaddress.processing'),
catchMessage: this.$t('error.fetching.async.job.result'),
@ -646,13 +636,11 @@ export default {
this.loadingNic = false
this.fetchSecondaryIPs(this.selectedNicId)
this.fetchPublicIps(this.editNetworkId)
this.parentFetchData()
},
errorMessage: this.$t('message.error.remove.secondary.ipaddress'),
errorMethod: () => {
this.loadingNic = false
this.fetchSecondaryIPs(this.selectedNicId)
this.parentFetchData()
},
loadingMessage: this.$t('message.remove.secondary.ipaddress.processing'),
catchMessage: this.$t('error.fetching.async.job.result'),

View File

@ -189,17 +189,11 @@ export default {
hostid: this.selectedHost.id,
virtualmachineid: this.resource.id
}).then(response => {
var migrateResponse = isUserVm
? this.selectedHost.requiresStorageMotion ? response.migratevirtualmachinewithvolumeresponse : response.migratevirtualmachineresponse
: response.migratesystemvmresponse
this.$store.dispatch('AddAsyncJob', {
title: `${this.$t('label.migrating')} ${this.resource.name}`,
jobid: migrateResponse.jobid,
description: this.resource.name,
status: 'progress'
})
const jobid = this.selectedHost.requiresStorageMotion ? response.migratevirtualmachinewithvolumeresponse.jobid : response.migratevirtualmachineresponse.jobid
this.$pollJob({
jobId: migrateResponse.jobid,
jobId: jobid,
title: `${this.$t('label.migrating')} ${this.resource.name}`,
description: this.resource.name,
successMessage: `${this.$t('message.success.migrating')} ${this.resource.name}`,
successMethod: () => {
this.$emit('close-action')

View File

@ -176,23 +176,15 @@ export default {
}
api('scaleKubernetesCluster', params).then(json => {
const jobId = json.scalekubernetesclusterresponse.jobid
this.$store.dispatch('AddAsyncJob', {
title: this.$t('label.kubernetes.cluster.scale'),
jobid: jobId,
description: this.resource.name,
status: 'progress'
})
this.$pollJob({
jobId,
title: this.$t('label.kubernetes.cluster.scale'),
description: this.resource.name,
loadingMessage: `${this.$t('label.kubernetes.cluster.scale')} ${this.resource.name} ${this.$t('label.in.progress')}`,
catchMessage: this.$t('error.fetching.async.job.result'),
successMessage: `${this.$t('message.success.scale.kubernetes')} ${this.resource.name}`,
successMethod: result => {
this.$emit('refresh-data')
}
successMessage: `${this.$t('message.success.scale.kubernetes')} ${this.resource.name}`
})
this.closeAction()
this.$emit('refresh-data')
}).catch(error => {
this.$notifyError(error)
}).finally(() => {

View File

@ -125,7 +125,6 @@ export default {
loading: false
}
},
inject: ['parentFetchData'],
beforeCreate () {
this.form = this.$form.createForm(this)
this.apiParams = this.$getApiParams('startVirtualMachine')
@ -223,20 +222,13 @@ export default {
}
api('startVirtualMachine', params).then(json => {
const jobId = json.startvirtualmachineresponse.jobid
this.$store.dispatch('AddAsyncJob', {
title: this.$t('label.action.start.instance'),
jobid: jobId,
description: this.resource.name,
status: 'progress'
})
this.$pollJob({
jobId,
title: this.$t('label.action.start.instance'),
description: this.resource.name,
loadingMessage: `${this.$t('label.action.start.instance')} ${this.resource.name}`,
catchMessage: this.$t('error.fetching.async.job.result'),
successMessage: `${this.$t('label.action.start.instance')} ${this.resource.name}`,
successMethod: () => {
this.parentFetchData()
},
response: (result) => { return result.virtualmachine && result.virtualmachine.password ? `The password of VM <b>${result.virtualmachine.displayname}</b> is <b>${result.virtualmachine.password}</b>` : null }
})
const resourceId = this.resource.id

View File

@ -153,22 +153,14 @@ export default {
api('upgradeKubernetesCluster', params).then(json => {
this.$emit('refresh-data')
const jobId = json.upgradekubernetesclusterresponse.jobid
this.$store.dispatch('AddAsyncJob', {
title: this.$t('label.kubernetes.cluster.upgrade'),
jobid: jobId,
description: this.resource.name,
status: 'progress'
})
this.$pollJob({
jobId,
title: this.$t('label.kubernetes.cluster.upgrade'),
description: this.resource.name,
loadingMessage: `${this.$t('label.kubernetes.cluster.upgrade')} ${this.resource.name} ${this.$t('label.in.progress')}`,
catchMessage: this.$t('error.fetching.async.job.result'),
successMessage: `${this.$t('message.success.upgrade.kubernetes')} ${this.resource.name}`,
successMethod: result => {
this.$emit('refresh-data')
}
successMessage: `${this.$t('message.success.upgrade.kubernetes')} ${this.resource.name}`
})
this.$emit('refresh-data')
this.closeAction()
}).catch(error => {
this.$notifyError(error)

View File

@ -170,28 +170,6 @@ export default {
},
inject: ['parentCloseAction', 'parentFetchData'],
methods: {
pollActionCompletion (jobId, action) {
this.$pollJob({
jobId,
successMethod: result => {
this.parentFetchData()
if (action.response) {
const description = action.response(result.jobresult)
if (description) {
this.$notification.info({
message: this.$t(action.label),
description: (<span domPropsInnerHTML={description}></span>),
duration: 0
})
}
}
},
errorMethod: () => this.parentFetchData(),
loadingMessage: `${this.$t(action.label)} ${this.$t('label.in.progress')} ${this.$t('label.for')} ${this.resource.name}`,
catchMessage: this.$t('error.fetching.async.job.result'),
action
})
},
handleSubmit (e) {
e.preventDefault()
this.form.validateFields((err, values) => {
@ -251,13 +229,30 @@ export default {
if (obj.includes('response')) {
for (const res in json[obj]) {
if (res === 'jobid') {
this.$store.dispatch('AddAsyncJob', {
this.$pollJob({
jobId: json[obj][res],
title: this.$t(this.action.label),
jobid: json[obj][res],
description: this.resource.name,
status: 'progress'
successMethod: result => {
if (this.action.api === 'deleteDomain') {
this.$set(this.resource, 'isDel', true)
this.parentUpdActionData(this.resource)
}
if (this.action.response) {
const description = this.action.response(result.jobresult)
if (description) {
this.$notification.info({
message: this.$t(this.action.label),
description: (<span domPropsInnerHTML={description}></span>),
duration: 0
})
}
}
},
loadingMessage: `${this.$t(this.action.label)} ${this.$t('label.in.progress')} ${this.$t('label.for')} ${this.resource.name}`,
catchMessage: this.$t('error.fetching.async.job.result'),
action: this.action
})
this.pollActionCompletion(json[obj][res], this.action)
hasJobId = true
break
}

View File

@ -334,17 +334,12 @@ export default {
this.deleteLoading = true
api('deleteIso', params).then(json => {
const jobId = json.deleteisoresponse.jobid
this.$store.dispatch('AddAsyncJob', {
title: this.$t('label.action.delete.iso'),
jobid: jobId,
description: this.resource.name,
status: 'progress',
bulkAction: this.selectedItems.length > 0 && this.showGroupActionModal
})
eventBus.$emit('update-job-details', jobId, null)
const singleZone = (this.dataSource.length === 1)
this.$pollJob({
jobId,
title: this.$t('label.action.delete.iso'),
description: this.resource.name,
successMethod: result => {
if (singleZone) {
if (this.selectedItems.length === 0) {
@ -415,15 +410,11 @@ export default {
this.copyLoading = true
api('copyIso', params).then(json => {
const jobId = json.copytemplateresponse.jobid
this.$store.dispatch('AddAsyncJob', {
title: this.$t('label.action.copy.iso'),
jobid: jobId,
description: this.resource.name,
status: 'progress'
})
eventBus.$emit('update-job-details', jobId, null)
this.$pollJob({
jobId,
title: this.$t('label.action.copy.iso'),
description: this.resource.name,
successMethod: result => {
this.fetchData()
},

View File

@ -382,17 +382,12 @@ export default {
this.deleteLoading = true
api('deleteTemplate', params).then(json => {
const jobId = json.deletetemplateresponse.jobid
this.$store.dispatch('AddAsyncJob', {
title: this.$t('label.action.delete.template'),
jobid: jobId,
description: this.resource.name,
status: 'progress',
bulkAction: this.selectedItems.length > 0 && this.showGroupActionModal
})
eventBus.$emit('update-job-details', jobId, null)
const singleZone = (this.dataSource.length === 1)
this.$pollJob({
jobId,
title: this.$t('label.action.delete.template'),
description: this.resource.name,
successMethod: result => {
if (singleZone) {
const isResourcePage = (this.$route.params && this.$route.params.id)
@ -483,15 +478,11 @@ export default {
this.copyLoading = true
api('copyTemplate', params).then(json => {
const jobId = json.copytemplateresponse.jobid
this.$store.dispatch('AddAsyncJob', {
title: this.$t('label.action.copy.template'),
jobid: jobId,
description: this.resource.name,
status: 'progress'
})
eventBus.$emit('update-job-details', jobId, null)
this.$pollJob({
jobId,
title: this.$t('label.action.copy.template'),
description: this.resource.name,
successMethod: result => {
this.fetchData()
},

View File

@ -297,15 +297,11 @@ export default {
}).then(response => {
this.$pollJob({
jobId: response.dedicateclusterresponse.jobid,
title: this.$t('message.cluster.dedicated'),
description: `${this.$t('label.domainid')} : ${this.dedicatedDomainId}`,
successMessage: this.$t('message.cluster.dedicated'),
successMethod: () => {
this.loading = false
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.cluster.dedicated'),
jobid: response.dedicateclusterresponse.jobid,
description: `${this.$t('label.domainid')} : ${this.dedicatedDomainId}`,
status: 'progress'
})
},
errorMessage: this.$t('error.dedicate.cluster.failed'),
errorMethod: () => {

View File

@ -315,15 +315,11 @@ export default {
}).then(response => {
this.$pollJob({
jobId: response.dedicatehostresponse.jobid,
title: this.$t('message.host.dedicated'),
description: `${this.$t('label.domainid')} : ${this.dedicatedDomainId}`,
successMessage: this.$t('message.host.dedicated'),
successMethod: () => {
this.loading = false
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.host.dedicated'),
jobid: response.dedicatehostresponse.jobid,
description: `${this.$t('label.domainid')} : ${this.dedicatedDomainId}`,
status: 'progress'
})
},
errorMessage: this.$t('error.dedicate.host.failed'),
errorMethod: () => {

View File

@ -133,6 +133,7 @@ export default {
const title = this.$t('message.data.migration')
this.loading = true
const loadingJob = this.$message.loading({ content: this.$t('label.migrating.data'), duration: 0 })
const result = this.migrateData(params, title)
result.then(json => {
@ -155,12 +156,11 @@ export default {
this.closeAction()
}).catch(error => {
console.log(error)
})
setTimeout(() => {
this.$message.loading({ content: this.$t('label.migrating.data'), duration: 1 })
}).finally(() => {
this.loading = false
setTimeout(loadingJob)
this.closeAction()
}, 200)
})
})
},
migrateData (args, title) {
@ -168,39 +168,22 @@ export default {
api('migrateSecondaryStorageData', args).then(async json => {
const jobId = json.migratesecondarystoragedataresponse.jobid
if (jobId) {
this.$store.dispatch('AddAsyncJob', {
title: title,
jobid: jobId,
this.$pollJob({
jobId,
title,
description: this.$t('message.data.migration.progress'),
status: 'progress',
silent: true
successMethod: (result) => resolve(result),
errorMethod: (result) => reject(result.jobresult.errortext),
showLoading: false,
catchMessage: this.$t('error.fetching.async.job.result'),
catchMethod: () => { this.closeAction() }
})
const result = await this.pollJob(jobId, title)
if (result.jobstatus === 2) {
reject(result.jobresult.errortext)
return
}
resolve(result)
}
}).catch(error => {
reject(error)
})
})
},
async pollJob (jobId, title) {
return new Promise(resolve => {
const asyncJobInterval = setInterval(() => {
api('queryAsyncJobResult', { jobId }).then(async json => {
const result = json.queryasyncjobresultresponse
if (result.jobstatus === 0) {
return
}
clearInterval(asyncJobInterval)
resolve(result)
})
}, 1000)
})
},
closeAction () {
this.$emit('close-action')
}

View File

@ -212,15 +212,11 @@ export default {
}).then(response => {
this.$pollJob({
jobId: response.dedicatepodresponse.jobid,
title: this.$t('message.pod.dedicated'),
description: `${this.$t('label.domainid')} : ${this.dedicatedDomainId}`,
successMessage: this.$t('message.pod.dedicated'),
successMethod: () => {
this.loading = false
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.pod.dedicated'),
jobid: response.dedicatepodresponse.jobid,
description: `${this.$t('label.domainid')} : ${this.dedicatedDomainId}`,
status: 'progress'
})
},
errorMessage: this.$t('error.dedicate.pod.failed'),
errorMethod: () => {

View File

@ -294,13 +294,10 @@ export default {
api('releaseDedicatedGuestVlanRange', {
id: item.id
}).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: `${this.$t('label.delete.dedicated.vlan.range')} ${item.guestvlanrange} ${this.$t('label.for')} ${item.account}`,
jobid: response.releasededicatedguestvlanrangeresponse.jobid,
status: 'progress'
})
this.$pollJob({
jobId: response.releasededicatedguestvlanrangeresponse.jobid,
title: this.$t('label.delete.dedicated.vlan.range'),
description: `${this.$t('label.delete.dedicated.vlan.range')} ${item.guestvlanrange} ${this.$t('label.for')} ${item.account}`,
successMethod: () => {
this.fetchData()
this.parentFinishLoading()

View File

@ -158,15 +158,8 @@ export default {
api('updateTrafficType', params).then(response => {
this.$pollJob({
jobId: response.updatetraffictyperesponse.jobid,
successMethod: result => {
this.$store.dispatch('AddAsyncJob', {
title: title,
description: description,
jobid: response.updatetraffictyperesponse.jobid,
status: this.$t('progress')
})
this.parentFetchData()
},
title: title,
description: description,
successMessage: `${this.$t('label.update.traffic.label')} ${this.traffictype} ${this.$t('label.success')}`,
loadingMessage: `${title} ${this.$t('label.in.progress')}`,
catchMessage: this.$t('error.fetching.async.job.result')

View File

@ -257,13 +257,11 @@ export default {
endip: record.endip,
vlan: record.vlanid
}).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.success.remove.iprange'),
jobid: response.deletemanagementnetworkiprangeresponse.jobid,
status: 'progress'
})
this.$pollJob({
jobId: response.deletemanagementnetworkiprangeresponse.jobid,
title: this.$t('label.remove.ip.range'),
description: record.id,
successMessage: this.$t('message.success.remove.iprange'),
successMethod: () => {
this.componentLoading = false
this.fetchData()
@ -301,13 +299,11 @@ export default {
forsystemvms: values.vms,
vlan: values.vlan || null
}).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.success.add.iprange'),
jobid: response.createmanagementnetworkiprangeresponse.jobid,
status: 'progress'
})
this.$pollJob({
jobId: response.createmanagementnetworkiprangeresponse.jobid,
title: this.$t('label.add.ip.range'),
description: values.pod,
successMessage: this.$t('message.success.add.iprange'),
successMethod: () => {
this.componentLoading = false
this.fetchData()

View File

@ -238,13 +238,11 @@ export default {
handleDeleteIpRange (id) {
this.componentLoading = true
api('deleteStorageNetworkIpRange', { id }).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.success.remove.iprange'),
jobid: response.deletestoragenetworkiprangeresponse.jobid,
status: 'progress'
})
this.$pollJob({
jobId: response.deletestoragenetworkiprangeresponse.jobid,
title: this.$t('label.remove.ip.range'),
description: id,
successMessage: this.$t('message.success.remove.iprange'),
successMethod: () => {
this.componentLoading = false
this.fetchData()
@ -282,13 +280,11 @@ export default {
endip: values.endip,
vlan: values.vlan || null
}).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.success.add.iprange'),
jobid: response.createstoragenetworkiprangeresponse.jobid,
status: 'progress'
})
this.$pollJob({
jobId: response.createstoragenetworkiprangeresponse.jobid,
title: this.$t('label.add.ip.range'),
description: values.pod,
successMessage: this.$t('message.success.add.iprange'),
successMethod: () => {
this.componentLoading = false
this.fetchData()

View File

@ -1362,13 +1362,7 @@ export default {
if (obj.includes('response') || obj.includes(apiName)) {
for (const res in json[obj]) {
if (res === 'jobid') {
this.$store.dispatch('AddAsyncJob', {
title: this.$t(this.currentAction.label),
jobid: json[obj][res],
description: this.$t(this.nsp.name),
status: 'progress'
})
this.parentPollActionCompletion(json[obj][res], this.currentAction)
this.parentPollActionCompletion(json[obj][res], this.currentAction, this.$t(this.nsp.name))
hasJobId = true
break
}

View File

@ -242,17 +242,9 @@ export default {
}
params.id = this.nsp.id
const jobId = await this.addF5LoadBalancer(params)
if (jobId) {
await this.$store.dispatch('AddAsyncJob', {
title: this.$t(this.action.label),
jobid: jobId,
description: this.$t(this.nsp.name),
status: 'progress'
})
await this.parentPollActionCompletion(jobId, this.action)
}
this.parentPollActionCompletion(jobId, this.action, this.$t(this.nsp.name))
this.provideCloseAction()
this.loading = false
await this.provideCloseAction()
} catch (error) {
this.loading = false
this.$notification.error({
@ -265,15 +257,19 @@ export default {
addNetworkServiceProvider (args) {
return new Promise((resolve, reject) => {
api('addNetworkServiceProvider', args).then(async json => {
const jobId = json.addnetworkserviceproviderresponse.jobid
if (jobId) {
const result = await this.pollJob(jobId)
if (result.jobstatus === 2) {
this.$pollJob({
jobId: json.addnetworkserviceproviderresponse.jobid,
successMethod: (result) => {
resolve(result.jobresult.networkserviceprovider)
},
errorMethod: (result) => {
reject(result.jobresult.errortext)
return
},
catchMessage: this.$t('error.fetching.async.job.result'),
action: {
isFetchData: false
}
resolve(result.jobresult.networkserviceprovider)
}
})
}).catch(error => {
reject(error)
})
@ -288,21 +284,6 @@ export default {
reject(error)
})
})
},
async pollJob (jobId) {
return new Promise(resolve => {
const asyncJobInterval = setInterval(() => {
api('queryAsyncJobResult', { jobId }).then(async json => {
const result = json.queryasyncjobresultresponse
if (result.jobstatus === 0) {
return
}
clearInterval(asyncJobInterval)
resolve(result)
})
}, 1000)
})
}
}
}

View File

@ -277,17 +277,9 @@ export default {
}
params.id = this.nsp.id
const jobId = await this.addNetscalerLoadBalancer(params)
if (jobId) {
await this.$store.dispatch('AddAsyncJob', {
title: this.$t(this.action.label),
jobid: jobId,
description: this.$t(this.nsp.name),
status: 'progress'
})
await this.parentPollActionCompletion(jobId, this.action)
}
this.parentPollActionCompletion(jobId, this.action, this.$t(this.nsp.name))
this.provideCloseAction()
this.loading = false
await this.provideCloseAction()
} catch (error) {
this.loading = false
this.$notification.error({
@ -300,15 +292,19 @@ export default {
addNetworkServiceProvider (args) {
return new Promise((resolve, reject) => {
api('addNetworkServiceProvider', args).then(async json => {
const jobId = json.addnetworkserviceproviderresponse.jobid
if (jobId) {
const result = await this.pollJob(jobId)
if (result.jobstatus === 2) {
this.$pollJob({
jobId: json.addnetworkserviceproviderresponse.jobid,
successMethod: (result) => {
resolve(result.jobresult.networkserviceprovider)
},
errorMethod: (result) => {
reject(result.jobresult.errortext)
return
},
catchMessage: this.$t('error.fetching.async.job.result'),
action: {
isFetchData: false
}
resolve(result.jobresult.networkserviceprovider)
}
})
}).catch(error => {
reject(error)
})
@ -323,21 +319,6 @@ export default {
reject(error)
})
})
},
async pollJob (jobId) {
return new Promise(resolve => {
const asyncJobInterval = setInterval(() => {
api('queryAsyncJobResult', { jobId }).then(async json => {
const result = json.queryasyncjobresultresponse
if (result.jobstatus === 0) {
return
}
clearInterval(asyncJobInterval)
resolve(result)
})
}, 1000)
})
}
}
}

View File

@ -154,17 +154,9 @@ export default {
}
params.id = this.nsp.id
const jobId = await this.addNiciraNvpDevice(params)
if (jobId) {
await this.$store.dispatch('AddAsyncJob', {
title: this.$t(this.action.label),
jobid: jobId,
description: this.$t(this.nsp.name),
status: 'progress'
})
await this.parentPollActionCompletion(jobId, this.action)
}
this.parentPollActionCompletion(jobId, this.action, this.$t(this.nsp.name))
this.provideCloseAction()
this.loading = false
await this.provideCloseAction()
} catch (error) {
this.loading = false
this.$notification.error({
@ -177,15 +169,19 @@ export default {
addNetworkServiceProvider (args) {
return new Promise((resolve, reject) => {
api('addNetworkServiceProvider', args).then(async json => {
const jobId = json.addnetworkserviceproviderresponse.jobid
if (jobId) {
const result = await this.pollJob(jobId)
if (result.jobstatus === 2) {
this.$pollJob({
jobId: json.addnetworkserviceproviderresponse.jobid,
successMethod: (result) => {
resolve(result.jobresult.networkserviceprovider)
},
errorMethod: (result) => {
reject(result.jobresult.errortext)
return
},
catchMessage: this.$t('error.fetching.async.job.result'),
action: {
isFetchData: false
}
resolve(result.jobresult.networkserviceprovider)
}
})
}).catch(error => {
reject(error)
})
@ -200,21 +196,6 @@ export default {
reject(error)
})
})
},
async pollJob (jobId) {
return new Promise(resolve => {
const asyncJobInterval = setInterval(() => {
api('queryAsyncJobResult', { jobId }).then(async json => {
const result = json.queryasyncjobresultresponse
if (result.jobstatus === 0) {
return
}
clearInterval(asyncJobInterval)
resolve(result)
})
}, 1000)
})
}
}
}

View File

@ -366,17 +366,9 @@ export default {
}
params.id = this.nsp.id
const jobId = await this.addPaloAltoFirewall(params)
if (jobId) {
await this.$store.dispatch('AddAsyncJob', {
title: this.$t(this.action.label),
jobid: jobId,
description: this.$t(this.nsp.name),
status: 'progress'
})
await this.parentPollActionCompletion(jobId, this.action)
}
this.parentPollActionCompletion(jobId, this.action, this.$t(this.nsp.name))
this.provideCloseAction()
this.loading = false
await this.provideCloseAction()
} catch (error) {
this.loading = false
this.$notification.error({
@ -389,15 +381,19 @@ export default {
addNetworkServiceProvider (args) {
return new Promise((resolve, reject) => {
api('addNetworkServiceProvider', args).then(async json => {
const jobId = json.addnetworkserviceproviderresponse.jobid
if (jobId) {
const result = await this.pollJob(jobId)
if (result.jobstatus === 2) {
this.$pollJob({
jobId: json.addnetworkserviceproviderresponse.jobid,
successMethod: (result) => {
resolve(result.jobresult.networkserviceprovider)
},
errorMethod: (result) => {
reject(result.jobresult.errortext)
return
},
catchMessage: this.$t('error.fetching.async.job.result'),
action: {
isFetchData: false
}
resolve(result.jobresult.networkserviceprovider)
}
})
}).catch(error => {
reject(error)
})
@ -412,21 +408,6 @@ export default {
reject(error)
})
})
},
async pollJob (jobId) {
return new Promise(resolve => {
const asyncJobInterval = setInterval(() => {
api('queryAsyncJobResult', { jobId }).then(async json => {
const result = json.queryasyncjobresultresponse
if (result.jobstatus === 0) {
return
}
clearInterval(asyncJobInterval)
resolve(result)
})
}, 1000)
})
}
}
}

View File

@ -311,17 +311,9 @@ export default {
}
params.id = this.nsp.id
const jobId = await this.addSrxFirewall(params)
if (jobId) {
await this.$store.dispatch('AddAsyncJob', {
title: this.$t(this.action.label),
jobid: jobId,
description: this.$t(this.nsp.name),
status: 'progress'
})
await this.parentPollActionCompletion(jobId, this.action)
}
this.parentPollActionCompletion(jobId, this.action, this.$t(this.nsp.name))
this.provideCloseAction()
this.loading = false
await this.provideCloseAction()
} catch (error) {
this.loading = false
this.$notification.error({
@ -334,15 +326,19 @@ export default {
addNetworkServiceProvider (args) {
return new Promise((resolve, reject) => {
api('addNetworkServiceProvider', args).then(async json => {
const jobId = json.addnetworkserviceproviderresponse.jobid
if (jobId) {
const result = await this.pollJob(jobId)
if (result.jobstatus === 2) {
this.$pollJob({
jobId: json.addnetworkserviceproviderresponse.jobid,
successMethod: (result) => {
resolve(result.jobresult.networkserviceprovider)
},
errorMethod: (result) => {
reject(result.jobresult.errortext)
return
},
catchMessage: this.$t('error.fetching.async.job.result'),
action: {
isFetchData: false
}
resolve(result.jobresult.networkserviceprovider)
}
})
}).catch(error => {
reject(error)
})
@ -357,21 +353,6 @@ export default {
reject(error)
})
})
},
async pollJob (jobId) {
return new Promise(resolve => {
const asyncJobInterval = setInterval(() => {
api('queryAsyncJobResult', { jobId }).then(async json => {
const result = json.queryasyncjobresultresponse
if (result.jobstatus === 0) {
return
}
clearInterval(asyncJobInterval)
resolve(result)
})
}, 1000)
})
}
}
}

View File

@ -188,7 +188,7 @@ export default {
return columns
}
},
inject: ['providerChangePage', 'provideReload', 'parentPollActionCompletion'],
inject: ['providerChangePage', 'provideReload'],
methods: {
changePage (page, pageSize) {
this.providerChangePage(this.title, page, pageSize)
@ -286,13 +286,13 @@ export default {
try {
const jobId = await this.executeDeleteRecord(apiName, params)
if (jobId) {
this.$store.dispatch('AddAsyncJob', {
this.$pollJob({
jobId,
title: this.$t(label),
jobid: jobId,
description: this.$t(name),
status: 'progress'
loadingMessage: `${this.$t(label)} - ${this.$t(name)}`,
catchMessage: this.$t('error.fetching.async.job.result')
})
this.parentPollActionCompletion(jobId, this.action)
} else {
this.$success('Success')
this.provideReload()
@ -322,13 +322,13 @@ export default {
try {
const jobId = await this.configureOvsElement(params)
if (jobId) {
this.$store.dispatch('AddAsyncJob', {
this.$pollJob({
jobId,
title: this.$t('label.configure.ovs'),
jobid: jobId,
description: this.$t(record.id),
status: 'progress'
loadingMessage: `${this.$t('label.configure.ovs')} - ${this.$t(record.id)}`,
catchMessage: this.$t('error.fetching.async.job.result')
})
this.parentPollActionCompletion(jobId, this.action)
} else {
this.$success('Success')
this.provideReload()

View File

@ -316,13 +316,10 @@ export default {
resourceIds: this.selectedAcl.id,
resourceType: 'NetworkACL'
}).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.delete.tag.for.networkacl'),
jobid: response.deletetagsresponse.jobid,
status: 'progress'
})
this.$pollJob({
jobId: response.deletetagsresponse.jobid,
title: this.$t('message.delete.tag.for.networkacl'),
description: `${tag.key} = ${tag.value}`,
successMessage: this.$t('message.success.delete.tag'),
successMethod: () => {
this.fetchTags(this.selectedAcl)
@ -361,13 +358,10 @@ export default {
resourceIds: this.selectedAcl.id,
resourceType: 'NetworkACL'
}).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.add.tag.for.networkacl'),
jobid: response.createtagsresponse.jobid,
status: 'progress'
})
this.$pollJob({
jobId: response.createtagsresponse.jobid,
title: this.$t('message.add.tag.for.networkacl'),
description: `${values.key} = ${values.value}`,
successMessage: this.$t('message.success.add.tag'),
successMethod: () => {
this.fetchTags(this.selectedAcl)
@ -449,13 +443,10 @@ export default {
data.partialupgrade = false
api('updateNetworkACLItem', {}, 'POST', data).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('label.edit.acl.rule'),
jobid: response.createnetworkaclresponse.jobid,
status: 'progress'
})
this.$pollJob({
jobId: response.createnetworkaclresponse.jobid,
title: this.$t('label.edit.acl.rule'),
description: this.selectedAcl.id,
successMessage: this.$t('message.success.edit.acl'),
successMethod: () => {
this.fetchData()
@ -482,13 +473,10 @@ export default {
handleDeleteRule (id) {
this.fetchLoading = true
api('deleteNetworkACL', { id }).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.delete.acl.rule'),
jobid: response.deletenetworkaclresponse.jobid,
status: 'progress'
})
this.$pollJob({
jobId: response.deletenetworkaclresponse.jobid,
title: this.$t('message.delete.acl.rule'),
description: id,
successMessage: this.$t('message.success.delete.acl.rule'),
successMethod: () => {
this.fetchData()
@ -570,13 +558,10 @@ export default {
previousaclruleid,
nextaclruleid
}).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.move.acl.order'),
jobid: response.moveNetworkAclItemResponse.jobid,
status: 'progress'
})
this.$pollJob({
jobId: response.moveNetworkAclItemResponse.jobid,
title: this.$t('message.move.acl.order'),
description: id,
successMessage: this.$t('message.success.move.acl.order'),
successMethod: () => {
this.fetchData()

View File

@ -176,18 +176,11 @@ export default {
if (jobId) {
this.$pollJob({
jobId,
successMethod: result => {
this.$store.dispatch('AddAsyncJob', {
title: title,
jobid: jobId,
description: description,
status: this.$t('progress')
})
},
title: title,
description: description,
loadingMessage: `${title} ${this.$t('label.in.progress')}`,
catchMessage: this.$t('error.fetching.async.job.result')
})
this.$emit('refresh-data')
}
this.closeAction()
}).catch(error => {

View File

@ -244,7 +244,6 @@ export default {
required: true
}
},
inject: ['parentFetchData', 'parentToggleLoading'],
data () {
return {
encryptionAlgo: [
@ -313,23 +312,17 @@ export default {
splitconnections: values.splitconnections,
ikeversion: values.ikeversion
}).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.add.vpn.customer.gateway'),
jobid: response.createvpncustomergatewayresponse.jobid,
description: values.name,
status: 'progress'
})
this.$pollJob({
jobId: response.createvpncustomergatewayresponse.jobid,
title: this.$t('message.add.vpn.customer.gateway'),
description: values.name,
successMessage: this.$t('message.success.add.vpn.customer.gateway'),
successMethod: () => {
this.closeModal()
this.parentFetchData()
},
errorMessage: `${this.$t('message.create.vpn.customer.gateway.failed')} ` + response,
errorMethod: () => {
this.closeModal()
this.parentFetchData()
},
loadingMessage: this.$t('message.add.vpn.customer.gateway.processing'),
catchMessage: this.$t('error.fetching.async.job.result'),

View File

@ -438,13 +438,11 @@ export default {
jobId: response.createtagsresponse.jobid,
successMessage: this.$t('message.success.add.tag'),
successMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.openTagsModal(this.selectedRule)
},
errorMessage: this.$t('message.add.tag.failed'),
errorMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.closeModal()
},
@ -473,13 +471,11 @@ export default {
jobId: response.deletetagsresponse.jobid,
successMessage: this.$t('message.success.delete.tag'),
successMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.openTagsModal(this.selectedRule)
},
errorMessage: this.$t('message.delete.tag.failed'),
errorMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.closeModal()
},

View File

@ -293,12 +293,10 @@ export default {
: response.authorizesecuritygroupegressresponse.jobid,
successMessage: this.$t('message.success.add.rule'),
successMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
},
errorMessage: this.$t('message.add.rule.failed'),
errorMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
},
loadingMessage: this.$t('message.add.rule.processing'),
@ -325,12 +323,10 @@ export default {
: response.revokesecuritygroupegressresponse.jobid,
successMessage: this.$t('message.success.remove.rule'),
successMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
},
errorMessage: this.$t('message.remove.rule.failed'),
errorMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
},
loadingMessage: this.$t('message.remove.securitygroup.rule.processing'),
@ -369,14 +365,12 @@ export default {
jobId: response.deletetagsresponse.jobid,
successMessage: this.$t('message.success.delete.tag'),
successMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.fetchTags(this.selectedRule)
this.tagsLoading = false
},
errorMessage: this.$t('message.delete.tag.failed'),
errorMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.fetchTags(this.selectedRule)
this.tagsLoading = false
@ -384,7 +378,6 @@ export default {
loadingMessage: this.$t('message.delete.tag.processing'),
catchMessage: this.$t('error.fetching.async.job.result'),
catchMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.fetchTags(this.selectedRule)
this.tagsLoading = false
@ -417,14 +410,12 @@ export default {
jobId: response.createtagsresponse.jobid,
successMessage: this.$t('message.success.add.tag'),
successMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.fetchTags(this.selectedRule)
this.tagsLoading = false
},
errorMessage: this.$t('message.add.tag.failed'),
errorMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.fetchTags(this.selectedRule)
this.tagsLoading = false
@ -432,7 +423,6 @@ export default {
loadingMessage: this.$t('message.add.tag.processing'),
catchMessage: this.$t('error.fetching.async.job.result'),
catchMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.fetchTags(this.selectedRule)
this.tagsLoading = false

View File

@ -210,17 +210,10 @@ export default {
this.$pollJob({
jobId: response.assigntoloadbalancerruleresponse.jobid,
successMessage: `${this.$t('message.success.assigned.vms')} ${this.$t('label.to')} ${this.resource.name}`,
successMethod: () => {
this.$emit('refresh-data')
},
errorMessage: `${this.$t('message.failed.to.assign.vms')} ${this.$t('label.to')} ${this.resource.name}`,
errorMethod: () => {
this.$emit('refresh-data')
},
loadingMessage: `${this.$t('label.assigning.vms')} ${this.$t('label.to')} ${this.resource.name}`,
catchMessage: this.$t('error.fetching.async.job.result')
})
this.$emit('refresh-data')
this.closeModal()
}).catch(error => {
this.$notification.error({

View File

@ -718,13 +718,11 @@ export default {
jobId: response.createtagsresponse.jobid,
successMessage: this.$t('message.success.add.tag'),
successMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.openTagsModal(this.selectedRule)
},
errorMessage: this.$t('message.add.tag.failed'),
errorMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.closeModal()
},
@ -753,13 +751,11 @@ export default {
jobId: response.deletetagsresponse.jobid,
successMessage: this.$t('message.success.delete.tag'),
successMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.openTagsModal(this.selectedRule)
},
errorMessage: this.$t('message.delete.tag.failed'),
errorMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.closeModal()
},
@ -810,14 +806,12 @@ export default {
jobId: response.createLBStickinessPolicy.jobid,
successMessage: this.$t('message.success.config.sticky.policy'),
successMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.fetchData()
this.closeModal()
},
errorMessage: this.$t('message.config.sticky.policy.failed'),
errorMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.fetchData()
this.closeModal()
@ -842,14 +836,12 @@ export default {
jobId: response.deleteLBstickinessrruleresponse.jobid,
successMessage: this.$t('message.success.remove.sticky.policy'),
successMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.fetchData()
this.closeModal()
},
errorMessage: this.$t('message.remove.sticky.policy.failed'),
errorMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.fetchData()
this.closeModal()
@ -954,14 +946,12 @@ export default {
jobId: response.updateloadbalancerruleresponse.jobid,
successMessage: this.$t('message.success.edit.rule'),
successMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.fetchData()
this.closeModal()
},
errorMessage: this.$t('message.edit.rule.failed'),
errorMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.fetchData()
this.closeModal()
@ -1049,8 +1039,8 @@ export default {
eventBus.$emit('update-resource-state', this.selectedItems, rule.id, 'success')
}
if (this.selectedRowKeys.length === 0) {
this.parentFetchData()
this.parentToggleLoading()
this.fetchData()
}
this.closeModal()
},
@ -1060,8 +1050,8 @@ export default {
eventBus.$emit('update-resource-state', this.selectedItems, rule.id, 'failed')
}
if (this.selectedRowKeys.length === 0) {
this.parentFetchData()
this.parentToggleLoading()
this.fetchData()
}
this.closeModal()
},
@ -1069,8 +1059,8 @@ export default {
catchMessage: this.$t('error.fetching.async.job.result'),
catchMethod: () => {
if (this.selectedRowKeys.length === 0) {
this.parentFetchData()
this.parentToggleLoading()
this.parentFetchData()
}
this.closeModal()
},
@ -1192,14 +1182,12 @@ export default {
jobId: response.assigntoloadbalancerruleresponse.jobid,
successMessage: this.$t('message.success.asign.vm'),
successMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.fetchData()
this.closeModal()
},
errorMessage: this.$t('message.assign.vm.failed'),
errorMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.fetchData()
this.closeModal()

View File

@ -571,13 +571,11 @@ export default {
successMessage: this.$t('message.success.add.port.forward'),
successMethod: () => {
this.closeModal()
this.parentFetchData()
this.fetchData()
},
errorMessage: this.$t('message.add.port.forward.failed'),
errorMethod: () => {
this.closeModal()
this.parentFetchData()
this.fetchData()
},
loadingMessage: this.$t('message.add.port.forward.processing'),
@ -647,13 +645,11 @@ export default {
jobId: response.createtagsresponse.jobid,
successMessage: this.$t('message.success.add.tag'),
successMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.openTagsModal(this.selectedRule)
},
errorMessage: this.$t('message.add.tag.failed'),
errorMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.closeModal()
},
@ -681,13 +677,11 @@ export default {
jobId: response.deletetagsresponse.jobid,
successMessage: this.$t('message.success.delete.tag'),
successMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.openTagsModal(this.selectedRule)
},
errorMessage: this.$t('message.delete.tag.failed'),
errorMethod: () => {
this.parentFetchData()
this.parentToggleLoading()
this.closeModal()
},

View File

@ -136,13 +136,10 @@ export default {
}).then(response => {
this.$pollJob({
jobId: response.createstaticrouteresponse.jobid,
title: this.$t('message.success.add.static.route'),
description: this.newRoute,
successMethod: () => {
this.fetchData()
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.success.add.static.route'),
jobid: response.createstaticrouteresponse.jobid,
status: 'progress'
})
this.componentLoading = false
this.newRoute = null
},
@ -171,13 +168,10 @@ export default {
}).then(response => {
this.$pollJob({
jobId: response.deletestaticrouteresponse.jobid,
title: this.$t('message.success.delete.static.route'),
description: route.id,
successMethod: () => {
this.fetchData()
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.success.delete.static.route'),
jobid: response.deletestaticrouteresponse.jobid,
status: 'progress'
})
this.componentLoading = false
},
errorMessage: this.$t('message.delete.static.route.failed'),

View File

@ -590,13 +590,10 @@ export default {
}
api('createPrivateGateway', params).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.success.add.private.gateway'),
jobid: response.createprivategatewayresponse.jobid,
status: 'progress'
})
this.$pollJob({
jobId: response.createprivategatewayresponse.jobid,
title: this.$t('message.success.add.private.gateway'),
description: this.resource.id,
successMethod: () => {
this.modals.gateway = false
this.handleFetchData()
@ -637,13 +634,10 @@ export default {
s2scustomergatewayid: values.vpncustomergateway,
passive: values.passive ? values.passive : false
}).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('label.vpn.connection'),
jobid: response.createvpnconnectionresponse.jobid,
status: 'progress'
})
this.$pollJob({
jobId: response.createvpnconnectionresponse.jobid,
title: this.$t('label.vpn.connection'),
description: this.vpnGateways[0].id,
successMethod: () => {
this.fetchVpnConnections()
this.fetchLoading = false
@ -682,13 +676,10 @@ export default {
description: values.description,
vpcid: this.resource.id
}).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.success.add.network.acl'),
jobid: response.createnetworkacllistresponse.jobid,
status: 'progress'
})
this.$pollJob({
jobId: response.createnetworkacllistresponse.jobid,
title: this.$t('message.success.add.network.acl'),
description: values.name || values.description,
successMethod: () => {
this.fetchLoading = false
},
@ -715,13 +706,10 @@ export default {
api('createVpnGateway', {
vpcid: this.resource.id
}).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.success.add.vpn.gateway'),
jobid: response.createvpngatewayresponse.jobid,
status: 'progress'
})
this.$pollJob({
jobId: response.createvpngatewayresponse.jobid,
title: this.$t('message.success.add.vpn.gateway'),
description: this.resource.id,
successMethod: () => {
this.fetchLoading = false
},

View File

@ -622,14 +622,10 @@ export default {
sourceipaddressnetworkid: this.networkid,
scheme: 'Internal'
}).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.create.internallb'),
jobid: response.createloadbalancerresponse.jobid,
description: values.name,
status: 'progress'
})
this.$pollJob({
jobId: response.createloadbalancerresponse.jobid,
title: this.$t('message.create.internallb'),
description: values.name,
successMessage: this.$t('message.success.create.internallb'),
successMethod: () => {
this.fetchData()

View File

@ -130,13 +130,11 @@ export default {
duration: 0
})
this.fetchData()
this.parentFetchData()
this.parentToggleLoading()
},
errorMessage: this.$t('message.enable.vpn.failed'),
errorMethod: () => {
this.fetchData()
this.parentFetchData()
this.parentToggleLoading()
},
loadingMessage: this.$t('message.enable.vpn.processing'),
@ -166,13 +164,11 @@ export default {
successMessage: this.$t('message.success.disable.vpn'),
successMethod: () => {
this.fetchData()
this.parentFetchData()
this.parentToggleLoading()
},
errorMessage: this.$t('message.disable.vpn.failed'),
errorMethod: () => {
this.fetchData()
this.parentFetchData()
this.parentToggleLoading()
},
loadingMessage: this.$t('message.disable.vpn.processing'),

View File

@ -107,7 +107,6 @@ export default {
created () {
this.fetchData()
},
inject: ['parentFetchData'],
methods: {
fetchData () {
this.fetchZone()
@ -161,15 +160,9 @@ export default {
if (jobId) {
this.$pollJob({
jobId,
title: title,
description: values.name,
successMethod: result => {
const successDescription = result.jobresult.backupoffering.name
this.$store.dispatch('AddAsyncJob', {
title: title,
jobid: jobId,
description: successDescription,
status: 'progress'
})
this.parentFetchData()
this.closeAction()
},
loadingMessage: `${title} ${this.$t('label.in.progress')} ${this.$t('label.for')} ${params.name}`,

View File

@ -348,11 +348,11 @@ export default {
if (res === 'jobid') {
hasJobId = true
const jobId = json[obj][res]
this.$store.dispatch('AddAsyncJob', {
title: title,
jobid: jobId,
description: description,
status: 'progress'
this.$pollJob({
jobId,
title,
description,
showLoading: false
})
}
}

View File

@ -231,7 +231,6 @@ export default {
loadingMessage: `Adding Account: ${params.account} to project...`,
catchMessage: 'Error encountered while fetching async job result'
})
this.$emit('refresh-data')
this.closeAction()
}).catch(error => {
this.$notifyError(error)
@ -266,7 +265,6 @@ export default {
loadingMessage: `Adding User ${params.username} to project...`,
catchMessage: 'Error encountered while fetching async job result'
})
this.$emit('refresh-data')
this.closeAction()
}).catch(error => {
console.log('catch')

View File

@ -99,11 +99,11 @@ export default {
if (res === 'jobid') {
hasJobId = true
const jobId = json[obj][res]
this.$store.dispatch('AddAsyncJob', {
this.$pollJob({
title: title,
jobid: jobId,
description: description,
status: 'progress'
showLoading: false
})
}
}

View File

@ -295,11 +295,11 @@ export default {
if (res === 'jobid') {
hasJobId = true
const jobId = json[obj][res]
this.$store.dispatch('AddAsyncJob', {
this.$pollJob({
title: title,
jobid: jobId,
description: description,
status: 'progress'
showLoading: false
})
}
}

View File

@ -53,7 +53,6 @@ export default {
required: true
}
},
inject: ['parentFetchData'],
data () {
return {
virtualmachines: [],
@ -110,16 +109,10 @@ export default {
id: this.resource.id,
virtualmachineid: values.virtualmachineid
}).then(response => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('label.action.attach.disk'),
jobid: response.attachvolumeresponse.jobid,
status: 'progress'
})
this.$pollJob({
jobId: response.attachvolumeresponse.jobid,
successMethod: () => {
this.parentFetchData()
},
title: this.$t('label.action.attach.disk'),
description: this.resource.id,
errorMessage: `${this.$t('message.attach.volume.failed')}: ${this.resource.name || this.resource.id}`,
loadingMessage: `${this.$t('message.attach.volume.progress')}: ${this.resource.name || this.resource.id}`,
catchMessage: this.$t('error.fetching.async.job.result')
@ -129,7 +122,6 @@ export default {
this.$notifyError(error)
}).finally(() => {
this.loading = false
this.parentFetchData()
})
})
}

View File

@ -100,24 +100,13 @@ export default {
}).then(response => {
this.$pollJob({
jobId: response.createsnapshotfromvmsnapshotresponse.jobid,
title: this.$t('message.success.create.snapshot.from.vmsnapshot'),
description: values.name,
successMessage: this.$t('message.success.create.snapshot.from.vmsnapshot'),
successMethod: () => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.success.create.snapshot.from.vmsnapshot'),
jobid: response.createsnapshotfromvmsnapshotresponse.jobid,
description: values.name,
status: 'progress'
})
this.$emit('refresh-data')
},
errorMessage: this.$t('message.create.snapshot.from.vmsnapshot.failed'),
errorMethod: () => {
this.$emit('refresh-data')
},
loadingMessage: this.$t('message.create.snapshot.from.vmsnapshot.progress'),
catchMessage: this.$t('error.fetching.async.job.result')
})
this.$emit('refresh-data')
this.closeModal()
}).catch(error => {
this.$notifyError(error)

View File

@ -180,24 +180,13 @@ export default {
api('createVolume', values).then(response => {
this.$pollJob({
jobId: response.createvolumeresponse.jobid,
title: this.$t('message.success.create.volume'),
description: values.name,
successMessage: this.$t('message.success.create.volume'),
successMethod: () => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.success.create.volume'),
jobid: response.createvolumeresponse.jobid,
description: values.name,
status: 'progress'
})
this.$emit('refresh-data')
},
errorMessage: this.$t('message.create.volume.failed'),
errorMethod: () => {
this.$emit('refresh-data')
},
loadingMessage: this.$t('message.create.volume.processing'),
catchMessage: this.$t('error.fetching.async.job.result')
})
this.$emit('refresh-data')
this.closeModal()
}).catch(error => {
this.$notifyError(error)

View File

@ -148,13 +148,7 @@ export default {
this.$pollJob({
jobId: response.migratevolumeresponse.jobid,
successMessage: this.$t('message.success.migrate.volume'),
successMethod: () => {
this.parentFetchData()
},
errorMessage: this.$t('message.migrate.volume.failed'),
errorMethod: () => {
this.parentFetchData()
},
loadingMessage: this.$t('message.migrate.volume.processing'),
catchMessage: this.$t('error.fetching.async.job.result'),
catchMethod: () => {
@ -162,7 +156,6 @@ export default {
}
})
this.closeModal()
this.parentFetchData()
}).catch(error => {
this.$notifyError(error)
})

View File

@ -103,15 +103,10 @@ export default {
api('resizeVolume', values).then(response => {
this.$pollJob({
jobId: response.resizevolumeresponse.jobid,
title: this.$t('message.success.resize.volume'),
description: values.name,
successMessage: this.$t('message.success.resize.volume'),
successMethod: () => {
this.$store.dispatch('AddAsyncJob', {
title: this.$t('message.success.resize.volume'),
jobid: response.resizevolumeresponse.jobid,
description: values.name,
status: 'progress'
})
},
successMethod: () => {},
errorMessage: this.$t('message.resize.volume.failed'),
errorMethod: () => {
this.closeModal()

View File

@ -144,15 +144,9 @@ export default {
if (jobId) {
this.$pollJob({
jobId,
title: title,
description: values.volumeid,
successMethod: result => {
const successDescription = result.jobresult.storagebackup.name
this.$store.dispatch('AddAsyncJob', {
title: title,
jobid: jobId,
description: successDescription,
status: 'progress'
})
this.parentFetchData()
this.closeAction()
},
loadingMessage: `${title} ${this.$t('label.in.progress.for')} ${this.resource.id}`,

View File

@ -167,15 +167,9 @@ export default {
if (jobId) {
this.$pollJob({
jobId,
successMethod: result => {
const successDescription = result.jobresult.snapshot.name
this.$store.dispatch('AddAsyncJob', {
title: title,
jobid: jobId,
description: successDescription,
status: 'progress'
})
},
title: title,
description: values.name || this.resource.id,
successMethod: result => {},
loadingMessage: `${title} ${this.$t('label.in.progress.for')} ${description}`,
catchMessage: this.$t('error.fetching.async.job.result')
})