[pbs-devel] [PATCH proxmox-widget-toolkit 2/2] DiskList: handle partition data from PBS backend

Dominik Csapak d.csapak at proxmox.com
Thu Apr 7 10:37:38 CEST 2022


some nits inline:

On 4/4/22 11:50, Hannes Laimer wrote:
> Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
> ---
>   src/panel/DiskList.js | 13 ++++++++++++-
>   1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/src/panel/DiskList.js b/src/panel/DiskList.js
> index eb8b1a8..c1877ef 100644
> --- a/src/panel/DiskList.js
> +++ b/src/panel/DiskList.js
> @@ -169,8 +169,19 @@ Ext.define('Proxmox.DiskList', {
>   		let data = item.data;
>   		data.leaf = true;
>   		data.expanded = true;
> -		data.children = [];
> +		data.children = data.partitions ? data.partitions : [];

could be written as '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.parent = data.devpath;
> +		    p.children = [];
> +		    p.leaf = true;
> +		}
>   		data.iconCls = 'fa fa-fw fa-hdd-o x-fa-tree';
> +		if (data.children.length > 0) {
> +		    data.leaf = false;
> +		}

we already set it above to true and here potentially to false.
better imho would be to not set it at the beginning and here doing a
data.leaf = data.children.length === 0;

so that we only set it once

> +
>   		if (!data.parent) {
>   		    disks[data.devpath] = data;
>   		}






More information about the pbs-devel mailing list