From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id 949FC1FF161
	for <inbox@lore.proxmox.com>; Wed, 20 Nov 2024 09:56:03 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id B2B2EA0A0;
	Wed, 20 Nov 2024 09:56:08 +0100 (CET)
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Wed, 20 Nov 2024 09:56:05 +0100
Message-Id: <20241120085605.670102-1-d.csapak@proxmox.com>
X-Mailer: git-send-email 2.39.5
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.016 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pve-devel] [PATCH manager v3] ui: resource tree: add
 collapse/expand all button
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

adds two buttons to the tree: expand all and collapse all

stack them above each other. This makes it necesary to reduce the
font-size so the whole icon is visible.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v2:
* stack the buttons
* add css classes to make the icons so small that they're visible

@Thomas

well, it works, but IMHO the icons are too small, but i let you be the
judge of that.

if you'd like a combination of the 3 attempts so far (e.g. two buttons
with the different icons), just let me know so i can prepare a final v4

 www/css/ext6-pve.css              |  5 +++++
 www/manager6/Workspace.js         | 37 +++++++++++++++++++++++++++++++
 www/manager6/tree/ResourceTree.js | 12 ++++++++++
 3 files changed, 54 insertions(+)

diff --git a/www/css/ext6-pve.css b/www/css/ext6-pve.css
index 975291f6..317c6e40 100644
--- a/www/css/ext6-pve.css
+++ b/www/css/ext6-pve.css
@@ -764,3 +764,8 @@ table.osds td:first-of-type {
 .pmx-column-wrapped > div {
     white-space: pre-wrap;
 }
+
+.pmx-half-button-icon {
+    font-size:12px ! important;
+    height: 100%;
+}
diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
index 922e01df..3135d82e 100644
--- a/www/manager6/Workspace.js
+++ b/www/manager6/Workspace.js
@@ -470,6 +470,43 @@ Ext.define('PVE.StdWorkspace', {
 			    padding: '0 0 5 0',
 			    items: [
 				selview,
+				{
+				    xtype: 'container',
+				    layout: 'vbox',
+				    height: '100%',
+				    items: [
+					{
+					    flex: 1,
+					    xtype: 'button',
+					    cls: 'x-btn-default-toolbar-small',
+					    tooltip: gettext('Expand Tree'),
+					    iconCls: 'fa fa-fw fa-plus-square-o x-btn-icon-el-default-toolbar-small pmx-half-button-icon',
+					    style: {
+						'padding-top': 0,
+						'padding-bottom': 0,
+					    },
+					    handler: () => {
+						let rt = me.down('pveResourceTree');
+						rt.expandAll();
+					    },
+					},
+					{
+					    flex: 1,
+					    xtype: 'button',
+					    cls: 'x-btn-default-toolbar-small',
+					    tooltip: gettext('Collapse Tree'),
+					    iconCls: 'fa fa-fw fa-minus-square-o x-btn-icon-el-default-toolbar-small pmx-half-button-icon',
+					    style: {
+						'padding-top': 0,
+						'padding-bottom': 0,
+					    },
+					    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