commit 4c7d0f2: [WebUI] Add fuzzy hashes info

moisseev moiseev at mezonplus.ru
Sun Aug 9 18:28:10 UTC 2020


Author: moisseev
Date: 2020-08-09 14:32:10 +0300
URL: https://github.com/rspamd/rspamd/commit/4c7d0f2f469b56088af9d53ff782f9304b5c67b3

[WebUI] Add fuzzy hashes info

---
 interface/index.html      | 19 +++++++++++++++++++
 interface/js/app/stats.js | 20 +++++++++++++++++---
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/interface/index.html b/interface/index.html
index 71314e282..bf241176b 100644
--- a/interface/index.html
+++ b/interface/index.html
@@ -145,6 +145,25 @@
 									</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-hashtag"></i></span>
+								<span class="h6 font-weight-bolder my-2">Fuzzy hashes</span>
+							</div>
+								<div class="card-body p-0 table-responsive">
+									<table class="table status-table table-sm table-bordered text-nowrap mb-0" id="fuzzyTable">
+										<thead class="text-secondary">
+											<tr>
+												<th>Server name</th>
+												<th>Storage</th>
+												<th>Hashes</th>
+											</tr>
+										</thead>
+										<tbody>
+										</tbody>
+									</table>
+								</div>
+						</div>
 					</div>
 					<div class="col-lg-6">
 						<div class="card bg-light shadow my-3">
diff --git a/interface/js/app/stats.js b/interface/js/app/stats.js
index 532aec922..38578866e 100644
--- a/interface/js/app/stats.js
+++ b/interface/js/app/stats.js
@@ -159,19 +159,33 @@ define(["jquery", "d3pie"],
                       (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>");
+                      '<td class="text-right ' + cls + '">' + statfile.revision + "</td>" +
+                      '<td class="text-right ' + cls + '">' + statfile.users + "</td></tr>");
                 });
             }
-            $("#bayesTable tbody").empty();
+
+            function addFuzzyStorage(server, storages) {
+                var i = 0;
+                $.each(storages, function (storage, hashes) {
+                    $("#fuzzyTable tbody").append("<tr>" +
+                      (i === 0 ? '<td rowspan="' + Object.keys(storages).length + '">' + server + "</td>" : "") +
+                      "<td>" + storage + "</td>" +
+                      '<td class="text-right">' + hashes + "</td></tr>");
+                    i++;
+                });
+            }
+
+            $("#bayesTable tbody, #fuzzyTable tbody").empty();
             if (checked_server === "All SERVERS") {
                 $.each(servers, function (server, val) {
                     if (server !== "All SERVERS") {
                         addStatfiles(server, val.data.statfiles);
+                        addFuzzyStorage(server, val.data.fuzzy_hashes);
                     }
                 });
             } else {
                 addStatfiles(checked_server, data.statfiles);
+                addFuzzyStorage(checked_server, data.fuzzy_hashes);
             }
         }
 


More information about the Commits mailing list