* [PATCH manager] ui: tree: add expand/collapse all options to datacenter cmd menu
@ 2026-11-24 16:26 Dominik Csapak
0 siblings, 0 replies; only message in thread
From: Dominik Csapak @ 2026-11-24 16:26 UTC (permalink / raw)
To: pve-devel
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 <d.csapak@proxmox.com>
---
@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).
| 41 +++++++++++++++++++++++++++++++
www/manager6/tree/ResourceTree.js | 8 ++++++
2 files changed, 49 insertions(+)
--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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-24 16:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 16:26 [PATCH manager] ui: tree: add expand/collapse all options to datacenter cmd menu Dominik Csapak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox