ui: Add clear all notification button (#5549)

* add clear all notification button

* change position set count notify

* get notification count

* set label transliteration

* add margin for notification

* change position of clear notification button
This commit is contained in:
Hoang Nguyen 2021-12-30 17:54:17 +07:00 committed by GitHub
parent 5eccbc9521
commit eb04a46541
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
82 changed files with 467 additions and 168 deletions

View File

@ -577,6 +577,7 @@
"label.cks.cluster.size": "Cluster size (Worker nodes)",
"label.cleanup": "Clean up",
"label.clear": "Clear",
"label.clear.notification": "Clear notification",
"label.clear.list": "Clear list",
"label.close": "Close",
"label.cloud.console": "Cloud Management Console",

View File

@ -84,7 +84,8 @@ export default {
},
data () {
return {
image: ''
image: '',
countNotify: 0
}
},
created () {
@ -92,6 +93,12 @@ export default {
eventBus.$on('refresh-header', () => {
this.getIcon()
})
this.$store.watch(
(state, getters) => getters.countNotify,
(newValue, oldValue) => {
this.countNotify = newValue
}
)
},
watch: {
image () {
@ -137,6 +144,10 @@ export default {
description: err.message
})
})
},
clearAllNotify () {
this.$store.commit('SET_COUNT_NOTIFY', 0)
this.$notification.destroy()
}
}
}

View File

@ -91,6 +91,13 @@
/>
</a-affix>
<a-button
v-if="showClear"
type="default"
size="small"
class="button-clear-notification"
@click="onClearNotification">{{ $t('label.clear.notification') }}</a-button>
<!-- layout content -->
<a-layout-content class="layout-content" :class="{'is-header-fixed': fixedHeader}">
<slot></slot>
@ -128,7 +135,8 @@ export default {
return {
collapsed: false,
menus: [],
showSetting: false
showSetting: false,
showClear: false
}
},
computed: {
@ -161,6 +169,12 @@ export default {
} else {
document.body.classList.remove('dark-mode')
}
},
'$store.getters.countNotify' (countNotify) {
this.showClear = false
if (countNotify && countNotify > 0) {
this.showClear = true
}
}
},
provide: function () {
@ -212,6 +226,10 @@ export default {
},
toggleSetting (showSetting) {
this.showSetting = showSetting
},
onClearNotification () {
this.$notification.destroy()
this.$store.commit('SET_COUNT_NOTIFY', 0)
}
}
}

View File

@ -219,7 +219,8 @@ export default {
apiName = 'updateTemplate'
}
if (!(apiName in this.$store.getters.apis)) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('error.execute.api.failed') + ' ' + apiName,
description: this.$t('message.user.not.permitted.api')
})

View File

@ -514,7 +514,8 @@ export default {
json.updateconfigurationresponse.configuration &&
!json.updateconfigurationresponse.configuration.isdynamic &&
['Admin'].includes(this.$store.getters.userInfo.roletype)) {
this.$notification.warning({
this.$showNotification({
type: 'warning',
message: this.$t('label.status'),
description: this.$t('message.restart.mgmt.server')
})

View File

@ -107,7 +107,8 @@ export default {
this.dataResource = await this.listResourceLimits(params)
this.formLoading = false
} catch (e) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: e
})

View File

@ -164,7 +164,8 @@ export default {
}).catch(error => {
console.error(error)
this.$message.error(this.$t('message.error.save.setting'))
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('label.error'),
description: this.$t('message.error.try.save.setting')
})

View File

