public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH v2 proxmox-backup] ui: datastore: Add basic expand/collapse all buttons
@ 2020-07-13 12:28 Aaron Lauterer
  0 siblings, 0 replies; only message in thread
From: Aaron Lauterer @ 2020-07-13 12:28 UTC (permalink / raw)
  To: pbs-devel

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





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-13 12:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-13 12:28 [pbs-devel] [PATCH v2 proxmox-backup] ui: datastore: Add basic expand/collapse all buttons Aaron Lauterer

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