From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 644A499653 for ; Thu, 16 Nov 2023 12:58:25 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 49B60128DC for ; Thu, 16 Nov 2023 12:57:55 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 16 Nov 2023 12:57:54 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 95FBF43810 for ; Thu, 16 Nov 2023 12:57:54 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Thu, 16 Nov 2023 12:57:53 +0100 Message-Id: <20231116115753.4129153-3-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231116115753.4129153-1-d.csapak@proxmox.com> References: <20231114130000.565122-1-l.wagner@proxmox.com> <20231116115753.4129153-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.017 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH widget-toolkit 2/2] notification matcher: improve wording for mode X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Nov 2023 11:58:25 -0000 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 --- src/window/NotificationMatcherEdit.js | 54 +++++++++------------------ 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/src/window/NotificationMatcherEdit.js b/src/window/NotificationMatcherEdit.js index 0f29203..5a88288 100644 --- a/src/window/NotificationMatcherEdit.js +++ b/src/window/NotificationMatcherEdit.js @@ -516,35 +516,22 @@ Ext.define('Proxmox.panel.NotificationRulesEditPanel', { let me = this; let record = me.get('selectedRecord'); let currentData = record.get('data'); + let invert = false; + if (value.startsWith('not')) { + value = value.substring(3); + invert = true; + } record.set({ data: { ...currentData, value, + invert, }, }); }, get: function(record) { - return 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; + let prefix = record?.get('data').invert ? 'not' : ''; + return prefix + record?.get('data')?.value; }, }, }, @@ -791,8 +778,12 @@ Ext.define('Proxmox.panel.NotificationMatchRuleTree', { matchCalendarStmts.push(data.value); break; case 'mode': - modeStmt = data.value; - invertMatchStmt = data.invert; + if (data.value.startsWith('not')) { + modeStmt = data.value.substring(3); // after 'not'' + invertMatchStmt = true; + } else { + modeStmt = data.value; + } break; } @@ -1004,9 +995,13 @@ Ext.define('Proxmox.panel.NotificationMatchRuleSettings', { allowBlank: false, isFormField: false, + matchFieldWidth: false, + comboItems: [ ['all', gettext('All rules match')], ['any', gettext('Any rule matches')], + ['notall', gettext('At least one rule does not match')], + ['notany', gettext('No rule matches')], ], bind: { hidden: '{!showMatchingMode}', @@ -1014,19 +1009,6 @@ Ext.define('Proxmox.panel.NotificationMatchRuleSettings', { value: '{rootMode}', }, }, - { - xtype: 'proxmoxcheckbox', - fieldLabel: gettext('Invert match'), - isFormField: false, - uncheckedValue: 0, - defaultValue: 0, - bind: { - hidden: '{!showMatchingMode}', - disabled: '{!showMatchingMode}', - value: '{invertMatch}', - }, - - }, { xtype: 'proxmoxKVComboBox', fieldLabel: gettext('Node type'), -- 2.30.2