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

Fiona Ebner f.ebner at proxmox.com
Fri Jul 7 10:02:30 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>
---

New in v2.

 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 bf2c8df7..4b04ac30 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