From b4d7f705d1f175aa1cc35ec48a41f577113061ab Mon Sep 17 00:00:00 2001 From: Michael Woolweaver Date: Mon, 8 Jul 2024 19:19:03 -0500 Subject: [PATCH 1/2] Makes the graphs for TopClients & TopDomains behave like ClientsOverTime depending on Privacy Level Signed-off-by: Michael Woolweaver --- scripts/pi-hole/js/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 1bad4b89d..87c336df8 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -294,8 +294,8 @@ function updateTopClientsTable(blocked) { // Add note if there are no results (e.g. privacy mode enabled) if (jQuery.isEmptyObject(data.clients)) { - clienttable.append('
- No data -
'); - overlay.hide(); + $("#client-frequency-blocked").remove(); + $("#client-frequency").remove(); return; } @@ -353,8 +353,8 @@ function updateTopDomainsTable(blocked) { // Add note if there are no results (e.g. privacy mode enabled) if (jQuery.isEmptyObject(data.domains)) { - domaintable.append('
- No data -
'); - overlay.hide(); + $("#ad-frequency").remove(); + $("#domain-frequency").remove(); return; } From 4be4f35f23509edc574f5b7ec825e5c3353a6e06 Mon Sep 17 00:00:00 2001 From: Michael Woolweaver Date: Mon, 8 Jul 2024 19:26:57 -0500 Subject: [PATCH 2/2] make comments match code changes Signed-off-by: Michael Woolweaver --- scripts/pi-hole/js/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 87c336df8..273b87d5d 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -292,7 +292,8 @@ function updateTopClientsTable(blocked) { let url, percentage; const sum = blocked ? data.blocked_queries : data.total_queries; - // Add note if there are no results (e.g. privacy mode enabled) + // Remove graph if there are no results (e.g. new + // installation or privacy mode enabled) if (jQuery.isEmptyObject(data.clients)) { $("#client-frequency-blocked").remove(); $("#client-frequency").remove(); @@ -351,7 +352,8 @@ function updateTopDomainsTable(blocked) { let url, domain, percentage, urlText; const sum = blocked ? data.blocked_queries : data.total_queries; - // Add note if there are no results (e.g. privacy mode enabled) + // Remove graph if there are no results (e.g. new + // installation or privacy mode enabled) if (jQuery.isEmptyObject(data.domains)) { $("#ad-frequency").remove(); $("#domain-frequency").remove();