utils: introduce global API error notification (#296)

Fixes #294

Introduce a new global `this.$notifyError(error)` that takes in the `error` in a catch block and displays error notification with duration: 0, refactored to replace error handling codebase-wide.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
Co-authored-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Abhishek Kumar 2020-05-08 15:26:54 +05:30 committed by Rohit Yadav
parent 74ae4a53b3
commit 5ab5adc918
77 changed files with 223 additions and 774 deletions

View File

@ -121,10 +121,7 @@ export default {
this.dedicatedAccountId = response.listdedicatedzonesresponse.dedicatedzone[0].accountid
}
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
})
},
fetchDedicatedPods () {
@ -137,10 +134,7 @@ export default {
this.dedicatedAccountId = response.listdedicatedpodsresponse.dedicatedpod[0].accountid
}
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
})
},
fetchDedicatedClusters () {
@ -153,10 +147,7 @@ export default {
this.dedicatedAccountId = response.listdedicatedclustersresponse.dedicatedcluster[0].accountid
}
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
})
},
fetchDedicatedHosts () {
@ -169,10 +160,7 @@ export default {
this.dedicatedAccountId = response.listdedicatedhostsresponse.dedicatedhost[0].accountid
}
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
})
},
releaseDedidcatedZone () {
@ -202,10 +190,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
})
},
releaseDedidcatedPod () {
@ -235,10 +220,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
})
},
releaseDedidcatedCluster () {
@ -268,10 +250,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
})
},
releaseDedidcatedHost () {
@ -301,10 +280,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
})
},
handleRelease () {

View File

@ -80,12 +80,9 @@ export default {
this.domainId = this.domainsList[0].id
this.handleChangeDomain(this.domainId)
}
this.domainsLoading = false
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.domainsLoading = false
})
},
@ -98,10 +95,7 @@ export default {
this.handleChangeAccount(null)
}
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
})
},
handleChangeDomain (e) {

View File

@ -118,10 +118,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.dedicatedDomainModal = false
})
},
@ -165,10 +162,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.dedicatedDomainModal = false
})
},
@ -212,10 +206,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.dedicatedDomainModal = false
})
},
@ -259,10 +250,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.dedicatedDomainModal = false
})
},

View File

