mirror of https://github.com/apache/cloudstack.git
ui: refactoring $notification according to the old version (#5819)
Related to PR #5549 changed the notification from $notification to $showNotification. This PR aims to change it back to the way it was for easier use while keeping the delete all button.
This commit is contained in:
parent
5f93bc8948
commit
4392cc4d48
|
|
@ -219,8 +219,7 @@ export default {
|
|||
apiName = 'updateTemplate'
|
||||
}
|
||||
if (!(apiName in this.$store.getters.apis)) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('error.execute.api.failed') + ' ' + apiName,
|
||||
description: this.$t('message.user.not.permitted.api')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -514,8 +514,7 @@ export default {
|
|||
json.updateconfigurationresponse.configuration &&
|
||||
!json.updateconfigurationresponse.configuration.isdynamic &&
|
||||
['Admin'].includes(this.$store.getters.userInfo.roletype)) {
|
||||
this.$showNotification({
|
||||
type: 'warning',
|
||||
this.$notification.warning({
|
||||
message: this.$t('label.status'),
|
||||
description: this.$t('message.restart.mgmt.server')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -107,8 +107,7 @@ export default {
|
|||
this.dataResource = await this.listResourceLimits(params)
|
||||
this.formLoading = false
|
||||
} catch (e) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: e
|
||||
})
|
||||
|
|
|
|||
|
|
@ -164,8 +164,7 @@ export default {
|
|||
}).catch(error => {
|
||||
console.error(error)
|
||||
this.$message.error(this.$t('message.error.save.setting'))
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('label.error'),
|
||||
description: this.$t('message.error.try.save.setting')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -234,15 +234,13 @@ export default {
|
|||
}).then(json => {
|
||||
console.log(this.resource)
|
||||
if (json?.uploadresourceiconresponse?.success) {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.upload.icon'),
|
||||
description: `${this.$t('message.success.upload.icon')} ${resourceType}: ` + (this.resource.name || this.resource.username || resourceid)
|
||||
})
|
||||
}
|
||||
}).catch((error) => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('label.upload.icon'),
|
||||
description: error?.response?.data?.uploadresourceiconresponse?.errortext || '',
|
||||
duration: 0
|
||||
|
|
@ -266,15 +264,13 @@ export default {
|
|||
resourceids: resourceid
|
||||
}).then(json => {
|
||||
if (json?.deleteresourceiconresponse?.success) {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.delete.icon'),
|
||||
description: `${this.$t('message.success.delete.icon')} ${resourceType}: ` + (this.resource.name || this.resource.username || resourceid)
|
||||
})
|
||||
}
|
||||
}).catch((error) => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('label.delete.icon'),
|
||||
description: error?.response?.data?.deleteresourceiconresponse?.errortext || '',
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -152,8 +152,7 @@ export default {
|
|||
const vm = result.jobresult.virtualmachine || {}
|
||||
if (result.jobstatus === 1 && vm.password) {
|
||||
const name = vm.displayname || vm.name || vm.id
|
||||
obj.$showNotification({
|
||||
type: 'success',
|
||||
obj.$notification.success({
|
||||
message: `${obj.$t('label.reinstall.vm')}: ` + name,
|
||||
description: `${obj.$t('label.password.reset.confirm')}: ` + vm.password,
|
||||
duration: 0
|
||||
|
|
@ -362,8 +361,7 @@ export default {
|
|||
const vm = result.jobresult.virtualmachine || {}
|
||||
if (result.jobstatus === 1 && vm.password) {
|
||||
const name = vm.displayname || vm.name || vm.id
|
||||
obj.$showNotification({
|
||||
type: 'success',
|
||||
obj.$notification.success({
|
||||
message: `${obj.$t('label.reset.ssh.key.pair.on.vm')}: ` + name,
|
||||
description: `${obj.$t('label.password.reset.confirm')}: ` + vm.password,
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -122,7 +122,6 @@ Vue.use(VueCropper)
|
|||
|
||||
Vue.prototype.$confirm = Modal.confirm
|
||||
Vue.prototype.$message = message
|
||||
Vue.prototype.$notification = notification
|
||||
Vue.prototype.$info = Modal.info
|
||||
Vue.prototype.$success = Modal.success
|
||||
Vue.prototype.$error = Modal.error
|
||||
|
|
|
|||
|
|
@ -237,33 +237,47 @@ export const notifierPlugin = {
|
|||
})
|
||||
}
|
||||
|
||||
Vue.prototype.$showNotification = function (config) {
|
||||
let countNotify = store.getters.countNotify
|
||||
countNotify++
|
||||
store.commit('SET_COUNT_NOTIFY', countNotify)
|
||||
const defaultConfig = {
|
||||
Vue.prototype.$notification = {
|
||||
defaultConfig: {
|
||||
top: '65px',
|
||||
onClose: () => {
|
||||
let countNotify = store.getters.countNotify
|
||||
countNotify > 0 ? countNotify-- : countNotify = 0
|
||||
store.commit('SET_COUNT_NOTIFY', countNotify)
|
||||
}
|
||||
}
|
||||
config = Object.assign({}, defaultConfig, config)
|
||||
switch (config.type) {
|
||||
case 'info':
|
||||
notification.info(config)
|
||||
break
|
||||
case 'error':
|
||||
notification.error(config)
|
||||
break
|
||||
case 'success':
|
||||
notification.success(config)
|
||||
break
|
||||
case 'warning':
|
||||
notification.warning(config)
|
||||
break
|
||||
}
|
||||
},
|
||||
setCountNotify: () => {
|
||||
let countNotify = store.getters.countNotify
|
||||
countNotify++
|
||||
store.commit('SET_COUNT_NOTIFY', countNotify)
|
||||
},
|
||||
info: (config) => {
|
||||
Vue.prototype.$notification.setCountNotify()
|
||||
config = Object.assign({}, Vue.prototype.$notification.defaultConfig, config)
|
||||
notification.info(config)
|
||||
},
|
||||
error: (config) => {
|
||||
Vue.prototype.$notification.setCountNotify()
|
||||
config = Object.assign({}, Vue.prototype.$notification.defaultConfig, config)
|
||||
notification.error(config)
|
||||
},
|
||||
success: (config) => {
|
||||
Vue.prototype.$notification.setCountNotify()
|
||||
config = Object.assign({}, Vue.prototype.$notification.defaultConfig, config)
|
||||
notification.success(config)
|
||||
},
|
||||
warning: (config) => {
|
||||
Vue.prototype.$notification.setCountNotify()
|
||||
config = Object.assign({}, Vue.prototype.$notification.defaultConfig, config)
|
||||
notification.warning(config)
|
||||
},
|
||||
warn: (config) => {
|
||||
Vue.prototype.$notification.setCountNotify()
|
||||
config = Object.assign({}, Vue.prototype.$notification.defaultConfig, config)
|
||||
notification.warn(config)
|
||||
},
|
||||
close: (key) => notification.close(key),
|
||||
destroy: () => notification.destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1128,8 +1128,7 @@ export default {
|
|||
if (action.response) {
|
||||
const description = action.response(result.jobresult)
|
||||
if (description) {
|
||||
this.$showNotification({
|
||||
type: 'info',
|
||||
this.$notification.info({
|
||||
message: this.$t(action.label),
|
||||
description: (<span domPropsInnerHTML={description}></span>),
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -294,8 +294,7 @@ export default {
|
|||
[variableKey]: variableValue,
|
||||
networkids: this.selectedNetwork
|
||||
}).then(response => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.loadbalancerinstance')
|
||||
})
|
||||
this.$parent.$parent.close()
|
||||
|
|
|
|||
|
|
@ -149,8 +149,7 @@ export default {
|
|||
id: this.resource.id,
|
||||
affinitygroupids: this.selectedRowKeys.join(',')
|
||||
}).then(response => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('message.success.change.affinity.group')
|
||||
})
|
||||
this.$parent.$parent.close()
|
||||
|
|
|
|||
|
|
@ -198,8 +198,7 @@ export default {
|
|||
this.hiddenElement.click()
|
||||
},
|
||||
notifyCopied () {
|
||||
this.$showNotification({
|
||||
type: 'info',
|
||||
this.$notification.info({
|
||||
message: this.$t('message.success.copy.clipboard')
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -141,8 +141,7 @@ export default {
|
|||
const volumeId = result.jobresult.snapshot.volumeid
|
||||
const snapshotId = result.jobresult.snapshot.id
|
||||
const message = `${this.$t('label.create.snapshot.for.volume')} ${volumeId} ${this.$t('label.with.snapshotid')} ${snapshotId}`
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: message,
|
||||
duration: 0
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1491,7 +1491,7 @@ export default {
|
|||
this.form.validateFieldsAndScroll(options, async (err, values) => {
|
||||
if (err) {
|
||||
if (err.licensesaccepted) {
|
||||
this.$showNotification({
|
||||
this.$notification.error({
|
||||
type: 'error',
|
||||
message: this.$t('message.license.agreements.not.accepted'),
|
||||
description: this.$t('message.step.license.agreements.continue')
|
||||
|
|
@ -1499,8 +1499,7 @@ export default {
|
|||
return
|
||||
}
|
||||
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: this.$t('error.form.message')
|
||||
})
|
||||
|
|
@ -1508,31 +1507,27 @@ export default {
|
|||
}
|
||||
|
||||
if (!values.templateid && !values.isoid) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: this.$t('message.template.iso')
|
||||
})
|
||||
return
|
||||
} else if (values.isoid && (!values.diskofferingid || values.diskofferingid === '0')) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: this.$t('message.step.3.continue')
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!values.computeofferingid) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: this.$t('message.step.2.continue')
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.error) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: this.$t('error.form.message')
|
||||
})
|
||||
|
|
@ -1645,8 +1640,7 @@ export default {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: this.$t('message.step.4.continue')
|
||||
})
|
||||
|
|
@ -1708,8 +1702,7 @@ export default {
|
|||
const vm = result.jobresult.virtualmachine
|
||||
const name = vm.displayname || vm.name || vm.id
|
||||
if (vm.password) {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.error({
|
||||
message: password + ` ${this.$t('label.for')} ` + name,
|
||||
description: vm.password,
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -321,8 +321,7 @@ export default {
|
|||
config.configdata !== '') {
|
||||
this.clusterConfig = config.configdata
|
||||
} else {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: this.$t('message.error.retrieve.kubeconfig')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -220,8 +220,7 @@ export default {
|
|||
})
|
||||
this.$emit('close-action')
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -166,8 +166,7 @@ export default {
|
|||
this.$pollJob({
|
||||
jobId,
|
||||
successMethod: result => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('message.success.change.offering')
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -143,8 +143,7 @@ export default {
|
|||
api('listPods', params).then(json => {
|
||||
this.pods = json.listpodsresponse.pod || []
|
||||
if (this.pods.length === 0) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: 'No pods found',
|
||||
duration: 0
|
||||
})
|
||||
|
|
@ -163,8 +162,7 @@ export default {
|
|||
api('listClusters', params).then(json => {
|
||||
this.clusters = json.listclustersresponse.cluster || []
|
||||
if (this.clusters.length === 0) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: 'No clusters found',
|
||||
duration: 0
|
||||
})
|
||||
|
|
@ -186,8 +184,7 @@ export default {
|
|||
api('listHosts', params).then(json => {
|
||||
this.hosts = json.listhostsresponse.host || []
|
||||
if (this.hosts.length === 0) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: 'No hosts found',
|
||||
duration: 0
|
||||
})
|
||||
|
|
|
|||
|
|
@ -157,8 +157,7 @@ export default {
|
|||
this.actionLoading = true
|
||||
api('deleteBackupSchedule', params).then(json => {
|
||||
if (json.deletebackupscheduleresponse.success) {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.scheduled.backups'),
|
||||
description: this.$t('message.success.delete.backup.schedule')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -284,8 +284,7 @@ export default {
|
|||
}
|
||||
this.actionLoading = true
|
||||
api('createBackupSchedule', params).then(json => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.scheduled.backups'),
|
||||
description: this.$t('message.success.config.backup.schedule')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -266,8 +266,7 @@ export default {
|
|||
this.domainsList = response.listdomainsresponse.domain || []
|
||||
this.selectedDomain = this.domainsList[0].id || ''
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.errorresponse.errortext
|
||||
})
|
||||
|
|
@ -342,8 +341,7 @@ export default {
|
|||
|
||||
api('createAccount', {}, 'POST', params).then(response => {
|
||||
this.$emit('refresh-data')
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.create.account'),
|
||||
description: `${this.$t('message.success.create.account')} ${params.username}`
|
||||
})
|
||||
|
|
@ -355,14 +353,12 @@ export default {
|
|||
entityid: values.samlentity,
|
||||
userid: users[i].id
|
||||
}).then(response => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.samlenable'),
|
||||
description: this.$t('message.success.enable.saml.auth')
|
||||
})
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
|
||||
duration: 0
|
||||
|
|
@ -372,8 +368,7 @@ export default {
|
|||
}
|
||||
this.closeAction()
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -410,15 +410,13 @@ export default {
|
|||
this.authorizeUsersForSamlSSO(users, entityId)
|
||||
}
|
||||
} else if (apiName === 'importLdapUsers' && response.ldapuserresponse && values.samlEnable) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: this.$t('message.error.enable.saml')
|
||||
})
|
||||
} else {
|
||||
if (apiName === 'ldapCreateAccount') {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.add.ldap.account'),
|
||||
description: response.createaccountresponse.account.name
|
||||
})
|
||||
|
|
|
|||
|
|
@ -238,8 +238,7 @@ export default {
|
|||
this.domainsList = response.listdomainsresponse.domain || []
|
||||
this.selectedDomain = this.domainsList[0].id || ''
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.errorresponse.errortext
|
||||
})
|
||||
|
|
@ -253,8 +252,7 @@ export default {
|
|||
api('listAccounts', { listAll: true, showicon: true }).then(response => {
|
||||
this.accountList = response.listaccountsresponse.account || []
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.errorresponse.errortext
|
||||
})
|
||||
|
|
@ -321,8 +319,7 @@ export default {
|
|||
|
||||
api('createUser', {}, 'POST', params).then(response => {
|
||||
this.$emit('refresh-data')
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.create.user'),
|
||||
description: `${this.$t('message.success.create.user')} ${params.username}`
|
||||
})
|
||||
|
|
@ -333,14 +330,12 @@ export default {
|
|||
entityid: values.samlentity,
|
||||
userid: user.id
|
||||
}).then(response => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.samlenable'),
|
||||
description: this.$t('message.success.enable.saml.auth')
|
||||
})
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
|
||||
duration: 0
|
||||
|
|
@ -349,8 +344,7 @@ export default {
|
|||
}
|
||||
this.closeAction()
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -128,8 +128,7 @@ export default {
|
|||
params.currentpassword = values.currentpassword
|
||||
}
|
||||
api('updateUser', {}, 'POST', params).then(json => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.action.change.password'),
|
||||
description: `${this.$t('message.success.change.password')} ${this.resource.username}`
|
||||
})
|
||||
|
|
|
|||
|
|
@ -108,16 +108,14 @@ export default {
|
|||
userid: this.resource.id,
|
||||
entityid: values.samlEntity
|
||||
}).then(response => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: values.samlEnable ? this.$t('label.saml.enable') : this.$t('label.saml.disable'),
|
||||
description: values.samlEnable ? `${this.$t('message.success.enable.saml.auth')} ${this.$t('label.for')} ${this.resource.username}`
|
||||
: `${this.$t('message.success.disable.saml.auth')} ${this.$t('label.for')} ${this.resource.username}`
|
||||
})
|
||||
this.handleClose()
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -174,8 +174,7 @@ export default {
|
|||
const role = json.createroleresponse.role
|
||||
if (role) {
|
||||
this.$emit('refresh-data')
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: 'Create Role',
|
||||
description: 'Sucessfully created role ' + params.name
|
||||
})
|
||||
|
|
|
|||
|
|
@ -253,8 +253,7 @@ export default {
|
|||
if (this.action.response) {
|
||||
const description = this.action.response(result.jobresult)
|
||||
if (description) {
|
||||
this.$showNotification({
|
||||
type: 'info',
|
||||
this.$notification.info({
|
||||
message: this.$t(this.action.label),
|
||||
description: (<span domPropsInnerHTML={description}></span>),
|
||||
duration: 0
|
||||
|
|
@ -290,8 +289,7 @@ export default {
|
|||
}
|
||||
this.parentCloseAction()
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
|
||||
})
|
||||
|
|
|
|||
|
|
@ -187,8 +187,7 @@ export default {
|
|||
return
|
||||
}
|
||||
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: error.response.headers['x-description'],
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -178,15 +178,13 @@ export default {
|
|||
|
||||
api('updateUser', params).then(response => {
|
||||
this.$emit('refresh-data')
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.edit.user'),
|
||||
description: `${this.$t('message.success.update.user')} ${params.username}`
|
||||
})
|
||||
this.closeAction()
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -128,8 +128,7 @@ export default {
|
|||
},
|
||||
handleChange (info) {
|
||||
if (info.file.status === 'error') {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('label.error.file.upload'),
|
||||
description: this.$t('label.error.file.upload')
|
||||
})
|
||||
|
|
@ -186,8 +185,7 @@ export default {
|
|||
const role = json.importroleresponse.role
|
||||
if (role) {
|
||||
this.$emit('refresh-data')
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: 'Import Role',
|
||||
description: 'Sucessfully imported role ' + params.name
|
||||
})
|
||||
|
|
|
|||
|
|
@ -455,8 +455,7 @@ export default {
|
|||
catchMessage: this.$t('error.fetching.async.job.result')
|
||||
})
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
|
||||
})
|
||||
|
|
|
|||
|
|
@ -265,8 +265,7 @@ export default {
|
|||
handleUpload () {
|
||||
const { fileList } = this
|
||||
if (this.fileList.length > 1) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.upload.iso.failed'),
|
||||
description: this.$t('message.error.upload.iso.description'),
|
||||
duration: 0
|
||||
|
|
@ -291,16 +290,14 @@ export default {
|
|||
},
|
||||
timeout: 86400000
|
||||
}).then((json) => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('message.success.upload'),
|
||||
description: this.$t('message.success.upload.description')
|
||||
})
|
||||
this.closeAction()
|
||||
this.$emit('refresh-data')
|
||||
}).catch(e => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.upload.failed'),
|
||||
description: `${this.$t('message.upload.iso.failed.description')} - ${e}`,
|
||||
duration: 0
|
||||
|
|
@ -345,8 +342,7 @@ export default {
|
|||
if (this.currentForm === 'Create') {
|
||||
this.loading = true
|
||||
api('registerIso', params).then(json => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.action.register.iso'),
|
||||
description: `${this.$t('message.success.register.iso')} ${params.name}`
|
||||
})
|
||||
|
|
@ -367,8 +363,7 @@ export default {
|
|||
this.uploadParams = (json.postuploadisoresponse && json.postuploadisoresponse.getuploadparams) ? json.postuploadisoresponse.getuploadparams : ''
|
||||
const response = this.handleUpload()
|
||||
if (response === 'upload successful') {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('message.success.upload'),
|
||||
description: this.$t('message.success.upload.iso.description')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -511,16 +511,14 @@ export default {
|
|||
},
|
||||
timeout: 86400000
|
||||
}).then((json) => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('message.success.upload'),
|
||||
description: this.$t('message.success.upload.template.description')
|
||||
})
|
||||
this.$emit('refresh-data')
|
||||
this.closeAction()
|
||||
}).catch(e => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.upload.failed'),
|
||||
description: `${this.$t('message.upload.template.failed.description')} - ${e}`,
|
||||
duration: 0
|
||||
|
|
@ -889,8 +887,7 @@ export default {
|
|||
if (this.currentForm === 'Create') {
|
||||
this.loading = true
|
||||
api('registerTemplate', params).then(json => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.register.template'),
|
||||
description: `${this.$t('message.success.register.template')} ${params.name}`
|
||||
})
|
||||
|
|
@ -904,8 +901,7 @@ export default {
|
|||
} else {
|
||||
this.loading = true
|
||||
if (this.fileList.length > 1) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.error.upload.template'),
|
||||
description: this.$t('message.error.upload.template.description'),
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -554,8 +554,7 @@ export default {
|
|||
catchMessage: this.$t('error.fetching.async.job.result')
|
||||
})
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
|
||||
})
|
||||
|
|
|
|||
|
|
@ -289,8 +289,7 @@ export default {
|
|||
featured: this.resource.featured,
|
||||
op: this.selectedOperation.toLowerCase()
|
||||
}).then(response => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: `${this.$t('label.success.updated')} ${resourceType} ${this.$t('label.permissions')}`
|
||||
})
|
||||
this.closeModal()
|
||||
|
|
|
|||
|
|
@ -709,8 +709,7 @@ export default {
|
|||
}
|
||||
this.loading = true
|
||||
api('createStoragePool', {}, 'POST', params).then(json => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.add.primary.storage'),
|
||||
description: this.$t('label.add.primary.storage')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -293,8 +293,7 @@ export default {
|
|||
|
||||
this.loading = true
|
||||
api('addImageStore', data).then(json => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.add.secondary.storage'),
|
||||
description: this.$t('label.add.secondary.storage')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -257,8 +257,7 @@ export default {
|
|||
}
|
||||
this.addCluster()
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.listvmwaredcsresponse.errortext,
|
||||
duration: 0
|
||||
|
|
@ -309,8 +308,7 @@ export default {
|
|||
this.parentToggleLoading()
|
||||
this.$parent.$parent.close()
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.addclusterresponse.errortext,
|
||||
duration: 0
|
||||
|
|
@ -345,8 +343,7 @@ export default {
|
|||
}
|
||||
})
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.errorresponse.errortext,
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -362,8 +362,7 @@ export default {
|
|||
this.parentFetchData()
|
||||
this.$parent.$parent.close()
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.addhostresponse.errortext,
|
||||
duration: 0
|
||||
|
|
@ -398,8 +397,7 @@ export default {
|
|||
}
|
||||
})
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.errorresponse.errortext,
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -241,14 +241,12 @@ export default {
|
|||
const result = json.queryasyncjobresultresponse
|
||||
if (result.jobstatus === 1 && this.maxCerts === count) {
|
||||
this.$message.success(`${this.$t('label.certificate.upload')}: ${result.jobresult.customcertificate.message}`)
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.certificate.upload'),
|
||||
description: result.jobresult.customcertificate.message || this.$t('message.success.certificate.upload')
|
||||
})
|
||||
} else if (result.jobstatus === 2) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('label.certificate.upload.failed'),
|
||||
description: result.jobresult.errortext || this.$t('label.certificate.upload.failed.description'),
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -154,14 +154,12 @@ export default {
|
|||
const success = result.imagestore.success || false
|
||||
const message = result.imagestore.message || ''
|
||||
if (success) {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: title,
|
||||
description: message
|
||||
})
|
||||
} else {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: title,
|
||||
description: message,
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -207,8 +207,7 @@ export default {
|
|||
this.parentFetchData()
|
||||
this.$parent.$parent.close()
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.createpodresponse.errortext,
|
||||
duration: 0
|
||||
|
|
@ -243,8 +242,7 @@ export default {
|
|||
}
|
||||
})
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.errorresponse.errortext,
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -254,8 +254,7 @@ export default {
|
|||
this.items = response.listdedicatedguestvlanrangesresponse.dedicatedguestvlanrange || []
|
||||
this.totalCount = response.listdedicatedguestvlanrangesresponse.count || 0
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.errorresponse.errortext,
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -133,8 +133,7 @@ export default {
|
|||
this.traffictype = this.trafficTypes[0].traffictype || undefined
|
||||
})
|
||||
.catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.errorresponse.errortext
|
||||
})
|
||||
|
|
|
|||
|
|
@ -504,8 +504,7 @@ export default {
|
|||
handleDeleteIpRange (id) {
|
||||
this.componentLoading = true
|
||||
api('deleteVlanIpRange', { id }).then(() => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: 'Removed IP Range'
|
||||
})
|
||||
}).catch(error => {
|
||||
|
|
@ -541,13 +540,11 @@ export default {
|
|||
params.networkid = this.network.id
|
||||
}
|
||||
api('createVlanIpRange', params).then(() => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('message.success.add.iprange')
|
||||
})
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.createvlaniprangeresponse
|
||||
? error.response.data.createvlaniprangeresponse.errortext : error.response.data.errorresponse.errortext,
|
||||
|
|
@ -575,13 +572,11 @@ export default {
|
|||
forsystemvms: values.forsystemvms
|
||||
}
|
||||
api('updateVlanIpRange', params).then(() => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('message.success.update.iprange')
|
||||
})
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.updatevlaniprangeresponse
|
||||
? error.response.data.updatevlaniprangeresponse.errortext : error.response.data.errorresponse.errortext,
|
||||
|
|
|
|||
|
|
@ -1219,8 +1219,7 @@ export default {
|
|||
this.onCloseAction()
|
||||
} catch (error) {
|
||||
this.actionLoading = false
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: error
|
||||
})
|
||||
|
|
@ -1356,8 +1355,7 @@ export default {
|
|||
this.onCloseAction()
|
||||
} catch (message) {
|
||||
this.actionLoading = false
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: message
|
||||
})
|
||||
|
|
|
|||
|
|
@ -253,8 +253,7 @@ export default {
|
|||
this.loading = false
|
||||
} catch (error) {
|
||||
this.loading = false
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
|
||||
})
|
||||
|
|
|
|||
|
|
@ -288,8 +288,7 @@ export default {
|
|||
this.loading = false
|
||||
} catch (error) {
|
||||
this.loading = false
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
|
||||
})
|
||||
|
|
|
|||
|
|
@ -160,8 +160,7 @@ export default {
|
|||
this.loading = false
|
||||
} catch (error) {
|
||||
this.loading = false
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
|
||||
})
|
||||
|
|
|
|||
|
|
@ -377,8 +377,7 @@ export default {
|
|||
this.loading = false
|
||||
} catch (error) {
|
||||
this.loading = false
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
|
||||
})
|
||||
|
|
|
|||
|
|
@ -322,8 +322,7 @@ export default {
|
|||
this.loading = false
|
||||
} catch (error) {
|
||||
this.loading = false
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
|
||||
})
|
||||
|
|
|
|||
|
|
@ -188,8 +188,7 @@ export default {
|
|||
this.listData[args.title].loading = false
|
||||
} catch (error) {
|
||||
this.listData[args.title].loading = false
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
|
||||
})
|
||||
|
|
|
|||
|
|
@ -300,8 +300,7 @@ export default {
|
|||
this.actionLoading = false
|
||||
} catch (error) {
|
||||
this.actionLoading = false
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
|
||||
})
|
||||
|
|
@ -337,8 +336,7 @@ export default {
|
|||
this.actionLoading = false
|
||||
} catch (error) {
|
||||
this.actionLoading = false
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1547,8 +1547,7 @@ export default {
|
|||
this.$emit('refresh-data')
|
||||
} catch (e) {
|
||||
this.loading = false
|
||||
await this.$showNotification({
|
||||
type: 'error',
|
||||
await this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: e
|
||||
})
|
||||
|
|
|
|||
|
|
@ -571,8 +571,7 @@ export default {
|
|||
data.aclid = this.resource.id
|
||||
|
||||
api('createNetworkACL', {}, 'POST', data).then(() => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.success'),
|
||||
description: this.$t('message.success.add.rule')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -442,8 +442,7 @@ export default {
|
|||
}
|
||||
}
|
||||
api('createNetwork', params).then(json => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: 'Network',
|
||||
description: this.$t('message.success.create.isolated.network')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -393,8 +393,7 @@ export default {
|
|||
}
|
||||
}
|
||||
api('createNetwork', params).then(json => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: 'Network',
|
||||
description: this.$t('message.success.create.l2.network')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -703,8 +703,7 @@ export default {
|
|||
!this.isValidTextValueForKey(values, 'ip6gateway') && !this.isValidTextValueForKey(values, 'ip6cidr') &&
|
||||
!this.isValidTextValueForKey(values, 'startipv6') && !this.isValidTextValueForKey(values, 'endipv6'))
|
||||
) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: this.$t('message.error.add.guest.network')
|
||||
})
|
||||
|
|
@ -789,8 +788,7 @@ export default {
|
|||
params.hideipaddressusage = true
|
||||
}
|
||||
api('createNetwork', params).then(json => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.network'),
|
||||
description: this.$t('message.success.add.guest.network')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -248,15 +248,13 @@ export default {
|
|||
|
||||
api('createVlanIpRange', params)
|
||||
.then(() => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('message.success.add.iprange')
|
||||
})
|
||||
this.closeAction()
|
||||
this.$emit('refresh-data')
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.createvlaniprangeresponse
|
||||
? error.response.data.createvlaniprangeresponse.errortext : error.response.data.errorresponse.errortext,
|
||||
|
|
|
|||
|
|
@ -223,8 +223,7 @@ export default {
|
|||
})
|
||||
this.closeModal()
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.errorresponse.errortext,
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -359,8 +359,7 @@ export default {
|
|||
})
|
||||
this.onCloseModal()
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.errorresponse.errortext,
|
||||
duration: 0
|
||||
|
|
@ -427,8 +426,7 @@ export default {
|
|||
})
|
||||
}).catch(error => {
|
||||
this.fetchLoading = false
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.errorresponse.errortext,
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -664,8 +664,7 @@ export default {
|
|||
}
|
||||
|
||||
api('createNetwork', params).then(() => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('message.success.add.vpc.network')
|
||||
})
|
||||
}).catch(error => {
|
||||
|
|
|
|||
|
|
@ -132,8 +132,7 @@ export default {
|
|||
jobId: response.createremoteaccessvpnresponse.jobid,
|
||||
successMethod: result => {
|
||||
const res = result.jobresult.remoteaccessvpn
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.status'),
|
||||
description:
|
||||
`${this.$t('message.enabled.vpn')} ${res.publicip}. ${this.$t('message.enabled.vpn.ip.sec')} ${res.presharedkey}`,
|
||||
|
|
|
|||
|
|
@ -297,8 +297,7 @@ export default {
|
|||
this.loading = true
|
||||
api('update' + this.offeringType, params).then(json => {
|
||||
this.$emit('refresh-data')
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.action.update.offering.access'),
|
||||
description: this.$t('label.action.update.offering.access')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -125,8 +125,7 @@ export default {
|
|||
this.$message.success(`${this.$t('message.setting.updated')} ${this.resource.description}`)
|
||||
this.onClose()
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
|
||||
})
|
||||
|
|
|
|||
|
|
@ -229,8 +229,7 @@ export default {
|
|||
params[key] = input
|
||||
}
|
||||
api('updateProjectRole', params).then(response => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.update.project.role'),
|
||||
description: this.$t('label.update.project.role')
|
||||
})
|
||||
|
|
@ -269,8 +268,7 @@ export default {
|
|||
params[key] = input
|
||||
}
|
||||
api('createProjectRole', params).then(response => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.create.project.role'),
|
||||
description: this.$t('label.create.project.role')
|
||||
})
|
||||
|
|
@ -289,8 +287,7 @@ export default {
|
|||
projectid: this.resource.id,
|
||||
id: role.id
|
||||
}).then(response => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.delete.project.role'),
|
||||
description: this.$t('label.delete.project.role')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -385,8 +385,7 @@ export default {
|
|||
this.actionLoading = true
|
||||
api('createSnapshotPolicy', params).then(json => {
|
||||
this.$emit('refresh')
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.action.recurring.snapshot'),
|
||||
description: this.$t('message.success.recurring.snapshot')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -125,8 +125,7 @@ export default {
|
|||
})
|
||||
this.closeModal()
|
||||
}).catch(error => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: `${this.$t('label.error')} ${error.response.status}`,
|
||||
description: error.response.data.errorresponse.errortext,
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -162,8 +162,7 @@ export default {
|
|||
this.actionLoading = true
|
||||
api('deleteSnapshotPolicies', params).then(json => {
|
||||
if (json.deletesnapshotpoliciesresponse.success) {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('label.delete.snapshot.policy'),
|
||||
description: this.$t('message.success.delete.snapshot.policy')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -191,8 +191,7 @@ export default {
|
|||
this.uploadParams = (json.postuploadvolumeresponse && json.postuploadvolumeresponse.getuploadparams) ? json.postuploadvolumeresponse.getuploadparams : ''
|
||||
const { fileList } = this
|
||||
if (this.fileList.length > 1) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.upload.volume.failed'),
|
||||
description: this.$t('message.upload.file.limit'),
|
||||
duration: 0
|
||||
|
|
@ -217,15 +216,13 @@ export default {
|
|||
},
|
||||
timeout: 86400000
|
||||
}).then((json) => {
|
||||
this.$showNotification({
|
||||
type: 'success',
|
||||
this.$notification.success({
|
||||
message: this.$t('message.success.upload'),
|
||||
description: this.$t('message.success.upload.volume.description')
|
||||
})
|
||||
this.closeAction()
|
||||
}).catch(e => {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.upload.failed'),
|
||||
description: `${this.$t('message.upload.iso.failed.description')} - ${e}`,
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -631,8 +631,7 @@ export default {
|
|||
displayname: values.displayname
|
||||
}
|
||||
if (!this.computeOffering || !this.computeOffering.id) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: this.$t('message.step.2.continue')
|
||||
})
|
||||
|
|
@ -643,8 +642,7 @@ export default {
|
|||
var details = [this.cpuNumberKey, this.cpuSpeedKey, this.memoryKey]
|
||||
for (var detail of details) {
|
||||
if (!(values[detail] || this.computeOffering[detail])) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: this.$t('message.please.enter.valid.value') + ': ' + this.$t('label.' + detail.toLowerCase())
|
||||
})
|
||||
|
|
@ -659,8 +657,7 @@ export default {
|
|||
var iopsDetails = [this.minIopsKey, this.maxIopsKey]
|
||||
for (var iopsDetail of iopsDetails) {
|
||||
if (!values[iopsDetail] || values[iopsDetail] < 0) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: this.$t('message.please.enter.valid.value') + ': ' + this.$t('label.' + iopsDetail.toLowerCase())
|
||||
})
|
||||
|
|
@ -669,8 +666,7 @@ export default {
|
|||
params['details[0].' + iopsDetail] = values[iopsDetail]
|
||||
}
|
||||
if (values[this.minIopsKey] > values[this.maxIopsKey]) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: this.$t('error.form.message')
|
||||
})
|
||||
|
|
@ -688,8 +684,7 @@ export default {
|
|||
var diskOfferingIndex = 0
|
||||
for (var diskId in this.dataDisksOfferingsMapping) {
|
||||
if (!this.dataDisksOfferingsMapping[diskId]) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: this.$t('message.select.disk.offering') + ': ' + diskId
|
||||
})
|
||||
|
|
@ -703,8 +698,7 @@ export default {
|
|||
var nicIpIndex = 0
|
||||
for (var nicId in this.nicsNetworksMapping) {
|
||||
if (!this.nicsNetworksMapping[nicId].network) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: this.$t('message.select.nic.network') + ': ' + nicId
|
||||
})
|
||||
|
|
@ -715,8 +709,7 @@ export default {
|
|||
nicNetworkIndex++
|
||||
if ('ipAddress' in this.nicsNetworksMapping[nicId]) {
|
||||
if (!this.nicsNetworksMapping[nicId].ipAddress) {
|
||||
this.$showNotification({
|
||||
type: 'error',
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
description: this.$t('message.enter.valid.nic.ip') + ': ' + nicId
|
||||
})
|
||||
|
|
|
|||
|
|
@ -52,14 +52,20 @@ mocks = {
|
|||
$notifyError: jest.fn((error) => {
|
||||
return error
|
||||
}),
|
||||
$showNotification: jest.fn((option) => {
|
||||
return {
|
||||
type: option.type,
|
||||
message: option.message,
|
||||
description: 'test-description',
|
||||
duration: option.duration
|
||||
}
|
||||
}),
|
||||
$notification: {
|
||||
error: jest.fn((option) => {
|
||||
return option
|
||||
}),
|
||||
info: jest.fn((option) => {
|
||||
return option
|
||||
}),
|
||||
success: jest.fn((option) => {
|
||||
return option
|
||||
}),
|
||||
warning: jest.fn((option) => {
|
||||
return option
|
||||
})
|
||||
},
|
||||
$message: {
|
||||
success: jest.fn((obj) => {
|
||||
return obj
|
||||
|
|
@ -1570,7 +1576,7 @@ describe('Views > AutogenView.vue', () => {
|
|||
})
|
||||
|
||||
describe('pollActionCompletion()', () => {
|
||||
it('check $showNotification when pollActionCompletion() is called with action is empty', (done) => {
|
||||
it('check $notification when pollActionCompletion() is called with action is empty', (done) => {
|
||||
const mockData = {
|
||||
queryasyncjobresultresponse: {
|
||||
jobstatus: 1,
|
||||
|
|
@ -1588,7 +1594,7 @@ describe('Views > AutogenView.vue', () => {
|
|||
wrapper.vm.pollActionCompletion(jobId, action)
|
||||
|
||||
setTimeout(() => {
|
||||
expect(mocks.$showNotification).not.toHaveBeenCalled()
|
||||
expect(mocks.$notification.info).not.toHaveBeenCalled()
|
||||
expect(mockAxios).toHaveBeenCalled()
|
||||
expect(mockAxios).toHaveBeenCalledWith({
|
||||
url: '/',
|
||||
|
|
@ -1605,7 +1611,7 @@ describe('Views > AutogenView.vue', () => {
|
|||
})
|
||||
})
|
||||
|
||||
it('check $showNotification when pollActionCompletion() is called with action is not empty', (done) => {
|
||||
it('check $notification when pollActionCompletion() is called with action is not empty', (done) => {
|
||||
const mockData = {
|
||||
queryasyncjobresultresponse: {
|
||||
jobstatus: 1,
|
||||
|
|
@ -1626,9 +1632,8 @@ describe('Views > AutogenView.vue', () => {
|
|||
wrapper.vm.pollActionCompletion(jobId, action)
|
||||
|
||||
setTimeout(() => {
|
||||
expect(mocks.$showNotification).toHaveBeenCalled()
|
||||
expect(mocks.$showNotification).toHaveLastReturnedWith({
|
||||
type: 'info',
|
||||
expect(mocks.$notification.info).toHaveBeenCalled()
|
||||
expect(mocks.$notification.info).toHaveLastReturnedWith({
|
||||
message: 'test-name-en',
|
||||
description: 'test-description',
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -29,7 +29,20 @@ mocks = {
|
|||
$message: {
|
||||
error: jest.fn((message) => {})
|
||||
},
|
||||
$showNotification: jest.fn((obj) => {}),
|
||||
$notification: {
|
||||
error: jest.fn((option) => {
|
||||
return option
|
||||
}),
|
||||
info: jest.fn((option) => {
|
||||
return option
|
||||
}),
|
||||
success: jest.fn((option) => {
|
||||
return option
|
||||
}),
|
||||
warning: jest.fn((option) => {
|
||||
return option
|
||||
})
|
||||
},
|
||||
$pollJob: jest.fn((obj) => {
|
||||
switch (obj.jobId) {
|
||||
case 'test-job-id-case-1':
|
||||
|
|
@ -752,9 +765,8 @@ describe('Views > compute > MigrateWizard.vue', () => {
|
|||
await wrapper.vm.submitForm()
|
||||
|
||||
setTimeout(() => {
|
||||
expect(mocks.$showNotification).toHaveBeenCalled()
|
||||
expect(mocks.$showNotification).toHaveBeenCalledWith({
|
||||
type: 'error',
|
||||
expect(mocks.$notification.error).toHaveBeenCalled()
|
||||
expect(mocks.$notification.error).toHaveBeenCalledWith({
|
||||
message: i18n.t('message.request.failed'),
|
||||
description: 'Error: throw error message',
|
||||
duration: 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue