From 08e7b0bed746fef1c17b409ed2ff605fb1b304a7 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 26 Apr 2023 08:52:53 +0200 Subject: [PATCH] Create table row for each DNS cache entry (settings page) Signed-off-by: DL6ER --- scripts/pi-hole/js/settings-system.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/pi-hole/js/settings-system.js b/scripts/pi-hole/js/settings-system.js index 3f0f3d8e..91b4b82f 100644 --- a/scripts/pi-hole/js/settings-system.js +++ b/scripts/pi-hole/js/settings-system.js @@ -47,14 +47,14 @@ function updateHostInfo() { function setMetrics(data, prefix) { for (const [key, val] of Object.entries(data)) { if (prefix === "sysinfo-dns-cache-content-") { + // Create table row for each DNS cache entry + const name = + val.name !== "OTHER" + ? "Valid " + (val.name !== null ? val.name : "TYPE " + val.type) + : "Other valid"; + const tr = "" + name + " records in cache:" + val.count + ""; // Append row to DNS cache table - $("#dns-cache-table").append( - "Valid " + - (val.name !== null ? val.name : "TYPE " + val.type) + - " records in cache:" + - val.count + - "" - ); + $("#dns-cache-table").append(tr); } else if (typeof val === "object") { setMetrics(val, prefix + key + "-"); } else if (prefix === "sysinfo-dns-replies-") {