[pbs-devel] [PATCH proxmox-widget-toolkit v2 1/1] ui: DiskLisk: handle partition data from PBS backend

Hannes Laimer h.laimer at proxmox.com
Wed Jun 8 10:51:54 CEST 2022


Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
 src/panel/DiskList.js | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/panel/DiskList.js b/src/panel/DiskList.js
index 76d92cd..c5a0050 100644
--- a/src/panel/DiskList.js
+++ b/src/panel/DiskList.js
@@ -167,10 +167,19 @@ Ext.define('Proxmox.DiskList', {
 
 	    for (const item of records) {
 		let data = item.data;
-		data.leaf = true;
 		data.expanded = true;
-		data.children = [];
+		data.children = data.partitions ?? [];
+		for (let p of data.children) {
+		    p['disk-type'] = 'partition';
+		    p.iconCls = 'fa fa-fw fa-hdd-o x-fa-tree';
+		    p.used = p.used === 'filesystem' ? p.filesystem : p.used;
+		    p.parent = data.devpath;
+		    p.children = [];
+		    p.leaf = true;
+		}
 		data.iconCls = 'fa fa-fw fa-hdd-o x-fa-tree';
+		data.leaf = data.children.length === 0;
+
 		if (!data.parent) {
 		    disks[data.devpath] = data;
 		}
@@ -227,6 +236,15 @@ Ext.define('Proxmox.DiskList', {
 		extendedInfo = `, Ceph (${types.join(', ')})`;
 	    }
 	}
+	const formatMap = {
+	    'bios': 'BIOS boot',
+	    'zfsreserved': 'ZFS reserved',
+	    'efi': 'EFI',
+	    'lvm': 'LVM',
+	    'zfs': 'ZFS',
+	};
+
+	v = formatMap[v] || v;
 	return v ? `${v}${extendedInfo}` : Proxmox.Utils.noText;
     },
 
-- 
2.30.2






More information about the pbs-devel mailing list