[pbs-devel] [PATCH v2 proxmox-backup] ui: datastore: Add basic expand/collapse all buttons

Aaron Lauterer a.lauterer at proxmox.com
Mon Jul 13 14:28:01 CEST 2020


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 at 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






More information about the pbs-devel mailing list