]> source.dussan.org Git - rspamd.git/commitdiff
[WebUI] Add Bayesian statistics info
authormoisseev <moiseev@mezonplus.ru>
Sat, 8 Aug 2020 17:59:27 +0000 (20:59 +0300)
committermoisseev <moiseev@mezonplus.ru>
Sat, 8 Aug 2020 17:59:27 +0000 (20:59 +0300)
interface/css/rspamd.css
interface/index.html
interface/js/app/stats.js

index a0852cfa9c248db885f7d158e98abb769801d915..6394e449c798d46659b5b7381111f220a52313c1 100644 (file)
@@ -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%;
index 480fa79ad7ba34b5a80d95b83181e03ed48dd86c..71314e282f94b7056fcaa365cd06bf6b2817c9a0 100644 (file)
                                                                <span class="h6 font-weight-bolder my-2">Servers</span>
                                                        </div>
                                                                <div class="card-body p-0 table-responsive">
-                                                                       <table class="table table-sm table-hover table-bordered text-nowrap mb-0" id="clusterTable">
+                                                                       <table class="table status-table table-sm table-hover table-bordered text-nowrap mb-0" id="clusterTable">
                                                                                <thead class="text-secondary">
                                                                                        <tr>
                                                                                                <th></th>
                                                                        </table>
                                                                </div>
                                                </div>
+                                               <div class="card bg-light shadow my-3">
+                                                       <div class="card-header text-secondary py-2">
+                                                               <span class="icon mr-3"><i class="fas fa-dice"></i></span>
+                                                               <span class="h6 font-weight-bolder my-2">Bayesian statistics</span>
+                                                       </div>
+                                                               <div class="card-body p-0 table-responsive">
+                                                                       <table class="table status-table table-sm table-bordered text-nowrap mb-0" id="bayesTable">
+                                                                               <thead class="text-secondary">
+                                                                                       <tr>
+                                                                                               <th>Server name</th>
+                                                                                               <th>Symbol</th>
+                                                                                               <th>Type</th>
+                                                                                               <th>Learns</th>
+                                                                                               <th>Users</th>
+                                                                                       </tr>
+                                                                               </thead>
+                                                                               <tbody>
+                                                                               </tbody>
+                                                                       </table>
+                                                               </div>
+                                               </div>
                                        </div>
                                        <div class="col-lg-6">
                                                <div class="card bg-light shadow my-3">
index 57e16261e125523d26a30a8e87b28e8cd58f8b92..532aec9220803b66aa4c471502da90446def8329 100644 (file)
@@ -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("<tr>" +
+                      (i === 0 ? '<td rowspan="' + statfiles.length + '">' + server + "</td>" : "") +
+                      '<td class="' + cls + '">' + statfile.symbol + "</td>" +
+                      '<td class="' + cls + '">' + statfile.type + "</td>" +
+                      '<td class="' + cls + '">' + statfile.revision + "</td>" +
+                      '<td class="' + cls + '">' + statfile.users + "</td></tr>");
+                });
+            }
+            $("#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) {