mirror of https://github.com/apache/cloudstack.git
ui: refactor config update/reset notification
Follow up from https://github.com/apache/cloudstack/pull/9628#discussion_r1743492807 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
parent
013ebfaf46
commit
22227b0d01
|
|
@ -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'))
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 &&
|
||||
|
|
|
|||
Loading…
Reference in New Issue