Show cache info on Settings page

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2018-08-21 15:42:15 +02:00
parent c2dbefecc2
commit 77efbac43d
2 changed files with 50 additions and 0 deletions

View File

@@ -140,6 +140,35 @@ $("#DHCPchk").click(function() {
$("#dhcpnotice").prop("hidden", !this.checked).addClass("lookatme");
});
function loadCacheInfo()
{
$.getJSON("api.php?getCacheInfo", function(data) {
if("FTLnotrunning" in data)
{
return;
}
// Fill table with obtained values
$("#cache-size").text(parseInt(data["cacheinfo"]["cache-size"]));
$("#cache-inserted").text(parseInt(data["cacheinfo"]["cache-inserted"]));
// Highlight early cache removals when present
var cachelivefreed = parseInt(data["cacheinfo"]["cache-live-freed"]);
$("#cache-live-freed").text(cachelivefreed);
if(cachelivefreed > 0)
{
$("#cache-live-freed").parent("tr").addClass("lookatme");
}
else
{
$("#cache-live-freed").parent("tr").removeClass("lookatme")
}
// Update cache info every 10 seconds
setTimeout(loadCacheInfo, 10000);
});
}
var leasetable, staticleasetable;
$(document).ready(function() {
if(document.getElementById("DHCPLeasesTable"))
@@ -170,6 +199,8 @@ $(document).ready(function() {
staticleasetable.draw();
});
loadCacheInfo();
} );
// Handle hiding of alerts