fix #4239: ui: show selected but non-existing vmids in backup edit

by adding records manually when using 'setValue' on a vmselector.
It'll show up normally but have an 'unknown' nodename, and no type/status/etc.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Dominik Csapak 2023-03-06 15:23:34 +01:00 committed by Thomas Lamprecht
parent e440f8a46a
commit 7a5ca76aa1

View File

@ -132,7 +132,22 @@ Ext.define('PVE.form.VMSelector', {
let me = this;
let store = me.getStore();
let selection = value.map(item => store.findRecord('vmid', item, 0, false, true, true)).filter(r => r);
let notFound = [];
let selection = value.map(item => {
let found = store.findRecord('vmid', item, 0, false, true, true);
if (!found) {
notFound.push(item);
}
return found;
}).filter(r => r);
for (const vmid of notFound) {
let rec = store.add({
vmid,
node: 'unknown',
});
selection.push(rec[0]);
}
let sm = me.getSelectionModel();
if (selection.length) {