mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-22 17:17:49 +00:00
notification matcher: improve wording for mode
by removing the 'invert' checkbox and instead show the 4 modes possible, we still assemble/parse the invert for the backend Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
be5329512c
commit
1f8bfa3b30
@ -516,35 +516,22 @@ Ext.define('Proxmox.panel.NotificationRulesEditPanel', {
|
|||||||
let me = this;
|
let me = this;
|
||||||
let record = me.get('selectedRecord');
|
let record = me.get('selectedRecord');
|
||||||
let currentData = record.get('data');
|
let currentData = record.get('data');
|
||||||
|
let invert = false;
|
||||||
|
if (value.startsWith('not')) {
|
||||||
|
value = value.substring(3);
|
||||||
|
invert = true;
|
||||||
|
}
|
||||||
record.set({
|
record.set({
|
||||||
data: {
|
data: {
|
||||||
...currentData,
|
...currentData,
|
||||||
value,
|
value,
|
||||||
|
invert,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
get: function(record) {
|
get: function(record) {
|
||||||
return record?.get('data')?.value;
|
let prefix = record?.get('data').invert ? 'not' : '';
|
||||||
},
|
return prefix + record?.get('data')?.value;
|
||||||
},
|
|
||||||
invertMatch: {
|
|
||||||
bind: {
|
|
||||||
bindTo: '{selectedRecord}',
|
|
||||||
deep: true,
|
|
||||||
},
|
|
||||||
set: function(value) {
|
|
||||||
let me = this;
|
|
||||||
let record = me.get('selectedRecord');
|
|
||||||
let currentData = record.get('data');
|
|
||||||
record.set({
|
|
||||||
data: {
|
|
||||||
...currentData,
|
|
||||||
invert: value,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
get: function(record) {
|
|
||||||
return record?.get('data')?.invert;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -791,8 +778,12 @@ Ext.define('Proxmox.panel.NotificationMatchRuleTree', {
|
|||||||
matchCalendarStmts.push(data.value);
|
matchCalendarStmts.push(data.value);
|
||||||
break;
|
break;
|
||||||
case 'mode':
|
case 'mode':
|
||||||
modeStmt = data.value;
|
if (data.value.startsWith('not')) {
|
||||||
invertMatchStmt = data.invert;
|
modeStmt = data.value.substring(3); // after 'not''
|
||||||
|
invertMatchStmt = true;
|
||||||
|
} else {
|
||||||
|
modeStmt = data.value;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1004,9 +995,13 @@ Ext.define('Proxmox.panel.NotificationMatchRuleSettings', {
|
|||||||
allowBlank: false,
|
allowBlank: false,
|
||||||
isFormField: false,
|
isFormField: false,
|
||||||
|
|
||||||
|
matchFieldWidth: false,
|
||||||
|
|
||||||
comboItems: [
|
comboItems: [
|
||||||
['all', gettext('All rules match')],
|
['all', gettext('All rules match')],
|
||||||
['any', gettext('Any rule matches')],
|
['any', gettext('Any rule matches')],
|
||||||
|
['notall', gettext('At least one rule does not match')],
|
||||||
|
['notany', gettext('No rule matches')],
|
||||||
],
|
],
|
||||||
bind: {
|
bind: {
|
||||||
hidden: '{!showMatchingMode}',
|
hidden: '{!showMatchingMode}',
|
||||||
@ -1014,19 +1009,6 @@ Ext.define('Proxmox.panel.NotificationMatchRuleSettings', {
|
|||||||
value: '{rootMode}',
|
value: '{rootMode}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
xtype: 'proxmoxcheckbox',
|
|
||||||
fieldLabel: gettext('Invert match'),
|
|
||||||
isFormField: false,
|
|
||||||
uncheckedValue: 0,
|
|
||||||
defaultValue: 0,
|
|
||||||
bind: {
|
|
||||||
hidden: '{!showMatchingMode}',
|
|
||||||
disabled: '{!showMatchingMode}',
|
|
||||||
value: '{invertMatch}',
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
xtype: 'proxmoxKVComboBox',
|
xtype: 'proxmoxKVComboBox',
|
||||||
fieldLabel: gettext('Node type'),
|
fieldLabel: gettext('Node type'),
|
||||||
|
Loading…
Reference in New Issue
Block a user