mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
ui: refactor config update/reset notification (#9639)
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
parent
8c8d115a1e
commit
82f113b1e1
@ -761,11 +761,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 &&
|
||||
@ -786,11 +782,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'))
|
||||
|
||||
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -289,6 +289,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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -258,11 +258,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 &&
|
||||
@ -299,11 +295,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 &&
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user