@ -193,10 +193,7 @@ export default {
return { name: k, value: details[k], edit: false }
})
}).catch(error => {
this.$notification.error({
message: 'Failed to add setting',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(f => {
this.loading = false
this.showAddDetail = false

View File

@ -135,10 +135,7 @@ export default {
this.$message.success('Apply Successful')
this.fetchData()
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.formLoading = false
})

View File

@ -71,10 +71,7 @@ export default {
}
this.$set(this.resource, 'vmwaredc', this.vmwaredc)
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
})
}
}

View File

@ -27,11 +27,12 @@ import './core/use'
import './core/ext'
import './permission' // permission control
import './utils/filter' // global filter
import { pollJobPlugin } from './utils/plugins'
import { pollJobPlugin, notifierPlugin } from './utils/plugins'
Vue.config.productionTip = false
Vue.use(VueAxios, router)
Vue.use(pollJobPlugin)
Vue.use(notifierPlugin)
new Vue({
router,

View File

@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.
import _ from 'lodash'
import { api } from '@/api'
import { message, notification } from 'ant-design-vue'
@ -77,3 +78,35 @@ export const pollJobPlugin = {
}
}
export const notifierPlugin = {
install (Vue) {
Vue.prototype.$notifyError = function (error) {
var msg = 'Request Failed'
var desc = ''
if (error && error.response) {
if (error.response.status) {
msg = `Request Failed (${error.response.status})`
}
if (error.message) {
desc = error.message
}
if (error.response.headers && 'x-description' in error.response.headers) {
desc = error.response.headers['x-description']
}
if (desc === '' && error.response.data) {
const responseKey = _.findKey(error.response.data, 'errortext')
if (responseKey) {
desc = error.response.data[responseKey].errortext
}
}
}
notification.error({
message: msg,
description: error && error.response && 'x-description' in error.response.headers ? error.response.headers['x-description'] : error.message,
duration: 0
})
}
}
}

View File

@ -41,7 +41,7 @@ const err = (error) => {
if (response.config && response.config.params && ['listIdps'].includes(response.config.params.command)) {
return
}
notification.error({ message: 'Unauthorized', description: 'Authorization verification failed' })
notification.error({ message: 'Unauthorized', description: 'Session expired, authorization verification failed' })
if (token) {
store.dispatch('Logout').then(() => {
setTimeout(() => {

View File

@ -507,11 +507,7 @@ export default {
this.treeSelected = {}
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description'],
duration: 0
})
this.$notifyError(error)
if ([401, 405].includes(error.response.status)) {
this.$router.push({ path: '/exception/403' })
@ -771,10 +767,7 @@ export default {
}
}).catch(error => {
console.log(error)
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(f => {
this.closeAction()
})

View File

@ -216,10 +216,7 @@ export default {
this.$parent.$parent.close()
this.parentFetchData()
}).catch(error => {
this.$notification.error({
message: 'Failed to assign instance',
description: error.response.data.assignvirtualmachineresponse.errortext && error.response.data.assignvirtualmachineresponse.errortext
})
this.$notifyError(error)
this.$parent.$parent.close()
this.parentFetchData()
})

View File

@ -405,10 +405,7 @@ export default {
api('createKubernetesCluster', params).then(json => {
this.$message.success('Successfully created Kubernetes cluster: ' + values.name)
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.$emit('refresh-data')
this.loading = false

View File

@ -166,10 +166,7 @@ export default {
api('registerSSHKeyPair', params).then(json => {
this.$message.success('Successfully registered SSH key pair: ' + values.name)
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.$emit('refresh-data')
this.loading = false
@ -186,10 +183,7 @@ export default {
})
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.$emit('refresh-data')
this.loading = false

View File

@ -946,10 +946,7 @@ export default {
}
this.$router.back()
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.loading.deploy = false
})

View File

@ -422,10 +422,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.loadingNic = false
})
},
@ -455,10 +452,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.loadingNic = false
})
},
@ -493,10 +487,7 @@ export default {
})
})
.catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.loadingNic = false
})
},
@ -528,10 +519,7 @@ export default {
})
})
.catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.loadingNic = false
})
},
@ -568,10 +556,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.addiptovmnicresponse.errortext
})
this.$notifyError(error)
this.loadingNic = false
})
},
@ -602,10 +587,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.loadingNic = false
this.fetchSecondaryIPs(this.selectedNicId)
})

View File

@ -293,10 +293,7 @@ export default {
this.kubernetesVersion = versionObjs[0]
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.versionLoading = false
if (!this.isObjectEmpty(this.kubernetesVersion) && this.isValidValueForKey(this.kubernetesVersion, 'semanticversion')) {
@ -333,10 +330,7 @@ export default {
this.virtualmachines = this.virtualmachines.concat(listVms)
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.instanceLoading = false
})
@ -363,10 +357,7 @@ export default {
this.publicIpAddress = ips[0]
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.networkLoading = false
})

View File

@ -173,10 +173,7 @@ export default {
api('scaleKubernetesCluster', params).then(json => {
this.$message.success('Successfully scaled Kubernetes cluster: ' + this.resource.name)
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.$emit('refresh-data')
this.loading = false

View File

@ -149,10 +149,7 @@ export default {
api('upgradeKubernetesCluster', params).then(json => {
this.$message.success('Successfully upgraded Kubernetes cluster: ' + this.resource.name)
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.$emit('refresh-data')
this.loading = false

View File

@ -164,10 +164,7 @@ export default {
}
this.refreshSchedule()
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.actionLoading = false
})

View File

@ -274,10 +274,7 @@ export default {
this.refreshSchedule()
this.resetForm()
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.actionLoading = false
})

View File

@ -198,10 +198,7 @@ export default {
this.fetchListDomains(),
this.fetchListRoles()
]).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.listLoading = false
this.timeZoneLoading = false
@ -319,10 +316,7 @@ export default {
this.$emit('refresh-data')
this.handleClose()
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
this.$emit('refresh-data')
}).finally(() => {
this.loading = false
@ -365,10 +359,7 @@ export default {
}))
}
Promise.all(promises).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
})
},
onSelectChange (selectedRowKeys) {

View File

@ -146,10 +146,7 @@ export default {
description: 'Successfully changed password for user "' + this.resource.username + '"'
})
}).catch(error => {
this.$notification.error({
message: 'Error',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.$emit('refresh-data')
this.loading = false

View File

@ -164,10 +164,7 @@ export default {
this.dataSource = listSslResponse
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})
@ -203,10 +200,7 @@ export default {
setTimeout(loading)
// show error
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
})
},
onShowConfirm (row) {

View File

@ -206,10 +206,7 @@ export default {
api('addKubernetesSupportedVersion', params).then(json => {
this.$message.success('Successfully added Kubernetes version: ' + values.semanticversion)
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.$emit('refresh-data')
this.loading = false

View File

@ -127,10 +127,7 @@ export default {
this.itemCount = count
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
})

View File

@ -334,11 +334,7 @@ export default {
description: 'Sucessfully registered ISO ' + params.name
})
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
duration: 0
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
this.closeAction()
@ -359,11 +355,7 @@ export default {
})
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
duration: 0
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})

View File

@ -873,11 +873,7 @@ export default {
description: 'Successfully registered template ' + params.name
})
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
duration: 0
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
this.closeAction()
@ -895,11 +891,7 @@ export default {
this.uploadParams = (json.postuploadtemplateresponse && json.postuploadtemplateresponse.getuploadparams) ? json.postuploadtemplateresponse.getuploadparams : ''
this.handleUpload()
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
duration: 0
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})

View File

@ -124,10 +124,7 @@ export default {
this.itemCount = count
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
})

View File

@ -131,10 +131,7 @@ export default {
api('updateKubernetesSupportedVersion', params).then(json => {
this.$message.success('Successfully updated Kubernetes supported version: ' + this.resource.name)
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.$emit('refresh-data')
this.loading = false

View File

@ -254,12 +254,7 @@ export default {
})
})
.catch(error => {
this.$notification.error({
message: 'Failed to update ' + resourceType + ' permissions',
description: this.isImageTypeIso
? error.response.data.updateisopermissions.errortext
: error.response.data.updatetemplatepermissions.errortext
})
this.$notifyError(error)
})
.finally(e => {
this.loading = false

View File

@ -534,10 +534,7 @@ export default {
description: this.$t('label.add.primary.storage')
})
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
this.closeModal()

View File

@ -278,10 +278,7 @@ export default {
description: this.$t('label.add.secondary.storage')
})
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
this.closeModal()

View File

@ -167,10 +167,7 @@ export default {
this.zoneId = this.zonesList[0].id || null
this.fetchPods()
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})
@ -181,10 +178,7 @@ export default {
this.hypervisorsList = response.listhypervisorsresponse.hypervisor || []
this.hypervisor = this.hypervisorsList[0].name || null
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})
@ -197,10 +191,7 @@ export default {
this.podsList = response.listpodsresponse.pod || []
this.podId = this.podsList[0].id || null
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})

View File

