[pve-devel] [PATCH pve-manager v2 2/2] firewall: properly detect changes when ip / cidr is used in rule

Stefan Hanreich s.hanreich at proxmox.com
Tue Jan 16 15:30:22 CET 2024


With the current implementation using queryDelay, this means that the
change event for the input never completes. This in turn leads to
the input panel never changing its dirty status. By using the
beforequery event we can simply cancel the query without resorting to
the queryDelay hack.

Reported-By: Mira Limbeck <m.limbeck at proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
---
 www/manager6/form/IPRefSelector.js | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/www/manager6/form/IPRefSelector.js b/www/manager6/form/IPRefSelector.js
index 7e5eea63a..d41cde5f5 100644
--- a/www/manager6/form/IPRefSelector.js
+++ b/www/manager6/form/IPRefSelector.js
@@ -56,15 +56,6 @@ Ext.define('PVE.form.IPRefSelector', {
 	    },
 	});
 
-	var disable_query_for_ips = function(f, value) {
-	    if (value === null ||
-		value.match(/^\d/)) { // IP address starts with \d
-		f.queryDelay = 9999999999; // hack: disable with long delay
-	    } else {
-		f.queryDelay = 10;
-	    }
-	};
-
 	var columns = [];
 
 	if (!me.ref_type) {
@@ -109,7 +100,9 @@ Ext.define('PVE.form.IPRefSelector', {
 	    },
 	});
 
-	me.on('change', disable_query_for_ips);
+	me.on('beforequery', function(queryPlan) {
+	    return !(queryPlan.query === null || queryPlan.query.match(/^\d/));
+	});
 
         me.callParent();
     },
-- 
2.39.2




More information about the pve-devel mailing list