public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
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	[thread overview]
Message-ID: <20260818133413.450776-8-a.bied-charreton@proxmox.com> (raw)
In-Reply-To: <20260818133413.450776-1-a.bied-charreton@proxmox.com>

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 <a.bied-charreton@proxmox.com>
---
 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




  parent reply	other threads:[~2026-08-18 13:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 13:34 [PATCH firewall/manager v2 0/9] allow updating references when renaming/deleting firewall objects Arthur Bied-Charreton
2026-08-18 13:34 ` [PATCH pve-firewall v2 1/9] api: helpers: add helper to update firewall object references Arthur Bied-Charreton
2026-08-18 13:34 ` [PATCH pve-firewall v2 2/9] api: ipset: add option to update references on edit Arthur Bied-Charreton
2026-08-18 13:34 ` [PATCH pve-firewall v2 3/9] api: ipset: add option to GC references on delete Arthur Bied-Charreton
2026-08-18 13:34 ` [PATCH pve-firewall v2 4/9] api: aliases: add option to update references on edit Arthur Bied-Charreton
2026-08-18 13:34 ` [PATCH pve-firewall v2 5/9] api: aliases: add option to GC references on delete Arthur Bied-Charreton
2026-08-18 13:34 ` [PATCH pve-firewall v2 6/9] firewall: tests: add tests for object reference update logic Arthur Bied-Charreton
2026-08-18 13:34 ` Arthur Bied-Charreton [this message]
2026-08-18 13:34 ` [PATCH pve-manager v2 8/9] ui: firewall: ipset: add controls to update/delete references on edit Arthur Bied-Charreton
2026-08-18 13:34 ` [PATCH pve-manager v2 9/9] ui: firewall: aliases: " Arthur Bied-Charreton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260818133413.450776-8-a.bied-charreton@proxmox.com \
    --to=a.bied-charreton@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal