]> git.giorgioravera.it Git - network-manager.git/commitdiff
Fix to search bar
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Tue, 26 May 2026 16:02:33 +0000 (18:02 +0200)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Tue, 26 May 2026 16:02:33 +0000 (18:02 +0200)
frontend/js/aliases.js
frontend/js/devices.js
frontend/js/hosts.js
frontend/js/leases.js

index a04b343bbd462d331c6d68cbadb31383b3e97a7b..dc8887bf494f72fbd3ed4f1dad388df804dd149b 100644 (file)
@@ -637,6 +637,18 @@ function initSearch() {
 
     // clean input on load
     input.value = "";
+    // live filter for each keystroke
+    input.addEventListener("input", filterAliases);
+    // Escape management when focus is in the input
+    input.addEventListener("keydown", (e) => {
+        if (e.key === "Escape") {
+            e.preventDefault();     // evita side-effect (es. chiusure di modali del browser)
+            e.stopPropagation();    // evita che arrivi al listener globale
+            resetSorting(sortState);
+            clearSearch();          // svuota input e ricarica tabella (come definito nella tua funzione)
+            filterAliases('');        // ripristina tabella
+        }
+    });
 }
 
 // -----------------------------
index 610290636e5ae1e0904131f87f918e2eae84bcbf..72224c3055ff7fc9f85eddcccd6721594cf35320 100644 (file)
@@ -754,6 +754,18 @@ function initSearch() {
 
     // clean input on load
     input.value = "";
+    // live filter for each keystroke
+    input.addEventListener("input", filterDevices);
+    // Escape management when focus is in the input
+    input.addEventListener("keydown", (e) => {
+        if (e.key === "Escape") {
+            e.preventDefault();       // evita side-effect (es. chiusure di modali del browser)
+            e.stopPropagation();      // evita che arrivi al listener globale
+            resetSorting(sortState);
+            clearSearch();            // svuota input e ricarica tabella (come definito nella tua funzione)
+            filterDevices('');        // ripristina tabella
+        }
+    });
 }
 
 // -----------------------------
index f65e32817067f1337c90ba5139c0c7e8d4b1a96e..93ff0fc8b6b537d505a681a5dbb7cc65baebffd1 100644 (file)
@@ -661,6 +661,18 @@ function initSearch() {
 
     // clean input on load
     input.value = "";
+    // live filter for each keystroke
+    input.addEventListener("input", filterHosts);
+    // Escape management when focus is in the input
+    input.addEventListener("keydown", (e) => {
+        if (e.key === "Escape") {
+            e.preventDefault();     // evita side-effect (es. chiusure di modali del browser)
+            e.stopPropagation();    // evita che arrivi al listener globale
+            resetSorting(sortState);
+            clearSearch();          // svuota input e ricarica tabella (come definito nella tua funzione)
+            filterHosts('');        // ripristina tabella
+        }
+    });
 }
 
 // -----------------------------
index f704d3dca3a64b2acb5112a57bac34173d62cd46..289f691f51b532f16855ca7094251b4ff58acd25 100644 (file)
@@ -625,6 +625,18 @@ function initSearch() {
 
     // clean input on load
     input.value = "";
+    // live filter for each keystroke
+    input.addEventListener("input", filterLeases);
+    // Escape management when focus is in the input
+    input.addEventListener("keydown", (e) => {
+        if (e.key === "Escape") {
+            e.preventDefault();     // evita side-effect (es. chiusure di modali del browser)
+            e.stopPropagation();    // evita che arrivi al listener globale
+            resetSorting(sortState);
+            clearSearch();          // svuota input e ricarica tabella (come definito nella tua funzione)
+            filterLeases('');        // ripristina tabella
+        }
+    });
 }
 
 // -----------------------------