From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id E8F681FF066 for ; Tue, 24 Nov 2026 17:30:11 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 957DD21612; Tue, 24 Nov 2026 17:30:09 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Subject: [PATCH manager] ui: tree: add expand/collapse all options to datacenter cmd menu Date: Tue, 24 Nov 2026 17:26:11 +0100 Message-ID: <20261124163004.871330-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.264 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: JGH5Z7QRW6XTEOKZUJDV35Q6IRGSEKLD X-Message-ID-Hash: JGH5Z7QRW6XTEOKZUJDV35Q6IRGSEKLD X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The tree often comes collapsed, and sometimes it's tedious to open all relevant nodes, tags, etc. Add expand and collapse all options to the right click menu of the datacenter entry. This is always available, and does not take up any valuable space. Signed-off-by: Dominik Csapak --- @Thomas: since we couldn't find common ground on the actual positioning last time, this menu was added, so i though this might be a good place to add these buttons. We can still add them somewhere else in the future but this still fits IMO. Note that nested expanded nodes inside collapsed ones are not collapsed. This is existing extjs behavior and seems like the right choice (only collapse what was visibly expanded). If, not we can ofc forcibly collpase *all* nodes recursively. (this should only matter for pools since we don't have multiple layers of nesting otherwise). www/manager6/dc/CmdMenu.js | 41 +++++++++++++++++++++++++++++++ www/manager6/tree/ResourceTree.js | 8 ++++++ 2 files changed, 49 insertions(+) diff --git a/www/manager6/dc/CmdMenu.js b/www/manager6/dc/CmdMenu.js index a8df24104..ecdff73d8 100644 --- a/www/manager6/dc/CmdMenu.js +++ b/www/manager6/dc/CmdMenu.js @@ -6,6 +6,8 @@ Ext.define('PVE.dc.CmdMenu', { extraHandlerArgs: {}, + showTreeActions: true, + items: [ { text: gettext('Bulk Start'), @@ -71,6 +73,37 @@ Ext.define('PVE.dc.CmdMenu', { }); }, }, + { + xtype: 'menuseparator', + itemId: 'treeSeparator', + hidden: true, + }, + { + text: gettext('Expand All'), + iconCls: 'fa fa-fw fa-expand', + itemId: 'expandAll', + hidden: true, + handler: function () { + let tree = Ext.ComponentQuery.query('pveResourceTree')[0]; + if (!tree) { + return; + } + tree.expandAll(); + }, + }, + { + text: gettext('Collapse All'), + itemId: 'collapseAll', + iconCls: 'fa fa-fw fa-compress', + hidden: true, + handler: function () { + let tree = Ext.ComponentQuery.query('pveResourceTree')[0]; + if (!tree) { + return; + } + tree.collapseBelowDC(); + }, + }, ], initComponent: function () { @@ -99,6 +132,10 @@ Ext.define('PVE.dc.CmdMenu', { if (PVE.Utils.isStandaloneNode()) { me.getComponent('bulkmigrate').setVisible(false); } + + me.getComponent('treeSeparator').setVisible(!!me.showTreeActions); + me.getComponent('expandAll').setVisible(!!me.showTreeActions); + me.getComponent('collapseAll').setVisible(!!me.showTreeActions); }, }); @@ -108,6 +145,8 @@ Ext.define('PVE.dc.TagCmdMenu', { minWidth: 220, + showTreeActions: false, + initComponent: function () { let me = this; @@ -131,6 +170,8 @@ Ext.define('PVE.dc.PoolCmdMenu', { minWidth: 220, + showTreeActions: false, + initComponent: function () { let me = this; diff --git a/www/manager6/tree/ResourceTree.js b/www/manager6/tree/ResourceTree.js index 5d96bffb9..15b90d159 100644 --- a/www/manager6/tree/ResourceTree.js +++ b/www/manager6/tree/ResourceTree.js @@ -304,6 +304,14 @@ Ext.define('PVE.tree.ResourceTree', { return changed; }, + // collapseAll also collapses the root element, which we don't want + collapseBelowDC: function () { + let me = this; + me.suspendLayouts(); + me.getRootNode().collapseChildren(true); + me.resumeLayouts(true); + }, + initComponent: function () { let me = this; me.saveSortingOptions(); -- 2.47.3