From 1b34085ec52494c59b203908a4976d05aaa0f28f Mon Sep 17 00:00:00 2001 From: moisseev Date: Sat, 8 Aug 2020 20:59:27 +0300 Subject: [WebUI] Add Bayesian statistics info --- interface/js/app/stats.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'interface/js') 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) { -- cgit v1.2.3