@ -188,10 +188,7 @@ export default {
this.zoneId = this.zonesList[0].id || null
this.fetchPods()
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})
@ -205,10 +202,7 @@ export default {
this.podId = this.podsList[0].id || null
this.fetchClusters()
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.podsList = []
this.podId = ''
}).finally(() => {
@ -226,10 +220,7 @@ export default {
this.handleChangeCluster()
}
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.listclustersresponse.errortext
})
this.$notifyError(error)
this.clustersList = []
this.clusterId = null
}).finally(() => {
@ -241,10 +232,7 @@ export default {
api('listHostTags').then(response => {
this.hostTagsList = response.listhosttagsresponse.hosttag || []
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.listhosttagsresponse.errortext
})
this.$notifyError(error)
this.hostTagsList = []
}).finally(() => {
this.loading = false

View File

@ -135,10 +135,7 @@ export default {
api('listHosts', { id: this.resource.id }).then(json => {
this.host = json.listhostsresponse.host[0]
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
})

View File

@ -161,10 +161,7 @@ export default {
this.params = this.$store.getters.apis.createPod.params
Object.keys(this.placeholder).forEach(item => { this.returnPlaceholder(item) })
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})

View File

@ -220,10 +220,7 @@ export default {
}
this.formLoading = false
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.formLoading = false
})
},
@ -247,10 +244,7 @@ export default {
}
this.formLoading = false
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.formLoading = false
})
},
@ -273,10 +267,7 @@ export default {
}
this.formLoading = false
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.formLoading = false
})
},
@ -334,10 +325,7 @@ export default {
this.modal = false
this.fetchData()
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.dedicateguestvlanrangeresponse.errortext
})
this.$notifyError(error)
this.modal = false
this.fetchData()
})

View File

@ -220,11 +220,7 @@ export default {
}
}).catch(error => {
console.log(error)
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.listpodsresponse
? error.response.data.listpodsresponse.errortext : error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.componentLoading = false
})
@ -271,11 +267,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.deletemanagementnetworkiprangeresponse
? error.response.data.deletemanagementnetworkiprangeresponse.errortext : error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.componentLoading = false
this.fetchData()
})
@ -319,11 +311,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.createmanagementnetworkiprangeresponse
? error.response.data.createmanagementnetworkiprangeresponse.errortext : error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.componentLoading = false
this.fetchData()

View File

@ -268,11 +268,7 @@ export default {
}).then(response => {
this.items = response.listvlaniprangesresponse.vlaniprange ? response.listvlaniprangesresponse.vlaniprange : []
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.listvlaniprangesresponse
? error.response.data.listvlaniprangesresponse.errortext : error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.componentLoading = false
})
@ -289,11 +285,7 @@ export default {
this.form.setFieldsValue({ domain: this.domains[0].id })
}
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.listdomains
? error.response.data.listdomains.errortext : error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.domainsLoading = false
})
@ -312,11 +304,7 @@ export default {
domainid: this.addAccount.domain,
account: this.addAccount.account
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.dedicatepubliciprangeresponse
? error.response.data.dedicatepubliciprangeresponse.errortext : error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.addAccountModal = false
this.domainsLoading = false
@ -326,11 +314,7 @@ export default {
handleRemoveAccount (id) {
this.componentLoading = true
api('releasePublicIpRange', { id }).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.releasepubliciprangeresponse
? error.response.data.releasepubliciprangeresponse.errortext : error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.fetchData()
})
@ -364,11 +348,7 @@ export default {
message: 'Removed IP Range'
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.deletevlaniprangeresponse
? error.response.data.deletevlaniprangeresponse.errortext : error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.componentLoading = false
this.fetchData()

View File

@ -190,11 +190,7 @@ export default {
}).then(response => {
this.items = response.liststoragenetworkiprangeresponse.storagenetworkiprange ? response.liststoragenetworkiprangeresponse.storagenetworkiprange : []
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.liststoragenetworkiprangeresponse
? error.response.data.liststoragenetworkiprangeresponse.errortext : error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.componentLoading = false
})
@ -206,11 +202,7 @@ export default {
}).then(response => {
this.pods = response.listpodsresponse.pod ? response.listpodsresponse.pod : []
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.listpodsresponse
? error.response.data.listpodsresponse.errortext : error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.componentLoading = false
})
@ -256,11 +248,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.deletestoragenetworkiprangeresponse
? error.response.data.deletestoragenetworkiprangeresponse.errortext : error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.componentLoading = false
this.fetchData()
})
@ -304,11 +292,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.createstoragenetworkiprangeresponse
? error.response.data.createstoragenetworkiprangeresponse.errortext : error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.componentLoading = false
this.fetchData()

View File

@ -129,11 +129,7 @@ export default {
}
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description'],
duration: 0
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
})

View File

