[pve-devel] [PATCH manager] fix #4268: add checkbox for force deletion of IPSet

Leo Nunner l.nunner at proxmox.com
Mon Oct 24 12:02:02 CEST 2022


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 at 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






More information about the pve-devel mailing list