From: Dominik Csapak <d.csapak@proxmox.com>
To: Doug Rathbone <oncheckin@fastmail.com.au>, pve-devel@lists.proxmox.com
Cc: Doug Rathbone <dougrathbone@gmail.com>
Subject: Re: [PATCH widget-toolkit] ui: disk list: add collapse/expand all controls
Date: Fri, 4 Sep 2026 09:32:41 +0200 [thread overview]
Message-ID: <3d04c155-9cd6-4fe6-9d4b-03d87b8cb588@proxmox.com> (raw)
In-Reply-To: <20260830030035.3209873-1-oncheckin@fastmail.com.au>
Hi, thanks for the patch!
On 9/2/26 10:32 AM, Doug Rathbone wrote:
> From: Doug Rathbone <dougrathbone@gmail.com>
seems there were multiple from headers in your email?
(not sure if this was intentional)
>
> The disk tree always reloads fully expanded, which gets messy on hosts
> with many disks and partitions.
>
> Add Collapse All and Expand All buttons. Remember the last choice so
> reloads and revisits keep the preferred view.
>
> Forum users have asked for this. A 2021 pve-devel thread discussed
> defaulting to collapsed; Thomas preferred collapse/expand controls with
> stateful memory instead.
>
> Tested on PVE 9.2 node with 10+ disks. CLA submitted separately.
>
the part about the cla does not really belong into the commit
message. ( can put such comments directly below the '---' line
then it's not part of the commit message)
some comments inline
> Signed-off-by: Doug Rathbone <dougrathbone@gmail.com>
> ---
> src/panel/DiskList.js | 40 +++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 39 insertions(+), 1 deletion(-)
>
> diff --git a/src/panel/DiskList.js b/src/panel/DiskList.js
> index 0762bab..f50c5dd 100644
> --- a/src/panel/DiskList.js
> +++ b/src/panel/DiskList.js
> @@ -71,6 +71,21 @@ Ext.define('Proxmox.DiskList', {
> stateful: true,
> stateId: 'tree-node-disks',
>
> + defaultExpanded: true,
> +
> + getState: function () {
> + let state = this.callParent(arguments) || {};
> + state.defaultExpanded = this.defaultExpanded !== false;
> + return state;
> + },
nit: convention is that we use 'let me = this;' on methods,
especially if we use 'this' multiple times.
(same in the function below)
not a blocker though and could be fixed up
also, you could just write: `state.defaultExpanded =
!!this.defaultExpanded;`
no real reason to compare it to a literal bool
> +
> + applyState: function (state) {
> + if (state && state.defaultExpanded !== undefined) {
> + this.defaultExpanded = state.defaultExpanded;
this is now inconsistent with the call above
I'd either always use `!!variable` or just a plain assignment
> + }
> + this.callParent(arguments);
> + },
> +
also the whole applyState method is not necessary as
the default applyState already applies all state variables
to 'this'
> controller: {
> xclass: 'Ext.app.ViewController',
>
> @@ -134,6 +149,20 @@ Ext.define('Proxmox.DiskList', {
> });
> },
>
> + collapseAll: function () {
> + let view = this.getView();
> + view.collapseAll();
> + view.defaultExpanded = false;
> + view.saveState();
> + },
> +
> + expandAll: function () {
> + let view = this.getView();
> + view.expandAll();
> + view.defaultExpanded = true;
> + view.saveState();
> + },
> +
> wipeDisk: function () {
> let me = this;
> let view = me.getView();
> @@ -188,10 +217,11 @@ Ext.define('Proxmox.DiskList', {
> }
>
> let disks = {};
> + let defaultExpanded = view.defaultExpanded !== false;
same pattern as above, please use `!!view.defaultExpanded`
>
> for (const item of records) {
> let data = item.data;
> - data.expanded = true;
> + data.expanded = defaultExpanded;
> data.children = data.partitions ?? [];
> for (let p of data.children) {
> p['disk-type'] = 'partition';
> @@ -388,6 +418,14 @@ Ext.define('Proxmox.DiskList', {
> text: gettext('Reload'),
> handler: 'reload',
> },
> + {
> + text: gettext('Collapse All'),
> + handler: 'collapseAll',
> + },
> + {
> + text: gettext('Expand All'),
> + handler: 'expandAll',
> + },
Two things here:
I'm not really a big fan of the button placement here, but I'm not sure
if putting them on the right is better or not...
Also in general I'd probably prefer a single button that toggles, and
in case there are mixed expanded/collapsed it should just do
what it last said (e.g. if i collapse all, then expand some manually,
a click would expand the rest, and vice versa)
this would mean though that wed have to update the buttons on every
expand/collapse
What do you think?
Also it might make sense to introduce icons for these button?
(I know the others on these panels don't have them, but
that shouldn't hold us back for doing so)
> {
> xtype: 'proxmoxButton',
> text: gettext('Show S.M.A.R.T. values'),
prev parent reply other threads:[~2026-09-04 7:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-30 3:00 [PATCH widget-toolkit] ui: disk list: add collapse/expand all controls Doug Rathbone
2026-09-04 7:32 ` Dominik Csapak [this message]
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=3d04c155-9cd6-4fe6-9d4b-03d87b8cb588@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=dougrathbone@gmail.com \
--cc=oncheckin@fastmail.com.au \
--cc=pve-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.