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 <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-02-16 12:48:12 +01:00 committed by Dietmar Maurer
parent 2530811e22
commit dfde34e612
1 changed files with 20 additions and 2 deletions

View File

@ -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'],
},
],