From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id B034C1FF0C2 for ; Thu, 22 Oct 2026 14:50:08 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 6F5EE219D3; Thu, 22 Oct 2026 14:48:34 +0200 (CEST) From: Arthur Bied-Charreton To: pve-devel@lists.proxmox.com Subject: [PATCH pve-manager v4 22/27] ui: firewall: aliases: add controls for dangling references Date: Thu, 22 Oct 2026 14:47:03 +0200 Message-ID: <20261022124708.429069-23-a.bied-charreton@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261022124708.429069-1-a.bied-charreton@proxmox.com> References: <20261022124708.429069-1-a.bied-charreton@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1792673237948 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.846 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: HP3YEMBP6E4MLA7NSLLKJVBZJEMA5AUY X-Message-ID-Hash: HP3YEMBP6E4MLA7NSLLKJVBZJEMA5AUY X-MailFrom: a.bied-charreton@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 the shared dangling-references action selector to the update dialog and replace the plain remove button with a confirmation dialog carrying the same selector to let users choose how to handle dangling references on config changes. 'force-rename' is not offered. It is meant as an escape hatch to recover from a partially applied rename, putting it next to the normal actions makes it too easy to select. StdRemoveButton cannot pass the extra 'dangling-references' parameter, so the remove button is switched to a plain button that opens the shared FirewallObjectRemove dialog. Signed-off-by: Arthur Bied-Charreton --- www/manager6/grid/FirewallAliases.js | 121 ++++++++++++++++++++++----- 1 file changed, 99 insertions(+), 22 deletions(-) diff --git a/www/manager6/grid/FirewallAliases.js b/www/manager6/grid/FirewallAliases.js index 06801d33..06dc3b9c 100644 --- a/www/manager6/grid/FirewallAliases.js +++ b/www/manager6/grid/FirewallAliases.js @@ -7,6 +7,8 @@ Ext.define('PVE.FirewallAliasEdit', { width: 400, + onlineHelp: 'pve_firewall_dangling_references', + initComponent: function () { let me = this; @@ -20,27 +22,68 @@ Ext.define('PVE.FirewallAliasEdit', { me.method = 'PUT'; } + let items = [ + { + xtype: 'textfield', + name: me.isCreate ? 'name' : 'rename', + fieldLabel: gettext('Name'), + allowBlank: false, + }, + { + xtype: 'textfield', + name: 'cidr', + fieldLabel: gettext('IP/CIDR'), + allowBlank: false, + }, + { + xtype: 'textfield', + name: 'comment', + fieldLabel: gettext('Comment'), + }, + ]; + let advancedItems = []; + if (!me.isCreate) { + advancedItems.push({ + xtype: 'pveFirewallReferenceAction', + preferredValue: 'rename', + referenceActions: [ + { + text: gettext('Keep'), + value: 'keep', + description: gettext( + 'Do not touch firewall rules and IPSet members referencing this alias.', + ), + }, + { + text: gettext('Disable'), + value: 'disable', + description: gettext( + 'Disable firewall rules and delete IPSet members referencing this alias.', + ), + }, + { + text: gettext('Delete'), + value: 'drop', + description: gettext( + 'Delete firewall rules and IPSet members referencing this alias.', + ), + }, + { + text: gettext('Rename'), + value: 'rename', + description: gettext( + 'Rewrite referencing firewall rules and IPSet members to point to the new alias name.', + ), + }, + ], + }); + } + let ipanel = Ext.create('Proxmox.panel.InputPanel', { isCreate: me.isCreate, - items: [ - { - xtype: 'textfield', - name: me.isCreate ? 'name' : 'rename', - fieldLabel: gettext('Name'), - allowBlank: false, - }, - { - xtype: 'textfield', - name: 'cidr', - fieldLabel: gettext('IP/CIDR'), - allowBlank: false, - }, - { - xtype: 'textfield', - name: 'comment', - fieldLabel: gettext('Comment'), - }, - ], + items, + // an empty array would still turn on the 'Advanced' checkbox + advancedItems: advancedItems.length ? advancedItems : undefined, }); Ext.apply(me, { @@ -158,15 +201,49 @@ Ext.define('PVE.FirewallAliases', { }, }); - me.removeBtn = Ext.create('Proxmox.button.StdRemoveButton', { + me.removeBtn = Ext.create('Proxmox.button.Button', { + text: gettext('Remove'), disabled: true, + dangerous: true, selModel: sm, enableFn: (rec) => !!caps.vms['VM.Config.Network'] || !!caps.dc['Sys.Modify'] || !!caps.nodes['Sys.Modify'], - baseurl: me.base_url + '/', - callback: reload, + handler: function (btn, event, rec) { + Ext.create('PVE.window.FirewallObjectRemove', { + item: { id: rec.data.name }, + url: me.base_url + '/' + rec.data.name, + text: Ext.String.format( + gettext("Are you sure you want to remove alias '{0}'"), + rec.data.name, + ), + referenceActions: [ + { + text: gettext('Keep'), + value: 'keep', + description: gettext( + 'Do not touch firewall rules and IPSet members referencing this alias.', + ), + }, + { + text: gettext('Disable'), + value: 'disable', + description: gettext( + 'Disable firewall rules and delete IPSet members referencing this alias.', + ), + }, + { + text: gettext('Delete'), + value: 'drop', + description: gettext( + 'Delete firewall rules and IPSet members referencing this alias.', + ), + }, + ], + apiCallDone: reload, + }).show(); + }, }); Ext.apply(me, { -- 2.47.3