aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2022-03-06 17:14:04 +0000
committerGitHub <noreply@github.com>2022-03-06 17:14:04 +0000
commit67470931229eda9003de0911ba875e47321c5466 (patch)
tree19e77fe4b1fe9ec79c9db1c871c74ba19cec27ef
parent8bd5500b3fc61332e4e0a96b07f4174dd1068043 (diff)
parentda28099f0eceec09d315de0fa0a58340d4af86a2 (diff)
downloadrspamd-67470931229eda9003de0911ba875e47321c5466.tar.gz
rspamd-67470931229eda9003de0911ba875e47321c5466.zip
Merge pull request #4097 from moisseev/webui
Webui
-rw-r--r--.eslintrc.json3
-rw-r--r--interface/index.html1
-rw-r--r--interface/js/app/stats.js27
3 files changed, 28 insertions, 3 deletions
diff --git a/.eslintrc.json b/.eslintrc.json
index ff514b13c..4f0041692 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -1,6 +1,7 @@
{
"env": {
- "browser": true
+ "browser": true,
+ "es6": true
},
"extends": "eslint:all",
"globals": {
diff --git a/interface/index.html b/interface/index.html
index b0727e136..38d66a048 100644
--- a/interface/index.html
+++ b/interface/index.html
@@ -163,6 +163,7 @@
<th>Server name</th>
<th>Host</th>
<th class="w-1">Status</th>
+ <th class="w-1">Scan time</th>
<th class="w-1">Uptime</th>
<th class="w-1">Version</th>
<th>Configuration ID</th>
diff --git a/interface/js/app/stats.js b/interface/js/app/stats.js
index 41651550d..8b38d7f10 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: "<small>" + f(min) + "/</small>" + f(d3.mean(val.data.scan_times)) + "<small>/" + f(max) + "</small>",
+ title: ' title="min/avg/max"'
+ };
+ } else {
+ scan_times = {
+ data: "-",
+ title: ' title="Have not scanned anything yet"'
+ };
+ }
+ }
}
}
@@ -134,6 +156,7 @@ define(["jquery", "d3pie"],
"<td>" + key + "</td>" +
"<td>" + val.host + "</td>" +
'<td class="text-center"><span class="icon"><i class="' + glyph_status + '"></i></span></td>' +
+ '<td class="text-center"' + scan_times.title + ">" + scan_times.data + "</td>" +
'<td class="text-right' +
((Number.isFinite(val.data.uptime) && val.data.uptime < 3600)
? ' warning" title="Has been restarted within the last hour"'