diff --git a/ui/src/components/view/ListView.vue b/ui/src/components/view/ListView.vue index f78b4cc0db4..c2f5ac3c3d6 100644 --- a/ui/src/components/view/ListView.vue +++ b/ui/src/components/view/ListView.vue @@ -617,11 +617,7 @@ export default { }).then(json => { this.editableValueKey = null this.$store.dispatch('RefreshFeatures') - var message = `${this.$t('message.setting.updated')} ${record.name}` - if (record.isdynamic) { - message += `. ${this.$t('message.setting.update.delay')}` - } - this.$message.success(message) + this.$messageConfigSuccess(`${this.$t('message.setting.updated')} ${record.name}`, record) if (json.updateconfigurationresponse && json.updateconfigurationresponse.configuration && !json.updateconfigurationresponse.configuration.isdynamic && @@ -642,11 +638,7 @@ export default { api('resetConfiguration', { name: item.name }).then(() => { - var message = `${this.$t('label.setting')} ${item.name} ${this.$t('label.reset.config.value')}` - if (item.isdynamic) { - message += `. ${this.$t('message.setting.update.delay')}` - } - this.$message.success(message) + this.$messageConfigSuccess(`${this.$t('label.setting')} ${item.name} ${this.$t('label.reset.config.value')}`, item) }).catch(error => { console.error(error) this.$message.error(this.$t('message.error.reset.config')) diff --git a/ui/src/components/view/SettingsTab.vue b/ui/src/components/view/SettingsTab.vue index f0812c3a8ad..be74e7b32dd 100644 --- a/ui/src/components/view/SettingsTab.vue +++ b/ui/src/components/view/SettingsTab.vue @@ -175,10 +175,7 @@ export default { value: this.editableValue }).then(() => { var message = `${this.$t('label.setting')} ${item.name} ${this.$t('label.update.to')} ${this.editableValue}` - if (item.isdynamic) { - message += `. ${this.$t('message.setting.update.delay')}` - } - this.handleSuccessMessage(item.name, this.$route.meta.name, message) + this.handleSuccessMessage(item, this.$route.meta.name, message) }).catch(error => { console.error(error) this.$message.error(this.$t('message.error.save.setting')) @@ -208,10 +205,7 @@ export default { name: item.name }).then(() => { var message = `${this.$t('label.setting')} ${item.name} ${this.$t('label.reset.config.value')}` - if (item.isdynamic) { - message += `. ${this.$t('message.setting.update.delay')}` - } - this.handleSuccessMessage(item.name, this.$route.meta.name, message) + this.handleSuccessMessage(item, this.$route.meta.name, message) }).catch(error => { console.error(error) this.$message.error(this.$t('message.error.reset.config')) @@ -226,12 +220,16 @@ export default { }) }) }, - handleSuccessMessage (name, scope, message) { - var obj = this.warningMessages[name] + handleSuccessMessage (config, scope, message) { + var obj = this.warningMessages[config.name] if (obj && obj.scope === scope) { - this.$warning({ title: message, content: obj.warning }) + var content = obj.warning + if (config.isdynamic) { + content = `this.$t('message.setting.update.delay').\n ${content}` + } + this.$warning({ title: message, content: content }) } else { - this.$message.success(message) + this.$messageConfigSuccess(message, config) } } } diff --git a/ui/src/utils/plugins.js b/ui/src/utils/plugins.js index 7ab18e8c688..45684e5f52b 100644 --- a/ui/src/utils/plugins.js +++ b/ui/src/utils/plugins.js @@ -288,6 +288,13 @@ export const notifierPlugin = { close: (key) => notification.close(key), destroy: () => notification.destroy() } + + app.config.globalProperties.$messageConfigSuccess = function (msg, configrecord) { + if (configrecord.isdynamic) { + msg += `. ${this.$t('message.setting.update.delay')}` + } + message.success(msg) + } } } diff --git a/ui/src/views/setting/ConfigurationValue.vue b/ui/src/views/setting/ConfigurationValue.vue index a4683a37567..824f2ba9b86 100644 --- a/ui/src/views/setting/ConfigurationValue.vue +++ b/ui/src/views/setting/ConfigurationValue.vue @@ -250,11 +250,7 @@ export default { this.actualValue = this.editableValue this.$emit('change-config', { value: newValue }) this.$store.dispatch('RefreshFeatures') - var message = `${this.$t('message.setting.updated')} ${configrecord.name}` - if (configrecord.isdynamic) { - message += `. ${this.$t('message.setting.update.delay')}` - } - this.$message.success(message) + this.$messageConfigSuccess(`${this.$t('message.setting.updated')} ${configrecord.name}`, configrecord) if (json.updateconfigurationresponse && json.updateconfigurationresponse.configuration && !json.updateconfigurationresponse.configuration.isdynamic && @@ -291,11 +287,7 @@ export default { } this.$emit('change-config', { value: newValue }) this.$store.dispatch('RefreshFeatures') - var message = `${this.$t('label.setting')} ${configrecord.name} ${this.$t('label.reset.config.value')}` - if (configrecord.isdynamic) { - message += `. ${this.$t('message.setting.update.delay')}` - } - this.$message.success(message) + this.$messageConfigSuccess(`${this.$t('label.setting')} ${configrecord.name} ${this.$t('label.reset.config.value')}`, configrecord) if (json.resetconfigurationresponse && json.resetconfigurationresponse.configuration && !json.resetconfigurationresponse.configuration.isdynamic &&