diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json
index 5ec55093da4..135630e8167 100644
--- a/ui/public/locales/en.json
+++ b/ui/public/locales/en.json
@@ -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",
diff --git a/ui/src/components/header/UserMenu.vue b/ui/src/components/header/UserMenu.vue
index 782fab45c56..24b63ead5d4 100644
--- a/ui/src/components/header/UserMenu.vue
+++ b/ui/src/components/header/UserMenu.vue
@@ -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()
}
}
}
diff --git a/ui/src/components/page/GlobalLayout.vue b/ui/src/components/page/GlobalLayout.vue
index 3eac55a109c..87c5ef8ebfb 100644
--- a/ui/src/components/page/GlobalLayout.vue
+++ b/ui/src/components/page/GlobalLayout.vue
@@ -91,6 +91,13 @@
/>
+ {{ $t('label.clear.notification') }}
+
@@ -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)
}
}
}
diff --git a/ui/src/components/view/DetailSettings.vue b/ui/src/components/view/DetailSettings.vue
index 2588c11fb2e..07f0a49cefd 100644
--- a/ui/src/components/view/DetailSettings.vue
+++ b/ui/src/components/view/DetailSettings.vue
@@ -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')
})
diff --git a/ui/src/components/view/ListView.vue b/ui/src/components/view/ListView.vue
index 7ea3e39a13d..0918dd688f6 100644
--- a/ui/src/components/view/ListView.vue
+++ b/ui/src/components/view/ListView.vue
@@ -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')
})
diff --git a/ui/src/components/view/ResourceLimitTab.vue b/ui/src/components/view/ResourceLimitTab.vue
index 93cce68fd7b..2bf9619322b 100644
--- a/ui/src/components/view/ResourceLimitTab.vue
+++ b/ui/src/components/view/ResourceLimitTab.vue
@@ -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
})
diff --git a/ui/src/components/view/SettingsTab.vue b/ui/src/components/view/SettingsTab.vue
index 349d51691dd..4f71e1957f3 100644
--- a/ui/src/components/view/SettingsTab.vue
+++ b/ui/src/components/view/SettingsTab.vue
@@ -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')
})
diff --git a/ui/src/components/view/UploadResourceIcon.vue b/ui/src/components/view/UploadResourceIcon.vue
index ecf6d6668e0..cd8eb2f8902 100644
--- a/ui/src/components/view/UploadResourceIcon.vue
+++ b/ui/src/components/view/UploadResourceIcon.vue
@@ -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
diff --git a/ui/src/config/section/compute.js b/ui/src/config/section/compute.js
index 835923d9f07..416fa985082 100644
--- a/ui/src/config/section/compute.js
+++ b/ui/src/config/section/compute.js
@@ -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
diff --git a/ui/src/layouts/UserLayout.vue b/ui/src/layouts/UserLayout.vue
index 97faff1b446..782291d21d2 100644
--- a/ui/src/layouts/UserLayout.vue
+++ b/ui/src/layouts/UserLayout.vue
@@ -17,6 +17,12 @@
+
{{ $t('label.clear.notification') }}