From 1b34085ec52494c59b203908a4976d05aaa0f28f Mon Sep 17 00:00:00 2001 From: moisseev Date: Sat, 8 Aug 2020 20:59:27 +0300 Subject: [PATCH] [WebUI] Add Bayesian statistics info --- interface/css/rspamd.css | 32 ++++++++++++++++---------------- interface/index.html | 23 ++++++++++++++++++++++- interface/js/app/stats.js | 31 +++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 17 deletions(-) diff --git a/interface/css/rspamd.css b/interface/css/rspamd.css index a0852cfa9..6394e449c 100644 --- a/interface/css/rspamd.css +++ b/interface/css/rspamd.css @@ -288,6 +288,22 @@ table#symbolsTable input[type="number"] { margin-right: 9px; } +.status-table td:last-child { + border-right: none; +} +.status-table tr:last-child td { + border-bottom: none; +} +.status-table thead th:last-child { + border-right: none; +} +.status-table tr:last-child td:first-child { + border-radius: 0 0 0 calc(.25rem - 1px); +} +.status-table tr:last-child td:last-child { + border-radius: 0 0 calc(.25rem - 1px) 0; +} + /* RRD summary */ #summary-row { padding-left: 80px; @@ -486,22 +502,6 @@ table#symbolsTable input[type="number"] { padding: 15px; } -#clusterTable td:last-child { - border-right: none; -} -#clusterTable tr:last-child td { - border-bottom: none; -} -#clusterTable thead th:last-child { - border-right: none; -} -#clusterTable tr:last-child td:first-child { - border-radius: 0 0 0 calc(.25rem - 1px); -} -#clusterTable tr:last-child td:last-child { - border-radius: 0 0 calc(.25rem - 1px) 0; -} - #modalDialog > .modal-dialog { /* Center the modal vertically */ top: 50%; diff --git a/interface/index.html b/interface/index.html index 480fa79ad..71314e282 100644 --- a/interface/index.html +++ b/interface/index.html @@ -107,7 +107,7 @@ Servers
- +
@@ -124,6 +124,27 @@
+
+
+ + Bayesian statistics +
+
+ + + + + + + + + + + + +
Server nameSymbolTypeLearnsUsers
+
+
diff --git a/interface/js/app/stats.js b/interface/js/app/stats.js index 57e16261e..532aec922 100644 --- a/interface/js/app/stats.js +++ b/interface/js/app/stats.js @@ -142,6 +142,37 @@ define(["jquery", "d3pie"], $('#selSrv [value="' + key + '"]').prop("disabled", true); } }); + + function addStatfiles(server, statfiles) { + $.each(statfiles, function (i, statfile) { + var cls = ""; + switch (statfile.symbol) { + case "BAYES_SPAM": + cls = "symbol-positive"; + break; + case "BAYES_HAM": + cls = "symbol-negative"; + break; + default: + } + $("#bayesTable tbody").append("" + + (i === 0 ? '' + server + "" : "") + + '' + statfile.symbol + "" + + '' + statfile.type + "" + + '' + statfile.revision + "" + + '' + statfile.users + ""); + }); + } + $("#bayesTable tbody").empty(); + if (checked_server === "All SERVERS") { + $.each(servers, function (server, val) { + if (server !== "All SERVERS") { + addStatfiles(server, val.data.statfiles); + } + }); + } else { + addStatfiles(checked_server, data.statfiles); + } } function getChart(rspamd, pie, checked_server) { -- 2.39.5