@ -99,10 +99,7 @@ export default {
api('listTrafficTypes', { physicalnetworkid: this.resource.id }).then(json => {
this.traffictypes = json.listtraffictypesresponse.traffictype
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
})
@ -116,10 +113,7 @@ export default {
}).then(json => {
this.publicNetwork = json.listnetworksresponse.network[0] || {}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
})

View File

@ -102,10 +102,7 @@ export default {
api('listPhysicalNetworks', { zoneid: this.resource.id }).then(json => {
this.networks = json.listphysicalnetworksresponse.physicalnetwork || []
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
})

View File

@ -110,10 +110,7 @@ export default {
api('listSystemVms', { zoneid: this.resource.id }).then(json => {
this.vms = json.listsystemvmsresponse.systemvm || []
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
})

View File

@ -73,10 +73,7 @@ export default {
this.resourcesList = response.listcapacityresponse.capacity
this.animatePercentVals()
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
})

View File

@ -271,10 +271,7 @@ export default {
this.acls.sort((a, b) => a.number - b.number)
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
})
@ -287,10 +284,7 @@ export default {
}).then(response => {
this.tags = response.listtagsresponse.tag || []
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
})
},
openTagsModal (acl) {
@ -332,10 +326,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.deletetagsresponse.errortext
})
this.$notifyError(error)
this.tagsLoading = false
})
},
@ -380,10 +371,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.createtagsresponse.errortext
})
this.$notifyError(error)
this.tagsLoading = false
})
})
@ -451,10 +439,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.createnetworkaclresponse.errortext
})
this.$notifyError(error)
this.fetchLoading = false
})
})
@ -487,10 +472,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.deletenetworkaclresponse.errortext
})
this.$notifyError(error)
this.fetchLoading = false
})
},
@ -552,10 +534,7 @@ export default {
description: 'Successfully added new rule'
})
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
this.fetchData()
@ -602,10 +581,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.headers['x-description']
})
this.$notifyError(error)
this.fetchLoading = false
})
},

View File

@ -409,10 +409,7 @@ export default {
})
this.$emit('refresh-data')
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.actionLoading = false
this.closeAction()

View File

@ -329,10 +329,7 @@ export default {
description: 'Successfully created L2 network'
})
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.$emit('refresh-data')
this.actionLoading = false

View File

@ -652,10 +652,7 @@ export default {
})
this.resetForm()
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.$emit('refresh-data')
this.actionLoading = false

View File

@ -199,10 +199,7 @@ export default {
catchMethod: () => this.fetchData()
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.fetchData()
})
},
@ -229,10 +226,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.createegressfirewallruleresponse.errortext
})
this.$notifyError(error)
this.resetAllRules()
this.fetchData()
})

View File

@ -174,10 +174,7 @@ export default {
}).then(response => {
this.vmsList = response.listvirtualmachinesresponse.virtualmachine
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})
@ -196,10 +193,7 @@ export default {
}).then(response => {
this.vmsList = response.listvirtualmachinesresponse.virtualmachine || []
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})
@ -223,10 +217,7 @@ export default {
this.selectedNic = this.nicsList[0]
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})
@ -241,10 +232,7 @@ export default {
}).then(response => {
this.networksList = response.listnetworksresponse.network
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})
@ -259,11 +247,7 @@ export default {
}).then(() => {
this.parentFetchData()
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description'],
duration: 0
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
this.handleClose()

View File

@ -213,10 +213,7 @@ export default {
this.firewallRules = response.listfirewallrulesresponse.firewallrule || []
this.totalCount = response.listfirewallrulesresponse.count || 0
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})
@ -235,10 +232,7 @@ export default {
catchMethod: () => this.fetchData()
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.fetchData()
})
},
@ -265,10 +259,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.createfirewallruleresponse.errortext
})
this.$notifyError(error)
this.resetAllRules()
this.fetchData()
})
@ -301,10 +292,7 @@ export default {
}).then(response => {
this.tags = response.listtagsresponse.tag
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
},
@ -339,10 +327,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.createtagsresponse.errortext
})
this.$notifyError(error)
this.closeModal()
}).finally(() => {
this.addTagLoading = false
@ -378,10 +363,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.deletetagsresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
},

View File

@ -267,12 +267,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: this.tabType === 'ingress'
? error.response.data.authorizesecuritygroupingressresponse.errortext
: error.response.data.authorizesecuritygroupegressresponse.errortext
})
this.$notifyError(error)
this.parentToggleLoading()
})
},
@ -304,11 +299,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: this.tabType === 'ingress' ? error.response.data.revokesecuritygroupingressresponse.errortext
: error.response.data.revokesecuritygroupegressresponse.errortext
})
this.$notifyError(error)
this.parentToggleLoading()
})
},
@ -320,10 +311,7 @@ export default {
}).then(response => {
this.tags = response.listtagsresponse.tag
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
})
},
handleDeleteTag (tag) {
@ -361,10 +349,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.deletetagsresponse.errortext
})
this.$notifyError(error)
this.parentToggleLoading()
this.tagsLoading = false
})
@ -412,10 +397,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.createtagsresponse.errortext
})
this.$notifyError(error)
this.parentToggleLoading()
this.tagsLoading = false
})

