[pbs-devel] [PATCH proxmox-backup 3/3] ui: tape/BackupOverview: insert the tapes between media-set and snapshot

Dominik Csapak d.csapak at proxmox.com
Tue Feb 16 12:48:12 CET 2021


but auto-expand them, so no additional click is necessary

this shows the user which tapes are involved for the media sets

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/tape/BackupOverview.js | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/www/tape/BackupOverview.js b/www/tape/BackupOverview.js
index a5bbfc09..4b4c02ff 100644
--- a/www/tape/BackupOverview.js
+++ b/www/tape/BackupOverview.js
@@ -129,6 +129,8 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
 
 		list.result.data.sort((a, b) => a.snapshot.localeCompare(b.snapshot));
 
+		let tapes = {};
+
 		for (let entry of list.result.data) {
 		    entry.text = entry.snapshot;
 		    entry.leaf = true;
@@ -137,7 +139,23 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
 		    if (iconCls !== '') {
 			entry.iconCls = `fa ${iconCls}`;
 		    }
-		    node.appendChild(entry);
+
+		    let tape = entry['label-text'];
+		    if (tapes[tape] === undefined) {
+			tapes[tape] = {
+			    text: tape,
+			    'media-set-uuid': entry['media-set-uuid'],
+			    'seq-nr': entry['seq-nr'],
+			    iconCls: 'pbs-icon-tape',
+			    expanded: true,
+			    children: [],
+			};
+		    }
+		    tapes[tape].children.push(entry);
+		}
+
+		for (const tape of Object.values(tapes)) {
+		    node.appendChild(tape);
 		}
 
 		if (list.result.data.length === 0) {
@@ -198,7 +216,7 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
 	    text: gettext('Restore Media Set'),
 	    handler: 'restore',
 	    parentXType: 'treepanel',
-	    enableFn: (rec) => !!rec.data.uuid,
+	    enableFn: (rec) => !!rec.data['media-set-uuid'],
 	},
     ],
 
-- 
2.20.1






More information about the pbs-devel mailing list