notification ui: add column for 'origin'

This column shows whether a matcher/target was provided as a built-in
default config or if it was created by the user. For built-ins, it
also shows whether the built-in settings have been changed.

To reset a built-in entry to its defaults, one can simply delete it.
For best UX, the 'delete' button should change its text to 'reset
defaults' when a built-in target/matcher is selected. This will be
added in another patch.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
This commit is contained in:
Lukas Wagner 2023-11-14 13:59:53 +01:00 committed by Thomas Lamprecht
parent 5f7b28cb19
commit 6a0b0b376c
2 changed files with 32 additions and 4 deletions

View File

@ -1,6 +1,6 @@
Ext.define('proxmox-notification-endpoints', {
extend: 'Ext.data.Model',
fields: ['name', 'type', 'comment', 'disable'],
fields: ['name', 'type', 'comment', 'disable', 'origin'],
proxy: {
type: 'proxmox',
},
@ -9,7 +9,7 @@ Ext.define('proxmox-notification-endpoints', {
Ext.define('proxmox-notification-matchers', {
extend: 'Ext.data.Model',
fields: ['name', 'comment', 'disable'],
fields: ['name', 'comment', 'disable', 'origin'],
proxy: {
type: 'proxmox',
},

View File

@ -129,7 +129,7 @@ Ext.define('Proxmox.panel.NotificationEndpointView', {
dataIndex: 'name',
text: gettext('Target Name'),
renderer: Ext.String.htmlEncode,
flex: 1,
flex: 2,
},
{
dataIndex: 'type',
@ -141,7 +141,21 @@ Ext.define('Proxmox.panel.NotificationEndpointView', {
dataIndex: 'comment',
text: gettext('Comment'),
renderer: Ext.String.htmlEncode,
flex: 1,
flex: 3,
},
{
dataIndex: 'origin',
text: gettext('Origin'),
renderer: (origin) => {
switch (origin) {
case 'user-created': return gettext('Custom');
case 'modified-builtin': return gettext('Built-In (modified)');
case 'builtin': return gettext('Built-In');
}
// Should not happen...
return 'unknown';
},
},
],
@ -274,6 +288,20 @@ Ext.define('Proxmox.panel.NotificationMatcherView', {
renderer: Ext.String.htmlEncode,
flex: 2,
},
{
dataIndex: 'origin',
text: gettext('Origin'),
renderer: (origin) => {
switch (origin) {
case 'user-created': return gettext('Custom');
case 'modified-builtin': return gettext('Built-In (modified)');
case 'builtin': return gettext('Built-In');
}
// Should not happen...
return 'unknown';
},
},
],
store: {