From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 980078B6DB for ; Mon, 24 Oct 2022 12:02:54 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 793CB18080 for ; Mon, 24 Oct 2022 12:02:24 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 24 Oct 2022 12:02:23 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id B45FE44B59 for ; Mon, 24 Oct 2022 12:02:23 +0200 (CEST) From: Leo Nunner To: pve-devel@lists.proxmox.com Date: Mon, 24 Oct 2022 12:02:02 +0200 Message-Id: <20221024100202.44338-3-l.nunner@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221024100202.44338-1-l.nunner@proxmox.com> References: <20221024100202.44338-1-l.nunner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.171 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager] fix #4268: add checkbox for force deletion of IPSet X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Oct 2022 10:02:54 -0000 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 --- 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