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-") {