From: Giorgio Ravera Date: Tue, 26 May 2026 16:02:33 +0000 (+0200) Subject: Fix to search bar X-Git-Url: http://git.giorgioravera.it/?a=commitdiff_plain;h=78825c9ad1bbf67d6abf26ec4700e04b1c9a09aa;p=network-manager.git Fix to search bar --- diff --git a/frontend/js/aliases.js b/frontend/js/aliases.js index a04b343..dc8887b 100644 --- a/frontend/js/aliases.js +++ b/frontend/js/aliases.js @@ -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 + } + }); } // ----------------------------- diff --git a/frontend/js/devices.js b/frontend/js/devices.js index 6102906..72224c3 100644 --- a/frontend/js/devices.js +++ b/frontend/js/devices.js @@ -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 + } + }); } // ----------------------------- diff --git a/frontend/js/hosts.js b/frontend/js/hosts.js index f65e328..93ff0fc 100644 --- a/frontend/js/hosts.js +++ b/frontend/js/hosts.js @@ -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 + } + }); } // ----------------------------- diff --git a/frontend/js/leases.js b/frontend/js/leases.js index f704d3d..289f691 100644 --- a/frontend/js/leases.js +++ b/frontend/js/leases.js @@ -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 + } + }); } // -----------------------------