all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager v2] ui: resource tree: add collapse/expand all button
@ 2024-11-19  9:49 Dominik Csapak
  2024-11-19 19:56 ` Thomas Lamprecht
  2024-11-20  8:56 ` Dominik Csapak
  0 siblings, 2 replies; 4+ messages in thread
From: Dominik Csapak @ 2024-11-19  9:49 UTC (permalink / raw)
  To: pve-devel

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH manager v2] ui: resource tree: add collapse/expand all button
  2024-11-19  9:49 [pve-devel] [PATCH manager v2] ui: resource tree: add collapse/expand all button Dominik Csapak
@ 2024-11-19 19:56 ` Thomas Lamprecht
  2024-11-20  8:35   ` Dominik Csapak
  2024-11-20  8:56 ` Dominik Csapak
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Lamprecht @ 2024-11-19 19:56 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

Am 19.11.24 um 10:49 schrieb Dominik Csapak:
> 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


It looks indeed odd, especially without padding. Did you try stacking them
like I mentioned in my reply as possible option. Did not see anny mentioning
that it didn't work or looked stupid ^^


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH manager v2] ui: resource tree: add collapse/expand all button
  2024-11-19 19:56 ` Thomas Lamprecht
@ 2024-11-20  8:35   ` Dominik Csapak
  0 siblings, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2024-11-20  8:35 UTC (permalink / raw)
  To: Thomas Lamprecht, Proxmox VE development discussion

On 11/19/24 20:56, Thomas Lamprecht wrote:
> Am 19.11.24 um 10:49 schrieb Dominik Csapak:
>> 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
> 
> 
> It looks indeed odd, especially without padding. Did you try stacking them
> like I mentioned in my reply as possible option. Did not see anny mentioning
> that it didn't work or looked stupid ^^

no i didn't

just to clarify: you mean on top of each other?

because i think that wont work, since the buttons have a height
based on font-size/line-height/padding/margin so i guess
it's not easy to "squish" them ?

i'll try though


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH manager v2] ui: resource tree: add collapse/expand all button
  2024-11-19  9:49 [pve-devel] [PATCH manager v2] ui: resource tree: add collapse/expand all button Dominik Csapak
  2024-11-19 19:56 ` Thomas Lamprecht
@ 2024-11-20  8:56 ` Dominik Csapak
  1 sibling, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2024-11-20  8:56 UTC (permalink / raw)
  To: pve-devel

sent a v3 with stacked button, but IMHO they're too small:

https://lore.proxmox.com/pve-devel/20241120085605.670102-1-d.csapak@proxmox.com/


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-20  8:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-19  9:49 [pve-devel] [PATCH manager v2] ui: resource tree: add collapse/expand all button Dominik Csapak
2024-11-19 19:56 ` Thomas Lamprecht
2024-11-20  8:35   ` Dominik Csapak
2024-11-20  8:56 ` Dominik Csapak

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