From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <a.lauterer@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 55157626EC
 for <pbs-devel@lists.proxmox.com>; Mon, 13 Jul 2020 14:28:34 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 4C83C1B4F9
 for <pbs-devel@lists.proxmox.com>; Mon, 13 Jul 2020 14:28:04 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id C32131B4F1
 for <pbs-devel@lists.proxmox.com>; Mon, 13 Jul 2020 14:28:03 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 787094328D
 for <pbs-devel@lists.proxmox.com>; Mon, 13 Jul 2020 14:28:02 +0200 (CEST)
From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Date: Mon, 13 Jul 2020 14:28:01 +0200
Message-Id: <20200713122801.16518-1-a.lauterer@proxmox.com>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.000 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 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
Subject: [pbs-devel] [PATCH v2 proxmox-backup] ui: datastore: Add basic
 expand/collapse all buttons
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Mon, 13 Jul 2020 12:28:34 -0000

The parent compontent to the tree grid (tab.panel) does not understand
the Ext.panel.Tool class which would usually be used in such a
situation.

As a workaround two simple buttons (right aligned) in the tbar section
will have to do the job for now.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---

v1 -> v2:
changed from one single button to two.
otherwise it will be complicated to handle situations in which some tree
items are already expanded.

 www/DataStoreContent.js | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/www/DataStoreContent.js b/www/DataStoreContent.js
index a29436fc..fb4ec403 100644
--- a/www/DataStoreContent.js
+++ b/www/DataStoreContent.js
@@ -321,7 +321,17 @@ Ext.define('PBS.DataStoreContent', {
 		'backup-time': (time.getTime()/1000).toFixed(0),
 		'backup-type': type,
 	    }).show();
-	}
+	},
+	onExpandAll: function() {
+		let me = this;
+		let view = me.getView();
+		view.expandAll();
+	},
+	onCollapseAll: function() {
+		let me = this;
+		let view = me.getView();
+		view.collapseAll();
+	},
     },
 
     columns: [
@@ -446,6 +456,17 @@ Ext.define('PBS.DataStoreContent', {
 	    enableFn: function(record) {
 		return !!record.data.leaf && record.size !== null && record.data.files.some(el => el.filename.endsWith('pxar.didx'));
 	    },
-	}
+	},
+	'->',
+	{
+	    xtype: "proxmoxButton",
+	    text: gettext('Expand All'),
+	    handler: 'onExpandAll',
+	},
+	{
+	    xtype: "proxmoxButton",
+	    text: gettext('Collapse All'),
+	    handler: 'onCollapseAll'
+	},
     ],
 });
-- 
2.20.1