From 86f56ee5df302effd424b93d17490140fb3afd7f Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 20 Jan 2020 19:35:43 +0100 Subject: [PATCH] Make IP addresses links that send to the Query Log. Signed-off-by: DL6ER --- scripts/pi-hole/js/network.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/pi-hole/js/network.js b/scripts/pi-hole/js/network.js index 2320dfcd..f8e6f181 100644 --- a/scripts/pi-hole/js/network.js +++ b/scripts/pi-hole/js/network.js @@ -101,16 +101,21 @@ $(document).ready(function() { // Set number of queries to localized string (add thousand separators) $("td:eq(6)", row).html(data.numQueries.toLocaleString()); - var ips = data.ip; - var shortips = ips; - if (ips.length > MAXIPDISPLAY) { - shortips = ips.slice(0, MAXIPDISPLAY - 1); - shortips.push("..."); + var ips = []; + var maxiter = Math.min(data.ip.length, MAXIPDISPLAY); + for (let index = 0; index < maxiter; index++) { + var ip = data.ip[index]; + ips.push('' + ip + ''); + } + if (data.ip.length > MAXIPDISPLAY) { + // We hit the maximum above, add "..." to symbolize we would + // have more to show here + ips.push("..."); } - $("td:eq(0)", row).html(shortips.join("
")); + $("td:eq(0)", row).html(ips.join("
")); $("td:eq(0)", row).hover(function() { - this.title = ips.join("\n"); + this.title = data.ip.join("\n"); }); // MAC + Vendor field if available