[pve-devel] [PATCH manager 2/2] Fix #1372: require manually entering the Ceph Pool id before destroying a pool

Emmanuel Kasper e.kasper at proxmox.com
Mon May 29 11:56:56 CEST 2017


---
 www/manager6/ceph/Pool.js | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/www/manager6/ceph/Pool.js b/www/manager6/ceph/Pool.js
index df43be44..bc08c075 100644
--- a/www/manager6/ceph/Pool.js
+++ b/www/manager6/ceph/Pool.js
@@ -162,32 +162,21 @@ Ext.define('PVE.node.CephPoolList', {
 	    }
 	});
 
-	var remove_btn = new PVE.button.Button({
+	var remove_btn = Ext.create('PVE.button.Button', {
 	    text: gettext('Remove'),
-	    selModel: sm,
-	    disabled: true,
-	    confirmMsg: function(rec) {
-		var msg = Ext.String.format(gettext('Are you sure you want to remove entry {0}'),
-					    "'" + rec.data.pool_name + "'");
-		msg += " " + gettext('This will permanently erase all data.');
-
-		return msg;
-	    },
 	    handler: function() {
 		var rec = sm.getSelection()[0];
 
 		if (!rec.data.pool_name) {
 		    return;
 		}
+		var base_url = '/nodes/' + nodename + '/ceph/pools/' +
+		    rec.data.pool_name;
 
-		PVE.Utils.API2Request({
-		    url: "/nodes/" + nodename + "/ceph/pools/" +
-			rec.data.pool_name,
-		    method: 'DELETE',
-		    failure: function(response, opts) {
-			Ext.Msg.alert(gettext('Error'), response.htmlStatus);
-		    }
-		});
+		Ext.create('PVE.window.SafeDestroy', {
+		    url: base_url,
+		    item: { type: 'CephPool', id: rec.data.pool_name }
+		}).show();
 	    }
 	});
 
-- 
2.11.0





More information about the pve-devel mailing list