Skip to content

Commit

Permalink
Loop over all IPs to populate tooltip even when MAXIPDISPLAY is reached
Browse files Browse the repository at this point in the history
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
  • Loading branch information
rdwebdesign committed Aug 8, 2024
1 parent 88bf5a6 commit 30da90a
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions scripts/pi-hole/js/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,20 @@ $(function () {
$("td:eq(5)", row).html(data.numQueries.toLocaleString());

var ips = [],
iptxt = [];
maxiter = Math.min(data.ips.length, MAXIPDISPLAY);
for (index = 0; index < maxiter; index++) {
var ip = data.ips[index];
iptitles = [];

for (index = 0; index < data.ips.length; index++) {
var ip = data.ips[index],
iptext = ip.ip;

if (ip.name !== null && ip.name.length > 0) {
iptxt.push(ip.ip + " (" + ip.name + ")");
ips.push(
'<a href="queries.lp?client_ip=' + ip.ip + '">' + ip.ip + " (" + ip.name + ")</a>"
);
} else {
iptxt.push(ip.ip);
ips.push('<a href="queries.lp?client_ip=' + ip.ip + '">' + ip.ip + "</a>");
iptext = iptext + " (" + ip.name + ")";
}
iptitles.push(iptext);

Check failure on line 149 in scripts/pi-hole/js/network.js

View workflow job for this annotation

GitHub Actions / Node

Expected blank line before this statement.

// Olny add IPs to the table if we have not reached the maximum

Check failure on line 151 in scripts/pi-hole/js/network.js

View workflow job for this annotation

GitHub Actions / spell-check

Olny ==> Only

Check failure on line 151 in scripts/pi-hole/js/network.js

View workflow job for this annotation

GitHub Actions / spell-check

Olny ==> Only
if (index < MAXIPDISPLAY) {
ips.push('<a href="queries.lp?client_ip=' + ip.ip + '">' + iptext + "</a>");
}
}

Expand All @@ -157,7 +159,7 @@ $(function () {
// have more to show here
ips.push("...");
// Show the IPs on the title when there are more than MAXIPDISPLAY items
$("td:eq(0)", row).attr("title", iptxt.join("\n"));
$("td:eq(0)", row).attr("title", iptitles.join("\n"));
}

// Show the IPs in the first column
Expand Down

0 comments on commit 30da90a

Please sign in to comment.