ui: tape/BackupOverview: insert a datastore level
since we can now backup multiple datastores in the same media-set, we show the datastores as first level below that the final tree structucture looks like this: tapepool A - media set 1 - datastore I - tape x - ct/100 - ct/100/2020-01-01T00:00:00Z Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
825dfe7e0d
commit
0af8c26b74
@ -127,9 +127,16 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
list.result.data.sort((a, b) => a.snapshot.localeCompare(b.snapshot));
|
list.result.data.sort(function(a, b) {
|
||||||
|
let storeRes = a.store.localeCompare(b.store);
|
||||||
|
if (storeRes === 0) {
|
||||||
|
return a.snapshot.localeCompare(b.snapshot);
|
||||||
|
} else {
|
||||||
|
return storeRes;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
let tapes = {};
|
let stores = {};
|
||||||
|
|
||||||
for (let entry of list.result.data) {
|
for (let entry of list.result.data) {
|
||||||
entry.text = entry.snapshot;
|
entry.text = entry.snapshot;
|
||||||
@ -140,9 +147,19 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
|
|||||||
entry.iconCls = `fa ${iconCls}`;
|
entry.iconCls = `fa ${iconCls}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let store = entry.store;
|
||||||
let tape = entry['label-text'];
|
let tape = entry['label-text'];
|
||||||
if (tapes[tape] === undefined) {
|
if (stores[store] === undefined) {
|
||||||
tapes[tape] = {
|
stores[store] = {
|
||||||
|
text: store,
|
||||||
|
'media-set-uuid': entry['media-set-uuid'],
|
||||||
|
iconCls: 'fa fa-database',
|
||||||
|
tapes: {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stores[store].tapes[tape] === undefined) {
|
||||||
|
stores[store].tapes[tape] = {
|
||||||
text: tape,
|
text: tape,
|
||||||
'media-set-uuid': entry['media-set-uuid'],
|
'media-set-uuid': entry['media-set-uuid'],
|
||||||
'seq-nr': entry['seq-nr'],
|
'seq-nr': entry['seq-nr'],
|
||||||
@ -153,7 +170,7 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
|
|||||||
}
|
}
|
||||||
let [type, group, _id] = PBS.Utils.parse_snapshot_id(entry.snapshot);
|
let [type, group, _id] = PBS.Utils.parse_snapshot_id(entry.snapshot);
|
||||||
|
|
||||||
let children = tapes[tape].children;
|
let children = stores[store].tapes[tape].children;
|
||||||
let text = `${type}/${group}`;
|
let text = `${type}/${group}`;
|
||||||
if (children.length < 1 || children[children.length - 1].text !== text) {
|
if (children.length < 1 || children[children.length - 1].text !== text) {
|
||||||
children.push({
|
children.push({
|
||||||
@ -167,8 +184,13 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
|
|||||||
children[children.length - 1].children.push(entry);
|
children[children.length - 1].children.push(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const tape of Object.values(tapes)) {
|
let storeList = Object.values(stores);
|
||||||
node.appendChild(tape);
|
let expand = storeList.length === 1;
|
||||||
|
for (const store of storeList) {
|
||||||
|
store.children = Object.values(store.tapes);
|
||||||
|
store.expanded = expand;
|
||||||
|
delete store.tapes;
|
||||||
|
node.appendChild(store);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (list.result.data.length === 0) {
|
if (list.result.data.length === 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user