From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 3184D626CF for ; Mon, 13 Jul 2020 14:04:19 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1F2F21AF87 for ; Mon, 13 Jul 2020 14:03:49 +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 942511AF7C for ; Mon, 13 Jul 2020 14:03:48 +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 5B75043247 for ; Mon, 13 Jul 2020 14:03:48 +0200 (CEST) From: Aaron Lauterer To: pbs-devel@lists.proxmox.com Date: Mon, 13 Jul 2020 14:03:47 +0200 Message-Id: <20200713120347.25811-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 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] ui: datastore: Add basic expand/collapse all button X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jul 2020 12:04:21 -0000 The parent component 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 a simple button (right aligned) in the tbar section has to do the job for now. Signed-off-by: Aaron Lauterer --- www/DataStoreContent.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/www/DataStoreContent.js b/www/DataStoreContent.js index a29436fc..cac0b481 100644 --- a/www/DataStoreContent.js +++ b/www/DataStoreContent.js @@ -47,6 +47,8 @@ Ext.define('PBS.DataStoreContent', { title: gettext('Content'), + isExpanded: false, + controller: { xclass: 'Ext.app.ViewController', @@ -321,7 +323,22 @@ Ext.define('PBS.DataStoreContent', { 'backup-time': (time.getTime()/1000).toFixed(0), 'backup-type': type, }).show(); - } + }, + + expandCollapseAll: function (button) { + let me = this; + let view = me.getView(); + + if (me.isExpanded) { + view.collapseAll(); + me.isExpanded = false; + button.setText(gettext('Expand All')); + } else { + view.expandAll(); + me.isExpanded = true; + button.setText(gettext('Collapse All')); + } + }, }, columns: [ @@ -446,6 +463,12 @@ 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: 'expandCollapseAll', + }, ], }); -- 2.20.1