From b09178f4ef54dc05c929b283f4b58f913ffad388 Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Wed, 2 Mar 2022 23:54:55 -0300 Subject: [PATCH] Undo index.js changes Signed-off-by: RD WebDesign --- scripts/pi-hole/js/index.js | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index b42b3822..9849d7aa 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -583,7 +583,7 @@ function updateForwardDestinationsPie() { } function updateTopClientsChart() { - $.getJSON("api.php?getQuerySources&topClientsBlocked", function (data) { + $.getJSON("api.php?summaryRaw&getQuerySources&topClientsBlocked", function (data) { if ("FTLnotrunning" in data) { return; } @@ -618,14 +618,12 @@ function updateTopClientsChart() { '">' + clientname + ""; - percentage = (data.top_sources[client] / summary.dns_queries_today) * 100; + percentage = (data.top_sources[client] / data.dns_queries_today) * 100; clienttable.append( " " + utils.addTD(url) + utils.addTD(data.top_sources[client]) + - utils.addTD( - utils.colorBar(percentage, summary.dns_queries_today, "progress-bar-blue") - ) + + utils.addTD(utils.colorBar(percentage, data.dns_queries_today, "progress-bar-blue")) + " " ); } @@ -660,14 +658,12 @@ function updateTopClientsChart() { '">' + clientname + ""; - percentage = (data.top_sources_blocked[client] / summary.ads_blocked_today) * 100; + percentage = (data.top_sources_blocked[client] / data.ads_blocked_today) * 100; clientblockedtable.append( " " + utils.addTD(url) + utils.addTD(data.top_sources_blocked[client]) + - utils.addTD( - utils.colorBar(percentage, summary.ads_blocked_today, "progress-bar-blue") - ) + + utils.addTD(utils.colorBar(percentage, data.ads_blocked_today, "progress-bar-blue")) + " " ); } @@ -691,7 +687,7 @@ function updateTopClientsChart() { } function updateTopLists() { - $.getJSON("api.php?topItems", function (data) { + $.getJSON("api.php?summaryRaw&topItems", function (data) { if ("FTLnotrunning" in data) { return; } @@ -713,14 +709,12 @@ function updateTopLists() { domain = utils.escapeHtml(domain); urlText = domain === "" ? "." : domain; url = '' + urlText + ""; - percentage = (data.top_queries[domain] / summary.dns_queries_today) * 100; + percentage = (data.top_queries[domain] / data.dns_queries_today) * 100; domaintable.append( " " + utils.addTD(url) + utils.addTD(data.top_queries[domain]) + - utils.addTD( - utils.colorBar(percentage, summary.dns_queries_today, "queries-permitted") - ) + + utils.addTD(utils.colorBar(percentage, data.dns_queries_today, "queries-permitted")) + " " ); } @@ -742,12 +736,12 @@ function updateTopLists() { domain = utils.escapeHtml(domain); urlText = domain === "" ? "." : domain; url = '' + urlText + ""; - percentage = (data.top_ads[domain] / summary.ads_blocked_today) * 100; + percentage = (data.top_ads[domain] / data.ads_blocked_today) * 100; adtable.append( " " + utils.addTD(url) + utils.addTD(data.top_ads[domain]) + - utils.addTD(utils.colorBar(percentage, summary.ads_blocked_today, "queries-blocked")) + + utils.addTD(utils.colorBar(percentage, data.ads_blocked_today, "queries-blocked")) + " " ); } @@ -765,7 +759,6 @@ function updateTopLists() { }); } -var summary; var FTLoffline = false; function updateSummaryData(runOnce) { var setTimer = function (timeInSeconds) { @@ -799,9 +792,6 @@ function updateSummaryData(runOnce) { updateTopLists(); } - // use the same data to update all lists - summary = data; - var formatter = new Intl.NumberFormat(); //Element name might have a different name to the property of the API so we split it at | [