all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Leo Nunner <l.nunner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] fix #4268: add checkbox for force deletion of IPSet
Date: Mon, 24 Oct 2022 12:02:02 +0200	[thread overview]
Message-ID: <20221024100202.44338-3-l.nunner@proxmox.com> (raw)
In-Reply-To: <20221024100202.44338-1-l.nunner@proxmox.com>

Expose the 'force' parameter through the UI when deleting an IPSet.
Small OQL imporovement: the member panel now gets cleared
automatically whenever an IPSet is deselected, which is necessary
when deleting a non-empty set.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
---
 www/manager6/panel/IPSet.js | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/www/manager6/panel/IPSet.js b/www/manager6/panel/IPSet.js
index a4606769..a6146566 100644
--- a/www/manager6/panel/IPSet.js
+++ b/www/manager6/panel/IPSet.js
@@ -46,6 +46,7 @@ Ext.define('PVE.IPSetList', {
 
 	var reload = function() {
 	    var oldrec = sm.getSelection()[0];
+	    sm.deselect(oldrec);
 	    store.load(function(records, operation, success) {
 		if (oldrec) {
 		    var rec = store.findRecord('name', oldrec.data.name, 0, false, true, true);
@@ -91,6 +92,30 @@ Ext.define('PVE.IPSetList', {
 	    win.on('destroy', reload);
 	};
 
+	var run_delete = function() {
+	    var rec = sm.getSelection()[0];
+	    if (!rec) {
+		return;
+	    }
+	    var win = Ext.create('Proxmox.window.Edit', {
+		title: "Delete IPSet '"+ rec.data.name + "'?",
+		url: me.base_url + '/' + rec.data.name,
+		method: 'DELETE',
+		isCreate: true,
+		isRemove: true,
+		items: [
+		    {
+			xtype: 'proxmoxcheckbox',
+			name: 'force',
+			checked: false,
+			fieldLabel: gettext('Delete members'),
+		    },
+		],
+	    });
+	    win.show();
+	    win.on('destroy', reload);
+	};
+
 	me.editBtn = new Proxmox.button.Button({
 	    text: gettext('Edit'),
 	    disabled: true,
@@ -127,10 +152,11 @@ Ext.define('PVE.IPSetList', {
 	    },
 	});
 
-	me.removeBtn = Ext.create('Proxmox.button.StdRemoveButton', {
+	me.removeBtn = Ext.create('Proxmox.button.Button', {
+	    text: gettext('Remove'),
+	    disabled: true,
 	    selModel: sm,
-	    baseurl: me.base_url + '/',
-	    callback: reload,
+	    handler: run_delete,
 	});
 
 	Ext.apply(me, {
-- 
2.30.2





      parent reply	other threads:[~2022-10-24 10:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24 10:02 [pve-devel] [PATCH firewall manager] delete IPset with members Leo Nunner
2022-10-24 10:02 ` [pve-devel] [PATCH firewall 1/1] fix #4268: add 'force' parameter to delete IPSet " Leo Nunner
2022-11-16 19:28   ` [pve-devel] applied: " Thomas Lamprecht
2022-10-24 10:02 ` Leo Nunner [this message]

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=20221024100202.44338-3-l.nunner@proxmox.com \
    --to=l.nunner@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal