From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 5DC101FF142 for ; Tue, 07 Apr 2026 09:37:19 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 55947F2F9; Tue, 7 Apr 2026 09:37:37 +0200 (CEST) From: Arthur Bied-Charreton To: pve-devel@lists.proxmox.com Subject: [PATCH pve-manager 4/5] ipset: Add option to update references on rename/delete Date: Tue, 7 Apr 2026 09:36:57 +0200 Message-ID: <20260407073658.90818-5-a.bied-charreton@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260407073658.90818-1-a.bied-charreton@proxmox.com> References: <20260407073658.90818-1-a.bied-charreton@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.096 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 KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Message-ID-Hash: AC7GHWEGO6NHJVVOFNFPVQ5JVJJZFSKA X-Message-ID-Hash: AC7GHWEGO6NHJVVOFNFPVQ5JVJJZFSKA X-MailFrom: abied-charreton@jett.proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add checkboxes to the ipset edit & remove dialogs which allow opting into updating/deleting all references that would be left dangling otherwise. This adds a remove button with a custom IPSetConfirmRemoveDialog built on top of ConfirmRemoveDialog to allow setting the extra URL parameter in the DELETE request, which StdRemoveButton does not support out of the box. Signed-off-by: Arthur Bied-Charreton --- www/manager6/panel/IPSet.js | 60 +++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/www/manager6/panel/IPSet.js b/www/manager6/panel/IPSet.js index 9e0203a0..3db86c58 100644 --- a/www/manager6/panel/IPSet.js +++ b/www/manager6/panel/IPSet.js @@ -1,3 +1,32 @@ +Ext.define('PVE.window.IPSetConfirmRemoveDialog', { + extend: 'Proxmox.window.ConfirmRemoveDialog', + alias: 'widget.pveIPSetConfirmRemoveDialog', + width: 350, + + additionalItems: [ + { + xtype: 'proxmoxcheckbox', + reference: 'deleteRefsCheckbox', + fieldLabel: gettext('Delete referencing rules'), + labelWidth: 260, + autoEl: { + tag: 'span', + 'data-qtip': gettext( + 'Delete all rules referencing this IPSet. If left unchecked, some firewall configurations may end up in invalid states.', + ), + }, + }, + ], + + getParams: function () { + let me = this; + if (me.lookupReference('deleteRefsCheckbox').getValue()) { + me.params['delete-references'] = 1; + } + return me.callParent(); + }, +}); + Ext.define('pve-fw-ipsets', { extend: 'Ext.data.Model', fields: ['name', 'comment', 'digest'], @@ -91,6 +120,19 @@ Ext.define('PVE.IPSetList', { value: rec.data.comment, fieldLabel: gettext('Comment'), }, + { + xtype: 'proxmoxcheckbox', + name: 'update-references', + fieldLabel: gettext('Update referencing rules'), + labelWidth: 250, + anchor: '100%', + autoEl: { + tag: 'span', + 'data-qtip': gettext( + 'Update all rules referencing this IPSet to use the new identifier. If left unchecked, some firewall configurations may end up in invalid states.', + ), + }, + }, ], }); win.show(); @@ -134,11 +176,23 @@ Ext.define('PVE.IPSetList', { }, }); - me.removeBtn = Ext.create('Proxmox.button.StdRemoveButton', { + me.removeBtn = Ext.create('Proxmox.button.Button', { + text: gettext('Remove'), + disabled: true, + dangerous: true, enableFn: (rec) => canEdit, selModel: sm, - baseurl: me.base_url + '/', - callback: reload, + handler: function (btn, event, rec) { + Ext.create('PVE.window.IPSetConfirmRemoveDialog', { + item: { id: rec.data.name }, + url: me.base_url + '/' + rec.data.name, + text: Ext.String.format( + gettext("Are you sure you want to remove IPSet '{0}'?"), + rec.data.name, + ), + apiCallDone: reload, + }).show(); + }, }); Ext.apply(me, { -- 2.47.3