public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-manager v2 2/2] firewall: properly detect changes when ip / cidr is used in rule
Date: Tue, 16 Jan 2024 15:30:22 +0100	[thread overview]
Message-ID: <20240116143022.359921-2-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20240116143022.359921-1-s.hanreich@proxmox.com>

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@proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich@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




  reply	other threads:[~2024-01-16 14:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16 14:30 [pve-devel] [PATCH pve-manager v2 1/2] fix #4963: firewall: fix editing firewall rules using ips / cidrs Stefan Hanreich
2024-01-16 14:30 ` Stefan Hanreich [this message]
2024-01-16 14:57   ` [pve-devel] [PATCH pve-manager v2 2/2] firewall: properly detect changes when ip / cidr is used in rule Mira Limbeck
2024-01-16 14:52 ` [pve-devel] [PATCH pve-manager v2 1/2] fix #4963: firewall: fix editing firewall rules using ips / cidrs Mira Limbeck
2024-02-14 11:39 ` Filip Schauer
2024-04-12  8:34 ` Stefan Hanreich
2024-04-12 12:21 ` [pve-devel] applied-series: " Fabian Grünbichler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240116143022.359921-2-s.hanreich@proxmox.com \
    --to=s.hanreich@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal