From a004b90ea169e7fd269025638fcc425adaa00efb Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 8 Jan 2017 16:23:54 +0100 Subject: [PATCH 1/2] Top Clients List: Show IP address of host name when hovering over the link --- scripts/pi-hole/js/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 5030af14..0c26b22d 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -132,7 +132,7 @@ function escapeHtml(text) { function updateTopClientsChart() { $.getJSON("api.php?summaryRaw&getQuerySources", function(data) { var clienttable = $("#client-frequency").find("tbody:last"); - var domain, percentage, domainname; + var domain, percentage, domainname, domainip; for (domain in data.top_sources) { if ({}.hasOwnProperty.call(data.top_sources, domain)){ @@ -140,14 +140,17 @@ function updateTopClientsChart() { domain = escapeHtml(domain); if(domain.indexOf("|") > -1) { - domainname = domain.substr(0, domain.indexOf("|")); + var idx = domain.indexOf("|"); + domainname = domain.substr(0, idx); + domainip = domain.substr(idx+1, domain.length-idx); } else { domainname = domain; + domainip = domain; } - var url = ""+domainname+""; + var url = ""+domainname+""; percentage = data.top_sources[domain] / data.dns_queries_today * 100; clienttable.append(" " + url + " " + data.top_sources[domain] + "
Date: Sun, 8 Jan 2017 16:26:37 +0100 Subject: [PATCH 2/2] Show IP for forward destination (if available) --- scripts/pi-hole/js/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 0c26b22d..89b1d2ba 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -175,7 +175,8 @@ function updateForwardDestinations() { c.push(colors.shift()); if(key.indexOf("|") > -1) { - key = key.substr(0, key.indexOf("|")); + var idx = key.indexOf("|"); + key = key.substr(0, idx)+" ("+key.substr(idx+1, key.length-idx)+")"; } forwardDestinationChart.data.labels.push(key); });