View File

@ -175,10 +175,7 @@ export default {
this.iLb.vmguestip[index] = this.nics[index][0]
this.addVmModalNicLoading = false
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}` || 'Error',
description: error.response.data.errorresponse.errortext || 'Error'
})
this.$notifyError(error)
this.closeModal()
})
},

View File

@ -466,10 +466,7 @@ export default {
}
this.loading = false
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.loading = false
})
},
@ -483,10 +480,7 @@ export default {
}).then(response => {
this.$set(rule, 'ruleInstances', response.listloadbalancerruleinstancesresponse.lbrulevmidip)
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})
@ -501,10 +495,7 @@ export default {
}).then(response => {
this.stickinessPolicies.push(...response.listlbstickinesspoliciesresponse.stickinesspolicies)
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})
@ -543,10 +534,7 @@ export default {
this.tags = response.listtagsresponse.tag
this.tagsModalLoading = false
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
},
@ -589,10 +577,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.createtagsresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
})
@ -628,10 +613,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.deletetagsresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
},
@ -692,10 +674,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.createLBStickinessPolicy.errortext
})
this.$notifyError(error)
this.closeModal()
})
},
@ -728,10 +707,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
},
@ -800,10 +776,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.fetchData()
})
},
@ -847,10 +820,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.loading = false
this.closeModal()
})
@ -886,10 +856,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.loading = false
this.closeModal()
})
@ -931,10 +898,7 @@ export default {
})
this.addVmModalLoading = false
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
},
@ -962,10 +926,7 @@ export default {
this.newRule.vmguestip[index] = this.nics[index][0]
this.addVmModalNicLoading = false
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
},
@ -1042,10 +1003,7 @@ export default {
this.addVmModalVisible = false
this.handleAssignToLBRule(response.createloadbalancerruleresponse.id)
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.createloadbalancerruleresponse.errortext
})
this.$notifyError(error)
this.loading = false
})

View File

@ -299,10 +299,7 @@ export default {
this.portForwardRules = response.listportforwardingrulesresponse.portforwardingrule || []
this.totalCount = response.listportforwardingrulesresponse.count || 0
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})
@ -321,10 +318,7 @@ export default {
catchMethod: () => this.fetchData()
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.fetchData()
})
},
@ -356,10 +350,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.createportforwardingruleresponse.errortext
})
this.$notifyError(error)
this.closeModal()
this.fetchData()
})
@ -403,10 +394,7 @@ export default {
this.tags = response.listtagsresponse.tag
this.tagsModalLoading = false
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
},
@ -441,10 +429,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.createtagsresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
},
@ -479,10 +464,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.deletetagsresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
},
@ -500,10 +482,7 @@ export default {
this.vms = response.listvirtualmachinesresponse.virtualmachine
this.addVmModalLoading = false
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
},
@ -523,10 +502,7 @@ export default {
this.addVmModalNicLoading = false
}).catch(error => {
console.log(error)
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
},

View File

@ -128,11 +128,7 @@ export default {
api('listRouters', params).then(json => {
this.routers = json.listroutersresponse.router || []
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description'],
duration: 0
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
})

View File

@ -115,10 +115,7 @@ export default {
api('listStaticRoutes', { gatewayid: this.resource.id }).then(json => {
this.routes = json.liststaticroutesresponse.staticroute
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.componentLoading = false
})
@ -156,10 +153,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.headers['x-description']
})
this.$notifyError(error)
this.fetchData()
this.componentLoading = false
})
@ -193,10 +187,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.headers['x-description']
})
this.$notifyError(error)
this.fetchData()
this.componentLoading = false
})
@ -209,10 +200,7 @@ export default {
}).then(response => {
this.tags = response.listtagsresponse.tag
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
})
},
handleDeleteTag (tag) {
@ -243,10 +231,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.deletetagsresponse.errortext
})
this.$notifyError(error)
this.tagsLoading = false
})
},
@ -286,10 +271,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.createtagsresponse.errortext
})
this.$notifyError(error)
this.tagsLoading = false
})
})

View File

@ -408,10 +408,7 @@ export default {
this.privateGateways = json.listprivategatewaysresponse.privategateway
this.itemCounts.privateGateways = json.listprivategatewaysresponse.count
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
})
@ -424,10 +421,7 @@ export default {
}).then(json => {
this.vpnGateways = json.listvpngatewaysresponse.vpngateway ? json.listvpngatewaysresponse.vpngateway : []
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
})
@ -443,10 +437,7 @@ export default {
this.vpnConnections = json.listvpnconnectionsresponse.vpnconnection
this.itemCounts.vpnConnections = json.listvpnconnectionsresponse.count
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
})
@ -467,10 +458,7 @@ export default {
})
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
})
@ -485,10 +473,7 @@ export default {
})
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.modals.gatewayLoading = false
})
@ -503,10 +488,7 @@ export default {
})
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.modals.vpnConnectionLoading = false
})
@ -576,10 +558,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.modals.gatewayLoading = false
this.modals.gateway = false
@ -626,10 +605,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.fetchVpnConnections()
this.fetchLoading = false
@ -671,10 +647,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
this.fetchAclList()
@ -707,10 +680,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
this.handleFetchData()

View File

@ -366,11 +366,7 @@ export default {
})
})
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description'],
duration: 0
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
this.modalLoading = false
@ -392,11 +388,7 @@ export default {
})
})
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description'],
duration: 0
})
this.$notifyError(error)
}).finally(() => {
this.fetchLoading = false
this.modalLoading = false
@ -474,11 +466,7 @@ export default {
})
this.fetchData()
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description'],
duration: 0
})
this.$notifyError(error)
}).finally(() => {
this.fetchData()
})

View File

@ -94,10 +94,7 @@ export default {
? response.listremoteaccessvpnsresponse.remoteaccessvpn[0] : null
}).catch(error => {
console.log(error)
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
})
},
handleCreateVpn () {
@ -137,11 +134,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.createremoteaccessvpnresponse
? error.response.data.createremoteaccessvpnresponse.errortext : error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.fetchData()
this.parentFetchData()
this.parentToggleLoading()
@ -177,11 +170,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.deleteremoteaccessvpnresponse
? error.response.data.deleteremoteaccessvpnresponse.errortext : error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.fetchData()
this.parentFetchData()
this.parentToggleLoading()

View File

@ -833,10 +833,7 @@ export default {
api('createServiceOffering', params).then(json => {
this.$message.success((this.isSystem ? 'Service offering created: ' : 'Compute offering created: ') + values.name)
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
this.$emit('refresh-data')

View File

@ -495,10 +495,7 @@ export default {
api('createDiskOffering', params).then(json => {
this.$message.success(this.$t('message.disk.offering.created', { name: values.name }))
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
this.$emit('refresh-data')

View File

@ -838,10 +838,7 @@ export default {
api('createNetworkOffering', params).then(json => {
this.$message.success('Network offering created: ' + values.name)
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
this.$emit('refresh-data')

View File

@ -368,10 +368,7 @@ export default {
api('createVPCOffering', params).then(json => {
this.$message.success('VPC offering created: ' + values.name)
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
this.$emit('refresh-data')

View File

@ -105,10 +105,7 @@ export default {
this.zones.opts = json.listzonesresponse.zone || []
this.$forceUpdate()
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(f => {
this.zones.loading = false
})
@ -123,10 +120,7 @@ export default {
this.externals.opts = json.listbackupproviderofferingsresponse.backupoffering || []
this.$forceUpdate()
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(f => {
this.externals.loading = false
})
@ -170,10 +164,7 @@ export default {
})
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(f => {
this.loading = false
})

View File

@ -285,10 +285,7 @@ export default {
description: this.$t('label.action.update.offering.access')
})
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
this.closeAction()

View File

@ -44,16 +44,13 @@ export default {
},
methods: {
doSso () {
this.showError = false
api('cloudianSsoLogin').then(json => {
const url = json.cloudianssologinresponse.cloudianssologin.url
const cmcWindow = window.open(url, 'CMCWindow')
cmcWindow.focus()
}).catch(error => {
this.$notification.error({
message: 'Single-Sign-On Failed',
description: error.response.headers['x-description'] || 'Request Failed',
duration: 0
})
this.$notifyError(error)
this.showError = true
})
}

View File

@ -144,10 +144,7 @@ export default {
this.itemCount = itemCount
this.dataSource = listProjectAccount
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})
@ -178,10 +175,7 @@ export default {
}
}).catch(error => {
// show error
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
setTimeout(loading, 1000)
})
@ -217,10 +211,7 @@ export default {
}
}).catch(error => {
// show error
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
setTimeout(loading, 1000)
})

View File

@ -80,10 +80,7 @@ export default {
this.checkForAddAsyncJob(json, title, description)
this.$emit('close-action')
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.$emit('refresh-data')
this.loading = false

View File

@ -179,10 +179,7 @@ export default {
this.dataSource = listProjectInvitations
this.itemCount = itemCount
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
})
@ -237,10 +234,7 @@ export default {
}
}).catch(error => {
// show error
this.$notification.error({
message: 'Request Failed',
description: error.response.headers['x-description']
})
this.$notifyError(error)
}).finally(() => {
setTimeout(loading, 1000)
})

View File

@ -144,10 +144,7 @@ export default {
catchMessage: 'Error encountered while fetching async job result'
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
}).finally(() => {
this.loading = false
this.$emit('refresh-data')

View File

@ -370,10 +370,7 @@ export default {
})
this.resetForm()
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.actionLoading = false
})

View File

@ -91,10 +91,7 @@ export default {
this.storagePools = response.findstoragepoolsformigrationresponse.storagepool || []
this.selectedStoragePool = this.storagePools[0].id || ''
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
} else {
@ -104,10 +101,7 @@ export default {
this.storagePools = response.liststoragepoolsresponse.storagepool || []
this.selectedStoragePool = this.storagePools[0].id || ''
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
}
@ -119,10 +113,7 @@ export default {
this.diskOfferings = response.listdiskofferingsresponse.diskoffering
this.selectedDiskOffering = this.diskOfferings[0].id
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
},
@ -158,10 +149,7 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
message: `Error ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
this.$notifyError(error)
this.closeModal()
})
}

View File

@ -101,10 +101,7 @@ export default {
this.virtualMachineOptions.opts = json.listvirtualmachinesresponse.virtualmachine || []
this.$forceUpdate()
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.virtualMachineOptions.loading = false
})
@ -162,10 +159,7 @@ export default {
})
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.actionLoading = false
})

View File

@ -170,10 +170,7 @@ export default {
this.$emit('refresh')
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
}).finally(() => {
this.actionLoading = false
})

View File

@ -183,10 +183,7 @@ export default {
})
}
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
this.$notifyError(error)
})
})
},