From dfde34e612443b4730eddc98cc04e15a211bfc3a Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Tue, 16 Feb 2021 12:48:12 +0100 Subject: [PATCH] ui: tape/BackupOverview: insert the tapes between media-set and snapshot 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 --- 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'], }, ],