[pve-devel] [PATCH manager 6/7] fix #4239: ui: show selected but non-existing vmids in backup edit

Dominik Csapak d.csapak at proxmox.com
Mon Mar 6 15:23:34 CET 2023


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 at proxmox.com>
---
 www/manager6/form/VMSelector.js | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/www/manager6/form/VMSelector.js b/www/manager6/form/VMSelector.js
index 399c4e658..e9eb5dbaa 100644
--- a/www/manager6/form/VMSelector.js
+++ b/www/manager6/form/VMSelector.js
@@ -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) {
-- 
2.30.2






More information about the pve-devel mailing list