ui: tape/TapeRestore: don't send snapshotlist when restoring whole datastores
for the case that the user selects only whole datastores, we do not want to send and (exhaustive) list of snapshots that get restored, but we only want to honor the mapping the user gives this avoids using the backup restore codepath that iterates twice over the tapes and would generally be slower for a lot of snapshots Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
afb790db73
commit
68ac8976eb
@ -184,9 +184,13 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
|
|||||||
values = [];
|
values = [];
|
||||||
}
|
}
|
||||||
let datastores = {};
|
let datastores = {};
|
||||||
values.forEach((snapshot) => {
|
values.forEach((snapshotOrDatastore) => {
|
||||||
const [datastore] = snapshot.split(':');
|
let datastore = snapshotOrDatastore;
|
||||||
datastores[datastore] = true;
|
if (snapshotOrDatastore.indexOf(':') !== -1) {
|
||||||
|
let snapshot = snapshotOrDatastore;
|
||||||
|
let match = snapshot.split(':');
|
||||||
|
datastore = match[0];
|
||||||
|
} datastores[datastore] = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
me.setDataStores(Object.keys(datastores));
|
me.setDataStores(Object.keys(datastores));
|
||||||
@ -230,7 +234,7 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
|
|||||||
if (response.result.data.length > 0) {
|
if (response.result.data.length > 0) {
|
||||||
grid.setDisabled(false);
|
grid.setDisabled(false);
|
||||||
grid.setVisible(true);
|
grid.setVisible(true);
|
||||||
grid.getStore().setData(response.result.data);
|
grid.setData(response.result.data);
|
||||||
grid.getSelectionModel().selectAll();
|
grid.getSelectionModel().selectAll();
|
||||||
// we've shown a big list, center the window again
|
// we've shown a big list, center the window again
|
||||||
view.center();
|
view.center();
|
||||||
@ -294,10 +298,14 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
|
|||||||
onGetValues: function(values) {
|
onGetValues: function(values) {
|
||||||
let me = this;
|
let me = this;
|
||||||
|
|
||||||
if (values.snapshots === 'all') {
|
if (values !== "all" &&
|
||||||
delete values.snapshots;
|
Ext.isString(values.snapshots) &&
|
||||||
} else if (Ext.isString(values.snapshots) && values.snapshots) {
|
values.snapshots &&
|
||||||
|
values.snapshots.indexOf(':') !== -1
|
||||||
|
) {
|
||||||
values.snapshots = values.snapshots.split(',');
|
values.snapshots = values.snapshots.split(',');
|
||||||
|
} else {
|
||||||
|
delete values.snapshots;
|
||||||
}
|
}
|
||||||
|
|
||||||
return values;
|
return values;
|
||||||
@ -593,6 +601,8 @@ Ext.define('PBS.TapeManagement.SnapshotGrid', {
|
|||||||
let me = this;
|
let me = this;
|
||||||
let snapshots = [];
|
let snapshots = [];
|
||||||
|
|
||||||
|
let storeCounts = {};
|
||||||
|
|
||||||
me.getSelection().forEach((rec) => {
|
me.getSelection().forEach((rec) => {
|
||||||
let id = rec.get('id');
|
let id = rec.get('id');
|
||||||
let store = rec.data.store;
|
let store = rec.data.store;
|
||||||
@ -600,6 +610,10 @@ Ext.define('PBS.TapeManagement.SnapshotGrid', {
|
|||||||
// only add if not filtered
|
// only add if not filtered
|
||||||
if (me.store.findExact('id', id) !== -1) {
|
if (me.store.findExact('id', id) !== -1) {
|
||||||
snapshots.push(`${store}:${snap}`);
|
snapshots.push(`${store}:${snap}`);
|
||||||
|
if (storeCounts[store] === undefined) {
|
||||||
|
storeCounts[store] = 0;
|
||||||
|
}
|
||||||
|
storeCounts[store]++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -610,6 +624,21 @@ Ext.define('PBS.TapeManagement.SnapshotGrid', {
|
|||||||
return "all";
|
return "all";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let wholeStores = [];
|
||||||
|
let wholeStoresSelected = true;
|
||||||
|
for (const [store, count] of Object.entries(storeCounts)) {
|
||||||
|
if (me.storeCounts[store] === count) {
|
||||||
|
wholeStores.push(store);
|
||||||
|
} else {
|
||||||
|
wholeStoresSelected = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wholeStoresSelected) {
|
||||||
|
return wholeStores;
|
||||||
|
}
|
||||||
|
|
||||||
return snapshots;
|
return snapshots;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -639,6 +668,20 @@ Ext.define('PBS.TapeManagement.SnapshotGrid', {
|
|||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setData: function(records) {
|
||||||
|
let me = this;
|
||||||
|
let storeCounts = {};
|
||||||
|
records.forEach((rec) => {
|
||||||
|
let store = rec.store;
|
||||||
|
if (storeCounts[store] === undefined) {
|
||||||
|
storeCounts[store] = 0;
|
||||||
|
}
|
||||||
|
storeCounts[store]++;
|
||||||
|
});
|
||||||
|
me.storeCounts = storeCounts;
|
||||||
|
me.getStore().setData(records);
|
||||||
|
},
|
||||||
|
|
||||||
scrollable: true,
|
scrollable: true,
|
||||||
plugins: 'gridfilters',
|
plugins: 'gridfilters',
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user