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 4/5] ipset: Add option to update references on rename/delete
Date: Tue,  7 Apr 2026 09:36:57 +0200	[thread overview]
Message-ID: <20260407073658.90818-5-a.bied-charreton@proxmox.com> (raw)
In-Reply-To: <20260407073658.90818-1-a.bied-charreton@proxmox.com>

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




  parent reply	other threads:[~2026-04-07  7:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07  7:36 [PATCH firewall/manager 0/5] Allow updating references to firewall objects when editing them Arthur Bied-Charreton
2026-04-07  7:36 ` [PATCH pve-firewall 1/5] Add helpers for updating alias and ipset references Arthur Bied-Charreton
2026-04-07  7:36 ` [PATCH pve-firewall 2/5] ipset: Add option to update references on rename/delete Arthur Bied-Charreton
2026-04-07  7:36 ` [PATCH pve-firewall 3/5] aliases: " Arthur Bied-Charreton
2026-04-07  7:36 ` Arthur Bied-Charreton [this message]
2026-04-07  7:36 ` [PATCH pve-manager 5/5] " 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=20260407073658.90818-5-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