public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH v2 proxmox-backup] ui: datastore: Add basic expand/collapse all buttons
Date: Mon, 13 Jul 2020 14:28:01 +0200	[thread overview]
Message-ID: <20200713122801.16518-1-a.lauterer@proxmox.com> (raw)

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





                 reply	other threads:[~2020-07-13 12:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200713122801.16518-1-a.lauterer@proxmox.com \
    --to=a.lauterer@proxmox.com \
    --cc=pbs-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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal