From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id D444B1FF0A7 for ; Tue, 18 Aug 2026 15:34:41 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id DA4DE215CF; Tue, 18 Aug 2026 15:34:19 +0200 (CEST) From: Arthur Bied-Charreton To: pve-devel@lists.proxmox.com Subject: [PATCH pve-manager v2 7/9] ui: firewall: add common widgets for deleting and updating references Date: Tue, 18 Aug 2026 15:34:11 +0200 Message-ID: <20260818133413.450776-8-a.bied-charreton@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260818133413.450776-1-a.bied-charreton@proxmox.com> References: <20260818133413.450776-1-a.bied-charreton@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 AWL -0.634 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) KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 1.274 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: JDZP6J4GRAUT6BT53CYSRCN7X2J2UIG5 X-Message-ID-Hash: JDZP6J4GRAUT6BT53CYSRCN7X2J2UIG5 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: The ipset and alias grids need the same two UI pieces to let users update/delete referencing rules when removing or renaming an object. Add them as reusable components. FirewallDeleteReferences extends ConfirmRemoveDialog with a checkbox that sets 'delete-references', FirewallUpdateReferences is a no/yes/force selector that submits 'update-references'. Callers will be added in subsequent commits. Signed-off-by: Arthur Bied-Charreton --- www/manager6/Makefile | 1 + www/manager6/grid/FirewallObjectCommon.js | 100 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 www/manager6/grid/FirewallObjectCommon.js diff --git a/www/manager6/Makefile b/www/manager6/Makefile index eb0e9d9c..0a0a2792 100644 --- a/www/manager6/Makefile +++ b/www/manager6/Makefile @@ -98,6 +98,7 @@ JSSRC= \ form/TagFieldSet.js \ form/IsoSelector.js \ grid/BackupView.js \ + grid/FirewallObjectCommon.js \ grid/FirewallAliases.js \ grid/FirewallOptions.js \ grid/FirewallRules.js \ diff --git a/www/manager6/grid/FirewallObjectCommon.js b/www/manager6/grid/FirewallObjectCommon.js new file mode 100644 index 00000000..67e16634 --- /dev/null +++ b/www/manager6/grid/FirewallObjectCommon.js @@ -0,0 +1,100 @@ +Ext.define('PVE.window.FirewallDeleteReferences', { + extend: 'Proxmox.window.ConfirmRemoveDialog', + alias: 'widget.pveFirewallDeleteReferences', + + width: 350, + + refsFieldLabel: gettext('Delete references'), + + refsTip: undefined, + + initComponent: function () { + let me = this; + + let refsTip = me.refsTip; + if (refsTip === undefined) { + throw new Error('refsTip is undefined, cannot initialize component'); + } + + me.additionalItems = [ + { + xtype: 'proxmoxcheckbox', + reference: 'deleteRefsCheckbox', + fieldLabel: me.refsFieldLabel, + labelWidth: 260, + autoEl: { 'data-qtip': refsTip }, + }, + ]; + + me.callParent(); + }, + + getParams: function () { + let me = this; + if (me.lookupReference('deleteRefsCheckbox').getValue()) { + me.params['delete-references'] = 1; + } + + return me.callParent(); + }, +}); + +Ext.define('PVE.form.FirewallUpdateReferences', { + extend: 'Ext.form.FieldContainer', + alias: 'widget.pveFirewallUpdateReferences', + + fieldLabel: gettext('Update references'), + labelWidth: 150, + layout: { type: 'hbox', pack: 'end' }, + + // submitted parameter + name: 'update-references', + value: 'no', + + noTip: undefined, + yesTip: undefined, + forceTip: undefined, + + initComponent: function () { + let me = this; + + let noTip = me.noTip; + if (noTip === undefined) { + throw new Error('noTip is undefined, cannot initialize component'); + } + + let yesTip = me.yesTip; + if (yesTip === undefined) { + throw new Error('yesTip is undefined, cannot initialize component'); + } + + let forceTip = me.forceTip; + if (forceTip === undefined) { + throw new Error('forceTip is undefined, cannot initialize component'); + } + + me.items = [ + { + xtype: 'segmentedbutton', + allowMultiple: false, + value: me.value, + items: [ + { text: gettext('No'), value: 'no', tooltip: me.noTip }, + { text: gettext('Yes'), value: 'yes', tooltip: me.yesTip }, + { text: gettext('Force'), value: 'force', tooltip: me.forceTip }, + ], + listeners: { + change: (btn, val) => me.down('hiddenfield').setValue(val), + }, + }, + { + xtype: 'hiddenfield', + name: me.name, + value: me.value, + isDirty: () => false, + }, + ]; + + me.callParent(); + }, +}); -- 2.47.3