@ -234,13 +234,15 @@ export default {
}).then(json => {
console.log(this.resource)
if (json?.uploadresourceiconresponse?.success) {
this.$notification.success({
this.$showNotification({
type: '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.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('label.upload.icon'),
description: error?.response?.data?.uploadresourceiconresponse?.errortext || '',
duration: 0
@ -264,13 +266,15 @@ export default {
resourceids: resourceid
}).then(json => {
if (json?.deleteresourceiconresponse?.success) {
this.$notification.success({
this.$showNotification({
type: '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.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('label.delete.icon'),
description: error?.response?.data?.deleteresourceiconresponse?.errortext || '',
duration: 0

View File

@ -152,7 +152,8 @@ export default {
const vm = result.jobresult.virtualmachine || {}
if (result.jobstatus === 1 && vm.password) {
const name = vm.displayname || vm.name || vm.id
obj.$notification.success({
obj.$showNotification({
type: 'success',
message: `${obj.$t('label.reinstall.vm')}: ` + name,
description: `${obj.$t('label.password.reset.confirm')}: ` + vm.password,
duration: 0
@ -361,7 +362,8 @@ export default {
const vm = result.jobresult.virtualmachine || {}
if (result.jobstatus === 1 && vm.password) {
const name = vm.displayname || vm.name || vm.id
obj.$notification.success({
obj.$showNotification({
type: 'success',
message: `${obj.$t('label.reset.ssh.key.pair.on.vm')}: ` + name,
description: `${obj.$t('label.password.reset.confirm')}: ` + vm.password,
duration: 0

View File

@ -17,6 +17,12 @@
<template>
<div id="userLayout" :class="['user-layout', device]">
<a-button
v-if="showClear"
type="default"
size="small"
class="button-clear-notification"
@click="onClearNotification">{{ $t('label.clear.notification') }}</a-button>
<div class="user-layout-container">
<div class="user-layout-header">
<img
@ -48,7 +54,9 @@ export default {
components: { RouteView },
mixins: [mixinDevice],
data () {
return {}
return {
showClear: false
}
},
watch: {
'$store.getters.darkMode' (darkMode) {
@ -57,6 +65,12 @@ export default {
} else {
document.body.classList.remove('dark-mode')
}
},
'$store.getters.countNotify' (countNotify) {
this.showClear = false
if (countNotify && countNotify > 0) {
this.showClear = true
}
}
},
mounted () {
@ -69,6 +83,12 @@ export default {
beforeDestroy () {
document.body.classList.remove('userLayout')
document.body.classList.remove('dark-mode')
},
methods: {
onClearNotification () {
this.$notification.destroy()
this.$store.commit('SET_COUNT_NOTIFY', 0)
}
}
}
</script>

View File

@ -78,10 +78,19 @@ router.beforeEach((to, from, next) => {
})
})
.catch(() => {
let countNotify = store.getters.countNotify
countNotify++
store.commit('SET_COUNT_NOTIFY', countNotify)
notification.error({
top: '65px',
message: 'Error',
description: i18n.t('message.error.discovering.feature'),
duration: 0
duration: 0,
onClose: () => {
let countNotify = store.getters.countNotify
countNotify > 0 ? countNotify-- : countNotify = 0
store.commit('SET_COUNT_NOTIFY', countNotify)
}
})
store.dispatch('Logout').then(() => {
next({ path: '/user/login', query: { redirect: to.fullPath } })

View File

@ -40,7 +40,8 @@ const getters = {
domainStore: state => state.user.domainStore,
darkMode: state => state.user.darkMode,
themeSetting: state => state.user.themeSetting,
defaultListViewPageSize: state => state.user.defaultListViewPageSize
defaultListViewPageSize: state => state.user.defaultListViewPageSize,
countNotify: state => state.user.countNotify
}
export default getters

View File

@ -55,7 +55,8 @@ const user = {
domainStore: {},
darkMode: false,
themeSetting: {},
defaultListViewPageSize: 20
defaultListViewPageSize: 20,
countNotify: 0
},
mutations: {
@ -121,6 +122,9 @@ const user = {
},
SET_DEFAULT_LISTVIEW_PAGE_SIZE: (state, defaultListViewPageSize) => {
state.defaultListViewPageSize = defaultListViewPageSize
},
SET_COUNT_NOTIFY (state, number) {
state.countNotify = number
}
},

View File

@ -901,4 +901,8 @@
.ant-empty-normal {
color: @dark-text-color-3;
}
.button-clear-notification {
background-color: @dark-secondary-bgColor;
}
}

View File

@ -344,3 +344,10 @@ a {
border-color: @primary-color;
}
}
.button-clear-notification {
position: fixed;
right: 287px;
top: 35px;
z-index: 1001;
}

View File

@ -132,11 +132,20 @@ export const pollJobPlugin = {
desc = `(${name}) ${desc}`
}
if (!bulkAction) {
let countNotify = store.getters.countNotify
countNotify++
store.commit('SET_COUNT_NOTIFY', countNotify)
notification.error({
top: '65px',
message: errMessage,
description: desc,
key: jobId,
duration: 0
duration: 0,
onClose: () => {
let countNotify = store.getters.countNotify
countNotify > 0 ? countNotify-- : countNotify = 0
store.commit('SET_COUNT_NOTIFY', countNotify)
}
})
}
store.dispatch('AddHeaderNotice', {
@ -168,10 +177,19 @@ export const pollJobPlugin = {
}
}).catch(e => {
console.error(`${catchMessage} - ${e}`)
let countNotify = store.getters.countNotify
countNotify++
store.commit('SET_COUNT_NOTIFY', countNotify)
notification.error({
top: '65px',
message: i18n.t('label.error'),
description: catchMessage,
duration: 0
duration: 0,
onClose: () => {
let countNotify = store.getters.countNotify
countNotify > 0 ? countNotify-- : countNotify = 0
store.commit('SET_COUNT_NOTIFY', countNotify)
}
})
catchMethod && catchMethod()
})
@ -203,12 +221,50 @@ export const notifierPlugin = {
}
}
}
let countNotify = store.getters.countNotify
countNotify++
store.commit('SET_COUNT_NOTIFY', countNotify)
notification.error({
top: '65px',
message: msg,
description: desc,
duration: 0
duration: 0,
onClose: () => {
let countNotify = store.getters.countNotify
countNotify > 0 ? countNotify-- : countNotify = 0
store.commit('SET_COUNT_NOTIFY', countNotify)
}
})
}
Vue.prototype.$showNotification = function (config) {
let countNotify = store.getters.countNotify
countNotify++
store.commit('SET_COUNT_NOTIFY', countNotify)
const 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
}
}
}
}

View File

@ -30,11 +30,23 @@ const service = axios.create({
const err = (error) => {
const response = error.response
let countNotify = store.getters.countNotify
if (response) {
console.log(response)
if (response.status === 403) {
const data = response.data
notification.error({ message: i18n.t('label.forbidden'), description: data.message })
countNotify++
store.commit('SET_COUNT_NOTIFY', countNotify)
notification.error({
top: '65px',
message: i18n.t('label.forbidden'),
description: data.message,
onClose: () => {
let countNotify = store.getters.countNotify
countNotify > 0 ? countNotify-- : countNotify = 0
store.commit('SET_COUNT_NOTIFY', countNotify)
}
})
}
if (response.status === 401) {
if (response.config && response.config.params && ['listIdps', 'cloudianIsEnabled'].includes(response.config.params.command)) {
@ -43,20 +55,36 @@ const err = (error) => {
for (const key in response.data) {
if (key.includes('response')) {
if (response.data[key].errortext.includes('not available for user')) {
countNotify++
store.commit('SET_COUNT_NOTIFY', countNotify)
notification.error({
top: '65px',
message: 'Error',
description: response.data[key].errortext + ' ' + i18n.t('error.unable.to.proceed'),
duration: 0
duration: 0,
onClose: () => {
let countNotify = store.getters.countNotify
countNotify > 0 ? countNotify-- : countNotify = 0
store.commit('SET_COUNT_NOTIFY', countNotify)
}
})
return
}
}
}
countNotify++
store.commit('SET_COUNT_NOTIFY', countNotify)
notification.error({
top: '65px',
message: i18n.t('label.unauthorized'),
description: i18n.t('message.authorization.failed'),
key: 'http-401',
duration: 0
duration: 0,
onClose: () => {
let countNotify = store.getters.countNotify
countNotify > 0 ? countNotify-- : countNotify = 0
store.commit('SET_COUNT_NOTIFY', countNotify)
}
})
store.dispatch('Logout').then(() => {
if (router.history.current.path !== '/user/login') {
@ -65,15 +93,34 @@ const err = (error) => {
})
}
if (response.status === 404) {
notification.error({ message: i18n.t('label.not.found'), description: i18n.t('message.resource.not.found') })
countNotify++
store.commit('SET_COUNT_NOTIFY', countNotify)
notification.error({
top: '65px',
message: i18n.t('label.not.found'),
description: i18n.t('message.resource.not.found'),
onClose: () => {
let countNotify = store.getters.countNotify
countNotify > 0 ? countNotify-- : countNotify = 0
store.commit('SET_COUNT_NOTIFY', countNotify)
}
})
router.push({ path: '/exception/404' })
}
}
if (error.isAxiosError && !error.response) {
countNotify++
store.commit('SET_COUNT_NOTIFY', countNotify)
notification.warn({
top: '65px',
message: error.message || i18n.t('message.network.error'),
description: i18n.t('message.network.error.description'),
key: 'network-error'
key: 'network-error',
onClose: () => {
let countNotify = store.getters.countNotify
countNotify > 0 ? countNotify-- : countNotify = 0
store.commit('SET_COUNT_NOTIFY', countNotify)
}
})
}
return Promise.reject(error)

View File

@ -1128,7 +1128,8 @@ export default {
if (action.response) {
const description = action.response(result.jobresult)
if (description) {
this.$notification.info({
this.$showNotification({
type: 'info',
message: this.$t(action.label),
description: (<span domPropsInnerHTML={description}></span>),
duration: 0

View File

@ -294,7 +294,8 @@ export default {
[variableKey]: variableValue,
networkids: this.selectedNetwork
}).then(response => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.loadbalancerinstance')
})
this.$parent.$parent.close()

View File

@ -149,7 +149,8 @@ export default {
id: this.resource.id,
affinitygroupids: this.selectedRowKeys.join(',')
}).then(response => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('message.success.change.affinity.group')
})
this.$parent.$parent.close()

View File

@ -198,7 +198,8 @@ export default {
this.hiddenElement.click()
},
notifyCopied () {
this.$notification.info({
this.$showNotification({
type: 'info',
message: this.$t('message.success.copy.clipboard')
})
},

View File

@ -141,7 +141,8 @@ 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.$notification.success({
this.$showNotification({
type: 'success',
message: message,
duration: 0
})

View File

@ -1491,14 +1491,16 @@ export default {
this.form.validateFieldsAndScroll(options, async (err, values) => {
if (err) {
if (err.licensesaccepted) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.license.agreements.not.accepted'),
description: this.$t('message.step.license.agreements.continue')
})
return
}
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: this.$t('error.form.message')
})
@ -1506,27 +1508,31 @@ export default {
}
if (!values.templateid && !values.isoid) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: this.$t('message.template.iso')
})
return
} else if (values.isoid && (!values.diskofferingid || values.diskofferingid === '0')) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: this.$t('message.step.3.continue')
})
return
}
if (!values.computeofferingid) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: this.$t('message.step.2.continue')
})
return
}
if (this.error) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: this.$t('error.form.message')
})
@ -1639,7 +1645,8 @@ export default {
}
}
} else {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: this.$t('message.step.4.continue')
})
@ -1701,7 +1708,8 @@ export default {
const vm = result.jobresult.virtualmachine
const name = vm.displayname || vm.name || vm.id
if (vm.password) {
this.$notification.success({
this.$showNotification({
type: 'success',
message: password + ` ${this.$t('label.for')} ` + name,
description: vm.password,
duration: 0

View File

@ -321,7 +321,8 @@ export default {
config.configdata !== '') {
this.clusterConfig = config.configdata
} else {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: this.$t('message.error.retrieve.kubeconfig')
})

View File

@ -220,7 +220,8 @@ export default {
})
this.$emit('close-action')
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
duration: 0

View File

@ -166,7 +166,8 @@ export default {
this.$pollJob({
jobId,
successMethod: result => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('message.success.change.offering')
})
},

View File

@ -143,7 +143,8 @@ export default {
api('listPods', params).then(json => {
this.pods = json.listpodsresponse.pod || []
if (this.pods.length === 0) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: 'No pods found',
duration: 0
})
@ -162,7 +163,8 @@ export default {
api('listClusters', params).then(json => {
this.clusters = json.listclustersresponse.cluster || []
if (this.clusters.length === 0) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: 'No clusters found',
duration: 0
})
@ -184,7 +186,8 @@ export default {
api('listHosts', params).then(json => {
this.hosts = json.listhostsresponse.host || []
if (this.hosts.length === 0) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: 'No hosts found',
duration: 0
})

View File

@ -157,7 +157,8 @@ export default {
this.actionLoading = true
api('deleteBackupSchedule', params).then(json => {
if (json.deletebackupscheduleresponse.success) {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.scheduled.backups'),
description: this.$t('message.success.delete.backup.schedule')
})

View File

@ -284,7 +284,8 @@ export default {
}
this.actionLoading = true
api('createBackupSchedule', params).then(json => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.scheduled.backups'),
description: this.$t('message.success.config.backup.schedule')
})

View File

@ -266,7 +266,8 @@ export default {
this.domainsList = response.listdomainsresponse.domain || []
this.selectedDomain = this.domainsList[0].id || ''
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
@ -341,7 +342,8 @@ export default {
api('createAccount', {}, 'POST', params).then(response => {
this.$emit('refresh-data')
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.create.account'),
description: `${this.$t('message.success.create.account')} ${params.username}`
})
@ -353,12 +355,14 @@ export default {
entityid: values.samlentity,
userid: users[i].id
}).then(response => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.samlenable'),
description: this.$t('message.success.enable.saml.auth')
})
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
duration: 0
@ -368,7 +372,8 @@ export default {
}
this.closeAction()
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
duration: 0

View File

@ -410,13 +410,15 @@ export default {
this.authorizeUsersForSamlSSO(users, entityId)
}
} else if (apiName === 'importLdapUsers' && response.ldapuserresponse && values.samlEnable) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: this.$t('message.error.enable.saml')
})
} else {
if (apiName === 'ldapCreateAccount') {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.add.ldap.account'),
description: response.createaccountresponse.account.name
})

View File

@ -238,7 +238,8 @@ export default {
this.domainsList = response.listdomainsresponse.domain || []
this.selectedDomain = this.domainsList[0].id || ''
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
@ -252,7 +253,8 @@ export default {
api('listAccounts', { listAll: true, showicon: true }).then(response => {
this.accountList = response.listaccountsresponse.account || []
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})
@ -319,7 +321,8 @@ export default {
api('createUser', {}, 'POST', params).then(response => {
this.$emit('refresh-data')
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.create.user'),
description: `${this.$t('message.success.create.user')} ${params.username}`
})
@ -330,12 +333,14 @@ export default {
entityid: values.samlentity,
userid: user.id
}).then(response => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.samlenable'),
description: this.$t('message.success.enable.saml.auth')
})
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
duration: 0
@ -344,7 +349,8 @@ export default {
}
this.closeAction()
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
duration: 0

View File

@ -128,7 +128,8 @@ export default {
params.currentpassword = values.currentpassword
}
api('updateUser', {}, 'POST', params).then(json => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.action.change.password'),
description: `${this.$t('message.success.change.password')} ${this.resource.username}`
})

View File

@ -108,14 +108,16 @@ export default {
userid: this.resource.id,
entityid: values.samlEntity
}).then(response => {
this.$notification.success({
this.$showNotification({
type: '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.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
duration: 0

View File

@ -174,7 +174,8 @@ export default {
const role = json.createroleresponse.role
if (role) {
this.$emit('refresh-data')
this.$notification.success({
this.$showNotification({
type: 'success',
message: 'Create Role',
description: 'Sucessfully created role ' + params.name
})

View File

@ -253,7 +253,8 @@ export default {
if (this.action.response) {
const description = this.action.response(result.jobresult)
if (description) {
this.$notification.info({
this.$showNotification({
type: 'info',
message: this.$t(this.action.label),
description: (<span domPropsInnerHTML={description}></span>),
duration: 0
@ -289,7 +290,8 @@ export default {
}
this.parentCloseAction()
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})

View File

@ -187,7 +187,8 @@ export default {
return
}
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: error.response.headers['x-description'],
duration: 0

View File

@ -178,13 +178,15 @@ export default {
api('updateUser', params).then(response => {
this.$emit('refresh-data')
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.edit.user'),
description: `${this.$t('message.success.update.user')} ${params.username}`
})
this.closeAction()
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message,
duration: 0

View File

@ -128,7 +128,8 @@ export default {
},
handleChange (info) {
if (info.file.status === 'error') {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('label.error.file.upload'),
description: this.$t('label.error.file.upload')
})
@ -185,7 +186,8 @@ export default {
const role = json.importroleresponse.role
if (role) {
this.$emit('refresh-data')
this.$notification.success({
this.$showNotification({
type: 'success',
message: 'Import Role',
description: 'Sucessfully imported role ' + params.name
})

View File

@ -455,7 +455,8 @@ export default {
catchMessage: this.$t('error.fetching.async.job.result')
})
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})

View File

@ -265,7 +265,8 @@ export default {
handleUpload () {
const { fileList } = this
if (this.fileList.length > 1) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.upload.iso.failed'),
description: this.$t('message.error.upload.iso.description'),
duration: 0
@ -290,14 +291,16 @@ export default {
},
timeout: 86400000
}).then((json) => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('message.success.upload'),
description: this.$t('message.success.upload.description')
})
this.closeAction()
this.$emit('refresh-data')
}).catch(e => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.upload.failed'),
description: `${this.$t('message.upload.iso.failed.description')} - ${e}`,
duration: 0
@ -342,7 +345,8 @@ export default {
if (this.currentForm === 'Create') {
this.loading = true
api('registerIso', params).then(json => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.action.register.iso'),
description: `${this.$t('message.success.register.iso')} ${params.name}`
})
@ -363,7 +367,8 @@ export default {
this.uploadParams = (json.postuploadisoresponse && json.postuploadisoresponse.getuploadparams) ? json.postuploadisoresponse.getuploadparams : ''
const response = this.handleUpload()
if (response === 'upload successful') {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('message.success.upload'),
description: this.$t('message.success.upload.iso.description')
})

View File

@ -511,14 +511,16 @@ export default {
},
timeout: 86400000
}).then((json) => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('message.success.upload'),
description: this.$t('message.success.upload.template.description')
})
this.$emit('refresh-data')
this.closeAction()
}).catch(e => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.upload.failed'),
description: `${this.$t('message.upload.template.failed.description')} - ${e}`,
duration: 0
@ -887,7 +889,8 @@ export default {
if (this.currentForm === 'Create') {
this.loading = true
api('registerTemplate', params).then(json => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.register.template'),
description: `${this.$t('message.success.register.template')} ${params.name}`
})
@ -901,7 +904,8 @@ export default {
} else {
this.loading = true
if (this.fileList.length > 1) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.error.upload.template'),
description: this.$t('message.error.upload.template.description'),
duration: 0

View File

@ -554,7 +554,8 @@ export default {
catchMessage: this.$t('error.fetching.async.job.result')
})
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})

View File

@ -289,7 +289,8 @@ export default {
featured: this.resource.featured,
op: this.selectedOperation.toLowerCase()
}).then(response => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: `${this.$t('label.success.updated')} ${resourceType} ${this.$t('label.permissions')}`
})
this.closeModal()

View File

@ -709,7 +709,8 @@ export default {
}
this.loading = true
api('createStoragePool', {}, 'POST', params).then(json => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.add.primary.storage'),
description: this.$t('label.add.primary.storage')
})

View File

@ -293,7 +293,8 @@ export default {
this.loading = true
api('addImageStore', data).then(json => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.add.secondary.storage'),
description: this.$t('label.add.secondary.storage')
})

View File

@ -257,7 +257,8 @@ export default {
}
this.addCluster()
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.listvmwaredcsresponse.errortext,
duration: 0
@ -308,7 +309,8 @@ export default {
this.parentToggleLoading()
this.$parent.$parent.close()
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.addclusterresponse.errortext,
duration: 0
@ -343,7 +345,8 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.errorresponse.errortext,
duration: 0

View File

@ -362,7 +362,8 @@ export default {
this.parentFetchData()
this.$parent.$parent.close()
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.addhostresponse.errortext,
duration: 0
@ -397,7 +398,8 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.errorresponse.errortext,
duration: 0

View File

@ -241,12 +241,14 @@ 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.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.certificate.upload'),
description: result.jobresult.customcertificate.message || this.$t('message.success.certificate.upload')
})
} else if (result.jobstatus === 2) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('label.certificate.upload.failed'),
description: result.jobresult.errortext || this.$t('label.certificate.upload.failed.description'),
duration: 0

View File

@ -154,12 +154,14 @@ export default {
const success = result.imagestore.success || false
const message = result.imagestore.message || ''
if (success) {
this.$notification.success({
this.$showNotification({
type: 'success',
message: title,
description: message
})
} else {
this.$notification.error({
this.$showNotification({
type: 'error',
message: title,
description: message,
duration: 0

View File

@ -207,7 +207,8 @@ export default {
this.parentFetchData()
this.$parent.$parent.close()
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.createpodresponse.errortext,
duration: 0
@ -242,7 +243,8 @@ export default {
}
})
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.errorresponse.errortext,
duration: 0

View File

@ -254,7 +254,8 @@ export default {
this.items = response.listdedicatedguestvlanrangesresponse.dedicatedguestvlanrange || []
this.totalCount = response.listdedicatedguestvlanrangesresponse.count || 0
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.errorresponse.errortext,
duration: 0

View File

@ -133,7 +133,8 @@ export default {
this.traffictype = this.trafficTypes[0].traffictype || undefined
})
.catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.errorresponse.errortext
})

View File

@ -504,7 +504,8 @@ export default {
handleDeleteIpRange (id) {
this.componentLoading = true
api('deleteVlanIpRange', { id }).then(() => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: 'Removed IP Range'
})
}).catch(error => {
@ -540,11 +541,13 @@ export default {
params.networkid = this.network.id
}
api('createVlanIpRange', params).then(() => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('message.success.add.iprange')
})
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.createvlaniprangeresponse
? error.response.data.createvlaniprangeresponse.errortext : error.response.data.errorresponse.errortext,
@ -572,11 +575,13 @@ export default {
forsystemvms: values.forsystemvms
}
api('updateVlanIpRange', params).then(() => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('message.success.update.iprange')
})
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.updatevlaniprangeresponse
? error.response.data.updatevlaniprangeresponse.errortext : error.response.data.errorresponse.errortext,

View File

@ -1219,7 +1219,8 @@ export default {
this.onCloseAction()
} catch (error) {
this.actionLoading = false
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: error
})
@ -1355,7 +1356,8 @@ export default {
this.onCloseAction()
} catch (message) {
this.actionLoading = false
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: message
})

View File

@ -253,7 +253,8 @@ export default {
this.loading = false
} catch (error) {
this.loading = false
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})

View File

@ -288,7 +288,8 @@ export default {
this.loading = false
} catch (error) {
this.loading = false
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})

View File

@ -160,7 +160,8 @@ export default {
this.loading = false
} catch (error) {
this.loading = false
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})

View File

@ -377,7 +377,8 @@ export default {
this.loading = false
} catch (error) {
this.loading = false
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})

View File

@ -322,7 +322,8 @@ export default {
this.loading = false
} catch (error) {
this.loading = false
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})

View File

@ -188,7 +188,8 @@ export default {
this.listData[args.title].loading = false
} catch (error) {
this.listData[args.title].loading = false
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})

View File

@ -300,7 +300,8 @@ export default {
this.actionLoading = false
} catch (error) {
this.actionLoading = false
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})
@ -336,7 +337,8 @@ export default {
this.actionLoading = false
} catch (error) {
this.actionLoading = false
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})

View File

@ -1547,7 +1547,8 @@ export default {
this.$emit('refresh-data')
} catch (e) {
this.loading = false
await this.$notification.error({
await this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: e
})

View File

@ -571,7 +571,8 @@ export default {
data.aclid = this.resource.id
api('createNetworkACL', {}, 'POST', data).then(() => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.success'),
description: this.$t('message.success.add.rule')
})

View File

@ -442,7 +442,8 @@ export default {
}
}
api('createNetwork', params).then(json => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: 'Network',
description: this.$t('message.success.create.isolated.network')
})

View File

@ -393,7 +393,8 @@ export default {
}
}
api('createNetwork', params).then(json => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: 'Network',
description: this.$t('message.success.create.l2.network')
})

View File

@ -703,7 +703,8 @@ export default {
!this.isValidTextValueForKey(values, 'ip6gateway') && !this.isValidTextValueForKey(values, 'ip6cidr') &&
!this.isValidTextValueForKey(values, 'startipv6') && !this.isValidTextValueForKey(values, 'endipv6'))
) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: this.$t('message.error.add.guest.network')
})
@ -788,7 +789,8 @@ export default {
params.hideipaddressusage = true
}
api('createNetwork', params).then(json => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.network'),
description: this.$t('message.success.add.guest.network')
})

View File

@ -248,13 +248,15 @@ export default {
api('createVlanIpRange', params)
.then(() => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('message.success.add.iprange')
})
this.closeAction()
this.$emit('refresh-data')
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.createvlaniprangeresponse
? error.response.data.createvlaniprangeresponse.errortext : error.response.data.errorresponse.errortext,

View File

@ -223,7 +223,8 @@ export default {
})
this.closeModal()
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.errorresponse.errortext,
duration: 0

View File

@ -359,7 +359,8 @@ export default {
})
this.onCloseModal()
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.errorresponse.errortext,
duration: 0
@ -426,7 +427,8 @@ export default {
})
}).catch(error => {
this.fetchLoading = false
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.errorresponse.errortext,
duration: 0

View File

@ -664,7 +664,8 @@ export default {
}
api('createNetwork', params).then(() => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('message.success.add.vpc.network')
})
}).catch(error => {

View File

@ -132,7 +132,8 @@ export default {
jobId: response.createremoteaccessvpnresponse.jobid,
successMethod: result => {
const res = result.jobresult.remoteaccessvpn
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.status'),
description:
`${this.$t('message.enabled.vpn')} ${res.publicip}. ${this.$t('message.enabled.vpn.ip.sec')} ${res.presharedkey}`,

View File

@ -297,7 +297,8 @@ export default {
this.loading = true
api('update' + this.offeringType, params).then(json => {
this.$emit('refresh-data')
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.action.update.offering.access'),
description: this.$t('label.action.update.offering.access')
})

View File

@ -125,7 +125,8 @@ export default {
this.$message.success(`${this.$t('message.setting.updated')} ${this.resource.description}`)
this.onClose()
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: (error.response && error.response.headers && error.response.headers['x-description']) || error.message
})

View File

@ -229,7 +229,8 @@ export default {
params[key] = input
}
api('updateProjectRole', params).then(response => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.update.project.role'),
description: this.$t('label.update.project.role')
})
@ -268,7 +269,8 @@ export default {
params[key] = input
}
api('createProjectRole', params).then(response => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.create.project.role'),
description: this.$t('label.create.project.role')
})
@ -287,7 +289,8 @@ export default {
projectid: this.resource.id,
id: role.id
}).then(response => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.delete.project.role'),
description: this.$t('label.delete.project.role')
})

View File

@ -385,7 +385,8 @@ export default {
this.actionLoading = true
api('createSnapshotPolicy', params).then(json => {
this.$emit('refresh')
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.action.recurring.snapshot'),
description: this.$t('message.success.recurring.snapshot')
})

View File

@ -125,7 +125,8 @@ export default {
})
this.closeModal()
}).catch(error => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.errorresponse.errortext,
duration: 0

View File

@ -162,7 +162,8 @@ export default {
this.actionLoading = true
api('deleteSnapshotPolicies', params).then(json => {
if (json.deletesnapshotpoliciesresponse.success) {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('label.delete.snapshot.policy'),
description: this.$t('message.success.delete.snapshot.policy')
})

View File

@ -191,7 +191,8 @@ export default {
this.uploadParams = (json.postuploadvolumeresponse && json.postuploadvolumeresponse.getuploadparams) ? json.postuploadvolumeresponse.getuploadparams : ''
const { fileList } = this
if (this.fileList.length > 1) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.upload.volume.failed'),
description: this.$t('message.upload.file.limit'),
duration: 0
@ -216,13 +217,15 @@ export default {
},
timeout: 86400000
}).then((json) => {
this.$notification.success({
this.$showNotification({
type: 'success',
message: this.$t('message.success.upload'),
description: this.$t('message.success.upload.volume.description')
})
this.closeAction()
}).catch(e => {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.upload.failed'),
description: `${this.$t('message.upload.iso.failed.description')} - ${e}`,
duration: 0

View File

@ -631,7 +631,8 @@ export default {
displayname: values.displayname
}
if (!this.computeOffering || !this.computeOffering.id) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: this.$t('message.step.2.continue')
})
@ -642,7 +643,8 @@ export default {
var details = [this.cpuNumberKey, this.cpuSpeedKey, this.memoryKey]
for (var detail of details) {
if (!(values[detail] || this.computeOffering[detail])) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: this.$t('message.please.enter.valid.value') + ': ' + this.$t('label.' + detail.toLowerCase())
})
@ -657,7 +659,8 @@ export default {
var iopsDetails = [this.minIopsKey, this.maxIopsKey]
for (var iopsDetail of iopsDetails) {
if (!values[iopsDetail] || values[iopsDetail] < 0) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: this.$t('message.please.enter.valid.value') + ': ' + this.$t('label.' + iopsDetail.toLowerCase())
})
@ -666,7 +669,8 @@ export default {
params['details[0].' + iopsDetail] = values[iopsDetail]
}
if (values[this.minIopsKey] > values[this.maxIopsKey]) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: this.$t('error.form.message')
})
@ -684,7 +688,8 @@ export default {
var diskOfferingIndex = 0
for (var diskId in this.dataDisksOfferingsMapping) {
if (!this.dataDisksOfferingsMapping[diskId]) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: this.$t('message.select.disk.offering') + ': ' + diskId
})
@ -698,7 +703,8 @@ export default {
var nicIpIndex = 0
for (var nicId in this.nicsNetworksMapping) {
if (!this.nicsNetworksMapping[nicId].network) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: this.$t('message.select.nic.network') + ': ' + nicId
})
@ -709,7 +715,8 @@ export default {
nicNetworkIndex++
if ('ipAddress' in this.nicsNetworksMapping[nicId]) {
if (!this.nicsNetworksMapping[nicId].ipAddress) {
this.$notification.error({
this.$showNotification({
type: 'error',
message: this.$t('message.request.failed'),
description: this.$t('message.enter.valid.nic.ip') + ': ' + nicId
})

View File

@ -52,21 +52,14 @@ mocks = {
$notifyError: jest.fn((error) => {
return error
}),
$notification: {
info: jest.fn((option) => {
return {
message: option.message,
description: 'test-description',
duration: option.duration
}
}),
success: jest.fn((option) => {
return {
message: option.message,
description: option.description
}
})
},
$showNotification: jest.fn((option) => {
return {
type: option.type,
message: option.message,
description: 'test-description',
duration: option.duration
}
}),
$message: {
success: jest.fn((obj) => {
return obj
@ -1577,7 +1570,7 @@ describe('Views > AutogenView.vue', () => {
})
describe('pollActionCompletion()', () => {
it('check $notification when pollActionCompletion() is called with action is empty', (done) => {
it('check $showNotification when pollActionCompletion() is called with action is empty', (done) => {
const mockData = {
queryasyncjobresultresponse: {
jobstatus: 1,
@ -1595,7 +1588,7 @@ describe('Views > AutogenView.vue', () => {
wrapper.vm.pollActionCompletion(jobId, action)
setTimeout(() => {
expect(mocks.$notification.info).not.toHaveBeenCalled()
expect(mocks.$showNotification).not.toHaveBeenCalled()
expect(mockAxios).toHaveBeenCalled()
expect(mockAxios).toHaveBeenCalledWith({
url: '/',
@ -1612,7 +1605,7 @@ describe('Views > AutogenView.vue', () => {
})
})
it('check $notification when pollActionCompletion() is called with action is not empty', (done) => {
it('check $showNotification when pollActionCompletion() is called with action is not empty', (done) => {
const mockData = {
queryasyncjobresultresponse: {
jobstatus: 1,
@ -1633,8 +1626,9 @@ describe('Views > AutogenView.vue', () => {
wrapper.vm.pollActionCompletion(jobId, action)
setTimeout(() => {
expect(mocks.$notification.info).toHaveBeenCalled()
expect(mocks.$notification.info).toHaveLastReturnedWith({
expect(mocks.$showNotification).toHaveBeenCalled()
expect(mocks.$showNotification).toHaveLastReturnedWith({
type: 'info',
message: 'test-name-en',
description: 'test-description',
duration: 0
@ -2787,7 +2781,7 @@ describe('Views > AutogenView.vue', () => {
})
})
it('check $notification when api is called and response have not jobId result', async (done) => {
it('check $message when api is called and response have not jobId result', async (done) => {
wrapper = factory({
data: {
showAction: true,

View File

@ -29,9 +29,7 @@ mocks = {
$message: {
error: jest.fn((message) => {})
},
$notification: {
error: jest.fn((message) => {})
},
$showNotification: jest.fn((obj) => {}),
$pollJob: jest.fn((obj) => {
switch (obj.jobId) {
case 'test-job-id-case-1':
@ -754,8 +752,9 @@ describe('Views > compute > MigrateWizard.vue', () => {
await wrapper.vm.submitForm()
setTimeout(() => {
expect(mocks.$notification.error).toHaveBeenCalled()
expect(mocks.$notification.error).toHaveBeenCalledWith({
expect(mocks.$showNotification).toHaveBeenCalled()
expect(mocks.$showNotification).toHaveBeenCalledWith({
type: 'error',
message: i18n.t('message.request.failed'),
description: 'Error: throw error message',
duration: 0