all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: Re: [pbs-devel] [PATCH proxmox-widget-toolkit 2/2] DiskList: handle partition data from PBS backend
Date: Thu, 7 Apr 2022 10:37:38 +0200	[thread overview]
Message-ID: <d0ce5bfb-fa84-094a-4cd0-d48d330d343d@proxmox.com> (raw)
In-Reply-To: <20220404095048.25443-3-h.laimer@proxmox.com>

some nits inline:

On 4/4/22 11:50, Hannes Laimer wrote:
> Signed-off-by: Hannes Laimer <h.laimer@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;
>   		}





  reply	other threads:[~2022-04-07  8:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-04  9:50 [pbs-devel] [SERIES proxmox-backup proxmox-widget-toolkit 0/3] add partitions to disks/list endpoint Hannes Laimer
2022-04-04  9:50 ` [pbs-devel] [PATCH proxmox-backup 1/3] api2: disks endpoint return partitions Hannes Laimer
2022-04-06  9:12   ` Wolfgang Bumiller
2022-04-04  9:50 ` [pbs-devel] [PATCH proxmox-widget-toolkit 2/2] DiskList: handle partition data from PBS backend Hannes Laimer
2022-04-07  8:37   ` Dominik Csapak [this message]
2022-04-04  9:50 ` [pbs-devel] [PATCH proxmox-backup 3/3] ui: disks: show partitions by default Hannes Laimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d0ce5bfb-fa84-094a-4cd0-d48d330d343d@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal