]> source.dussan.org Git - rspamd.git/commitdiff
[WebUI] Rework v2 symbols display
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 20 Mar 2017 13:43:29 +0000 (13:43 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 20 Mar 2017 13:43:29 +0000 (13:43 +0000)
interface/js/app/history.js

index d26dce277d6f6398a0587139a98b769c6c553bfa..8756a5f5a7d5b654a7b93576f7aca3e400622d2a 100644 (file)
@@ -68,8 +68,21 @@ function($, _, Humanize) {
           function (i, item) {
 
             preprocess_item(item);
-            var symbols = Object.keys(item.symbols);
-            item.symbols = symbols
+            Object.keys(item.symbols).map(function(key) {
+                var sym = item.symbols[key];
+                var str = '<strong>' + key + '</strong>' + "(" + sym.score + ")";
+
+               if (sym.options) {
+                   str += '[' + sym.options.join(",") + "]";
+               }
+               item.symbols[key].str = str;
+            });
+            item.symbols = Object.values(item.symbols).
+                sort(function(e1, e2) {
+                    return Math.abs(e1.score) < Math.abs(e2.score);
+                }).
+                map(function(e) { return e.str; }).
+                join("<br>\n");
             item.time = {
                 "value": unix_time_format(item.unix_time),
                 "options": {