From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v2] ui: resource tree: add collapse/expand all button
Date: Tue, 19 Nov 2024 10:49:33 +0100 [thread overview]
Message-ID: <20241119094933.955006-1-d.csapak@proxmox.com> (raw)
adds two buttons to the tree: expand all and collapse all
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v1:
* use two buttons (negates the need for all the event handling and checking)
* use plain plus/minus icons -> i have no real preference here either,
but the plain icons look a bit weird here IMHO
www/manager6/Workspace.js | 20 ++++++++++++++++++++
www/manager6/tree/ResourceTree.js | 12 ++++++++++++
2 files changed, 32 insertions(+)
diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
index 922e01df..614e85c9 100644
--- a/www/manager6/Workspace.js
+++ b/www/manager6/Workspace.js
@@ -470,6 +470,26 @@ Ext.define('PVE.StdWorkspace', {
padding: '0 0 5 0',
items: [
selview,
+ {
+ xtype: 'button',
+ cls: 'x-btn-default-toolbar-small',
+ tooltip: gettext('Expand Tree'),
+ iconCls: 'fa fa-fw fa-plus x-btn-icon-el-default-toolbar-small',
+ handler: () => {
+ let rt = me.down('pveResourceTree');
+ rt.expandAll();
+ },
+ },
+ {
+ xtype: 'button',
+ cls: 'x-btn-default-toolbar-small',
+ tooltip: gettext('Collapse Tree'),
+ iconCls: 'fa fa-fw fa-minus x-btn-icon-el-default-toolbar-small',
+ handler: () => {
+ let rt = me.down('pveResourceTree');
+ rt.collapseAll();
+ },
+ },
{
xtype: 'button',
cls: 'x-btn-default-toolbar-small',
diff --git a/www/manager6/tree/ResourceTree.js b/www/manager6/tree/ResourceTree.js
index 8b7c2521..65ed5340 100644
--- a/www/manager6/tree/ResourceTree.js
+++ b/www/manager6/tree/ResourceTree.js
@@ -255,6 +255,18 @@ Ext.define('PVE.tree.ResourceTree', {
return changed;
},
+ collapseAll: function() {
+ let me = this;
+ let root = me.store.getRootNode();
+ root.collapseChildren(true);
+ },
+
+ expandAll: function() {
+ let me = this;
+ let root = me.store.getRootNode();
+ root.expandChildren(true);
+ },
+
initComponent: function() {
let me = this;
me.saveSortingOptions();
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next reply other threads:[~2024-11-19 9:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-19 9:49 Dominik Csapak [this message]
2024-11-19 19:56 ` Thomas Lamprecht
2024-11-20 8:35 ` Dominik Csapak
2024-11-20 8:56 ` Dominik Csapak
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=20241119094933.955006-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox