From ea4ebc3acaca01683e1d5111aaa5afac3dea0a15 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 21 Oct 2023 18:43:42 +0200 Subject: [PATCH 1/2] Show active clients instead of clients-ever-seen on the dashboard. When the two numbers are different, show both Signed-off-by: DL6ER --- scripts/pi-hole/js/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 814ad143..7a8ce3f7 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -384,7 +384,10 @@ function updateSummaryData(runOnce) { $.getJSON("/api/stats/summary", function (data) { var intl = new Intl.NumberFormat(); glowIfChanged($("span#dns_queries"), intl.format(parseInt(data.queries.total, 10))); - glowIfChanged($("span#total_clients"), intl.format(parseInt(data.clients.total, 10))); + let clientsString = intl.format(parseInt(data.clients.active, 10)); + if (data.clients.active !== data.clients.total) + clientsString += " / " + intl.format(parseInt(data.clients.total, 10)); + glowIfChanged($("span#total_clients"), clientsString); glowIfChanged($("span#blocked_queries"), intl.format(parseFloat(data.queries.blocked))); glowIfChanged( $("span#percent_blocked"), From 606a1de47a02aa4de17b8336ec1185272b4bb725 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 22 Oct 2023 09:28:36 +0200 Subject: [PATCH 2/2] Show total clients in hover title instead Signed-off-by: DL6ER --- index.lp | 4 ++-- scripts/pi-hole/js/index.js | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/index.lp b/index.lp index ba246f4e..713b6ca6 100644 --- a/index.lp +++ b/index.lp @@ -22,8 +22,8 @@ mg.include('scripts/pi-hole/lua/header_authenticated.lp','r')
- - - active clients + + - active clients diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 7a8ce3f7..6620de17 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -384,10 +384,11 @@ function updateSummaryData(runOnce) { $.getJSON("/api/stats/summary", function (data) { var intl = new Intl.NumberFormat(); glowIfChanged($("span#dns_queries"), intl.format(parseInt(data.queries.total, 10))); - let clientsString = intl.format(parseInt(data.clients.active, 10)); - if (data.clients.active !== data.clients.total) - clientsString += " / " + intl.format(parseInt(data.clients.total, 10)); - glowIfChanged($("span#total_clients"), clientsString); + glowIfChanged($("span#active_clients"), intl.format(parseInt(data.clients.active, 10))); + $("a#total_clients").attr( + "title", + intl.format(parseInt(data.clients.total, 10)) + " total clients" + ); glowIfChanged($("span#blocked_queries"), intl.format(parseFloat(data.queries.blocked))); glowIfChanged( $("span#percent_blocked"),