utils: add extendable, translatable notification event descriptions
Add a similar mechanism like we have for adding and overriding task description per product UI. Signed-off-by: Lukas Wagner <l.wagner@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
36d167d629
commit
d2c8fbfe0c
31
src/Utils.js
31
src/Utils.js
@ -647,6 +647,37 @@ utilities: {
|
||||
Proxmox.Utils.unknownText;
|
||||
},
|
||||
|
||||
// Only add product-agnostic fields here!
|
||||
notificationFieldName: {
|
||||
'type': gettext('Notification type'),
|
||||
'hostname': gettext('Hostname'),
|
||||
},
|
||||
|
||||
formatNotificationFieldName: (value) =>
|
||||
Proxmox.Utils.notificationFieldName[value] || value,
|
||||
|
||||
// to add or change existing for product specific ones
|
||||
overrideNotificationFieldName: function(extra) {
|
||||
for (const [key, value] of Object.entries(extra)) {
|
||||
Proxmox.Utils.notificationFieldName[key] = value;
|
||||
}
|
||||
},
|
||||
|
||||
// Only add product-agnostic fields here!
|
||||
notificationFieldValue: {
|
||||
'system-mail': gettext('Forwarded mails to the local root user'),
|
||||
},
|
||||
|
||||
formatNotificationFieldValue: (value) =>
|
||||
Proxmox.Utils.notificationFieldValue[value] || value,
|
||||
|
||||
// to add or change existing for product specific ones
|
||||
overrideNotificationFieldValue: function(extra) {
|
||||
for (const [key, value] of Object.entries(extra)) {
|
||||
Proxmox.Utils.notificationFieldValue[key] = value;
|
||||
}
|
||||
},
|
||||
|
||||
// NOTE: only add general, product agnostic, ones here! Else use override helper in product repos
|
||||
task_desc_table: {
|
||||
aptupdate: ['', gettext('Update package database')],
|
||||
|
Loading…
Reference in New Issue
Block a user