[pve-devel] [PATCH v3 manager 2/3] ui: vm selector: don't add invalid not found items

Fiona Ebner f.ebner at proxmox.com
Mon Sep 25 13:58:40 CEST 2023


Doing a simple numericity check and warn in the console so developers
can notice if there is something off.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak at proxmox.com>
---

No changes in v3.

 www/manager6/form/VMSelector.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/www/manager6/form/VMSelector.js b/www/manager6/form/VMSelector.js
index 0c884aae..22f7dd11 100644
--- a/www/manager6/form/VMSelector.js
+++ b/www/manager6/form/VMSelector.js
@@ -136,7 +136,11 @@ Ext.define('PVE.form.VMSelector', {
 	let selection = value.map(item => {
 	    let found = store.findRecord('vmid', item, 0, false, true, true);
 	    if (!found) {
-		notFound.push(item);
+		if (Ext.isNumeric(item)) {
+		    notFound.push(item);
+		} else {
+		    console.warn(`invalid item in vm selection: ${item}`);
+		}
 	    }
 	    return found;
 	}).filter(r => r);
-- 
2.39.2






More information about the pve-devel mailing list