all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Doug Rathbone <oncheckin@fastmail.com.au>
To: pve-devel@lists.proxmox.com
Cc: Doug Rathbone <dougrathbone@gmail.com>
Subject: [PATCH widget-toolkit] ui: disk list: add collapse/expand all controls
Date: Sun, 30 Aug 2026 13:00:35 +1000	[thread overview]
Message-ID: <20260830030035.3209873-1-oncheckin@fastmail.com.au> (raw)

From: Doug Rathbone <dougrathbone@gmail.com>

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.

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;
+    },
+
+    applyState: function (state) {
+        if (state && state.defaultExpanded !== undefined) {
+            this.defaultExpanded = state.defaultExpanded;
+        }
+        this.callParent(arguments);
+    },
+
     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;
 
             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',
+            },
             {
                 xtype: 'proxmoxButton',
                 text: gettext('Show S.M.A.R.T. values'),
-- 
2.47.3




                 reply	other threads:[~2026-09-02  8:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260830030035.3209873-1-oncheckin@fastmail.com.au \
    --to=oncheckin@fastmail.com.au \
    --cc=dougrathbone@gmail.com \
    --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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal