[pve-devel] [PATCH manager 11/11] ui: ceph/fs: allow destroying cephfs

Dominik Csapak d.csapak at proxmox.com
Tue Oct 19 11:33:53 CEST 2021


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Makefile                    |  1 +
 www/manager6/ceph/FS.js                  | 35 ++++++++++++++++++++++++
 www/manager6/window/SafeDestroyCephFS.js | 22 +++++++++++++++
 3 files changed, 58 insertions(+)
 create mode 100644 www/manager6/window/SafeDestroyCephFS.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index a759db87..ccf9872b 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -104,6 +104,7 @@ JSSRC= 							\
 	window/Prune.js					\
 	window/Restore.js				\
 	window/SafeDestroyGuest.js			\
+	window/SafeDestroyCephFS.js			\
 	window/Settings.js				\
 	window/Snapshot.js				\
 	window/StartupEdit.js				\
diff --git a/www/manager6/ceph/FS.js b/www/manager6/ceph/FS.js
index a3fa3672..1a8eca26 100644
--- a/www/manager6/ceph/FS.js
+++ b/www/manager6/ceph/FS.js
@@ -139,6 +139,34 @@ Ext.define('PVE.NodeCephFSPanel', {
 		    });
 		},
 
+		onRemove: function() {
+		    let me = this;
+		    let view = me.getView();
+		    let selection = view.getSelection();
+		    if (!selection || selection.length < 1) {
+			return;
+		    }
+
+		    let rec = selection[0];
+		    let fsname = rec.data.name;
+
+		    Ext.create('PVE.window.SafeDestroyCephFS', {
+			showProgress: true,
+			url: `/nodes/${view.nodename}/ceph/fs/${fsname}`,
+			params: {
+			    'remove-storages': 1,
+			},
+			item: {
+			    type: 'CephFS',
+			    id: fsname,
+			},
+			taskName: 'cephdestroyfs',
+			autoShow: true,
+			listeners: {
+			    destroy: () => view.rstore.load(),
+			},
+		    });
+		},
 	    },
 	    tbar: [
 		{
@@ -149,6 +177,13 @@ Ext.define('PVE.NodeCephFSPanel', {
 			disabled: '{!canCreateFS}',
 		    },
 		},
+		{
+		    xtype: 'proxmoxButton',
+		    text: gettext('Remove CephFS'),
+		    reference: 'removeButton',
+		    disabled: true,
+		    handler: 'onRemove',
+		},
 	    ],
 	    columns: [
 		{
diff --git a/www/manager6/window/SafeDestroyCephFS.js b/www/manager6/window/SafeDestroyCephFS.js
new file mode 100644
index 00000000..08e910ac
--- /dev/null
+++ b/www/manager6/window/SafeDestroyCephFS.js
@@ -0,0 +1,22 @@
+Ext.define('PVE.window.SafeDestroyCephFS', {
+    extend: 'Proxmox.window.SafeDestroy',
+    alias: 'widget.pveSafeDestroyCephFS',
+
+    additionalItems: [
+	{
+	    xtype: 'proxmoxcheckbox',
+	    name: 'remove-pools',
+	    reference: 'poolsCheckbox',
+	    boxLabel: gettext('Remove associated pools.'),
+	    checked: true,
+	},
+    ],
+
+    getParams: function() {
+	let me = this;
+
+	me.params['remove-pools'] = me.lookup('poolsCheckbox').checked ? 1 : 0;
+
+	return me.callParent();
+    },
+});
-- 
2.30.2






More information about the pve-devel mailing list