From: moisseev Date: Sat, 5 Mar 2022 09:29:16 +0000 (+0300) Subject: [WebUI] Show scan time in server list X-Git-Tag: 3.2~30^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F4097%2Fhead;p=thirdparty%2Frspamd.git [WebUI] Show scan time in server list --- diff --git a/interface/index.html b/interface/index.html index b0727e1369..38d66a048c 100644 --- a/interface/index.html +++ b/interface/index.html @@ -163,6 +163,7 @@ Server name Host Status + Scan time Uptime Version Configuration ID diff --git a/interface/js/app/stats.js b/interface/js/app/stats.js index 41651550d6..8b38d7f10e 100644 --- a/interface/js/app/stats.js +++ b/interface/js/app/stats.js @@ -113,6 +113,10 @@ define(["jquery", "d3pie"], var version = "???"; var uptime = "???"; var short_id = "???"; + let scan_times = { + data: "???", + title: "" + }; if (val.status) { row_class = "success"; glyph_status = "fas fa-check"; @@ -124,8 +128,26 @@ define(["jquery", "d3pie"], } if (key === "All SERVERS") { short_id = ""; - } else if ("config_id" in val.data) { - short_id = val.data.config_id.substring(0, 8); + scan_times.data = ""; + } else { + if ("config_id" in val.data) { + short_id = val.data.config_id.substring(0, 8); + } + if ("scan_times" in val.data) { + const [min, max] = d3.extent(val.data.scan_times); + if (max) { + const f = d3.format(".3f"); + scan_times = { + data: "" + f(min) + "/" + f(d3.mean(val.data.scan_times)) + "/" + f(max) + "", + title: ' title="min/avg/max"' + }; + } else { + scan_times = { + data: "-", + title: ' title="Have not scanned anything yet"' + }; + } + } } } @@ -134,6 +156,7 @@ define(["jquery", "d3pie"], "" + key + "" + "" + val.host + "" + '' + + '" + scan_times.data + "" + '