[pve-devel] [PATCH v2 manager 1/1] ui: node: zfs: use ZFSDetail window from widget-toolkit

Fabian Ebner f.ebner at proxmox.com
Fri Sep 10 13:45:38 CEST 2021


The only functional differences I could see are the missing
defaultValue for 'Scan' and the reduced height. For restoring the
height, there is a proposed patch for widget-toolkit.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

Needs a dependency bump for pve-storage, because new widget-toolkit
hides the root, but old storage still wants that to be shown.

The ZFSDetail window was already introduced in widget-toolkit 2.2-9,
so no new bump for that needed.

It can still make sense to bump widget-toolkit for the patches in this
series. That would avoid the situation with new storage + old
widget-toolkit showing the pool as the root and the vdev with the same
name, and the reduced height.

 www/manager6/node/ZFS.js | 167 +--------------------------------------
 1 file changed, 3 insertions(+), 164 deletions(-)

diff --git a/www/manager6/node/ZFS.js b/www/manager6/node/ZFS.js
index 8ea364bf..b2fcc87a 100644
--- a/www/manager6/node/ZFS.js
+++ b/www/manager6/node/ZFS.js
@@ -174,125 +174,6 @@ Ext.define('PVE.node.CreateZFS', {
     },
 });
 
-Ext.define('PVE.node.ZFSDevices', {
-    extend: 'Ext.tree.Panel',
-    xtype: 'pveZFSDevices',
-
-    stateful: true,
-    stateId: 'grid-node-zfsstatus',
-    columns: [
-	{
-	    xtype: 'treecolumn',
-	    text: gettext('Name'),
-	    dataIndex: 'name',
-	    flex: 1,
-	},
-	{
-	    text: gettext('Health'),
-	    renderer: PVE.Utils.render_zfs_health,
-	    dataIndex: 'state',
-	},
-	{
-	    text: 'READ',
-	    dataIndex: 'read',
-	},
-	{
-	    text: 'WRITE',
-	    dataIndex: 'write',
-	},
-	{
-	    text: 'CKSUM',
-	    dataIndex: 'cksum',
-	},
-	{
-	    text: gettext('Message'),
-	    dataIndex: 'msg',
-	},
-    ],
-
-    reload: function() {
-	let me = this;
-	let sm = me.getSelectionModel();
-	Proxmox.Utils.API2Request({
-	    url: `/nodes/${me.nodename}/disks/zfs/${me.zpool}`,
-	    waitMsgTarget: me,
-	    method: 'GET',
-	    failure: (response, opts) => Proxmox.Utils.setErrorMask(me, response.htmlStatus),
-	    success: function(response, opts) {
-		sm.deselectAll();
-		me.setRootNode(response.result.data);
-		me.expandAll();
-	    },
-	});
-    },
-
-    rootVisible: true,
-    selModel: 'treemodel',
-    fields: [
-	'name',
-	'status',
-	{
-	    type: 'string',
-	    name: 'iconCls',
-	    calculate: data => data.leaf ? `fa x-fa-tree fa-hdd-o` : undefined,
-	},
-    ],
-
-    initComponent: function() {
-        let me = this;
-
-	if (!me.nodename) {
-	    throw "no node name specified";
-	}
-	if (!me.zpool) {
-	    throw "no zpool specified";
-	}
-
-	me.callParent();
-
-	me.reload();
-    },
-});
-
-Ext.define('PVE.node.ZFSStatus', {
-    extend: 'Proxmox.grid.ObjectGrid',
-    xtype: 'pveZFSStatus',
-    layout: 'fit',
-    border: false,
-
-    initComponent: function() {
-	let me = this;
-
-	if (!me.nodename) {
-	    throw "no node name specified";
-	}
-	if (!me.zpool) {
-	    throw "no zpool specified";
-	}
-
-	me.url = `/api2/extjs/nodes/${me.nodename}/disks/zfs/${me.zpool}`;
-
-	me.rows = {
-	    scan: {
-		header: gettext('Scan'),
-		defaultValue: gettext('No Data'),
-	    },
-	    status: {
-		header: gettext('Status'),
-	    },
-	    action: {
-		header: gettext('Action'),
-	    },
-	    errors: {
-		header: gettext('Errors'),
-	    },
-	};
-
-	me.callParent();
-	me.reload();
-    },
-});
-
 Ext.define('PVE.node.ZFSList', {
     extend: 'Ext.grid.Panel',
     xtype: 'pveZFSList',
@@ -383,52 +264,10 @@ Ext.define('PVE.node.ZFSList', {
     show_detail: function(zpool) {
 	let me = this;
 
-	let detailsgrid = Ext.create('PVE.node.ZFSStatus', {
-	    layout: 'fit',
-	    nodename: me.nodename,
-	    flex: 0,
-	    zpool: zpool,
-	});
-	let devicetree = Ext.create('PVE.node.ZFSDevices', {
-	    title: gettext('Devices'),
+	Ext.create('Proxmox.window.ZFSDetail', {
+	    zpool,
 	    nodename: me.nodename,
-	    flex: 1,
-	    zpool: zpool,
-	});
-
-	Ext.create('Ext.window.Window', {
-	    modal: true,
-	    width: 800,
-	    height: 600,
-	    resizable: true,
-	    layout: 'fit',
-	    title: gettext('Status') + ': ' + zpool,
-	    items: [
-		{
-		    xtype: 'panel',
-		    region: 'center',
-		    layout: {
-			type: 'vbox',
-			align: 'stretch',
-		    },
-		    items: [
-			detailsgrid,
-			devicetree,
-		    ],
-		    tbar: [
-			{
-			    text: gettext('Reload'),
-			    iconCls: 'fa fa-refresh',
-			    handler: function() {
-				devicetree.reload();
-				detailsgrid.reload();
-			    },
-			},
-		    ],
-		},
-	    ],
-	    autoShow: true,
-	});
+	}).show();
     },
 
     set_button_status: function() {
-- 
2.30.2






More information about the pve-devel mailing list