aboutsummaryrefslogtreecommitdiffstats
path: root/interface/js/app
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2018-10-13 20:46:53 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2018-10-13 20:51:43 +0300
commitb0155b7757d541dc59fec0fc3c3f7f4f97c5469f (patch)
tree96c1fd5f2858b0e60f2437f1043a837ea1027944 /interface/js/app
parentb8447825ac4f9da4f9ebef45bd15a26b8b7d17e3 (diff)
downloadrspamd-b0155b7757d541dc59fec0fc3c3f7f4f97c5469f.tar.gz
rspamd-b0155b7757d541dc59fec0fc3c3f7f4f97c5469f.zip
[WebUI] Colorize symbols
Diffstat (limited to 'interface/js/app')
-rw-r--r--interface/js/app/history.js27
1 files changed, 19 insertions, 8 deletions
diff --git a/interface/js/app/history.js b/interface/js/app/history.js
index 184be994c..8717d2e8e 100644
--- a/interface/js/app/history.js
+++ b/interface/js/app/history.js
@@ -177,24 +177,36 @@ define(["jquery", "footable", "humanize"],
return {full:full, shrt:shrt};
}
+ function get_symbol_class(name, score) {
+ if (name.match(/^GREYLIST$/)) {
+ return "symbol-special";
+ }
+
+ if (score < 0) {
+ return "symbol-negative";
+ } else if (score > 0) {
+ return "symbol-positive";
+ }
+ return null;
+ }
+
preprocess_item(item);
Object.keys(item.symbols).forEach(function (key) {
- var str = null;
var sym = item.symbols[key];
+ sym.str = '<span class="symbol-default ' + get_symbol_class(sym.name, sym.score) + '"><strong>';
if (sym.description) {
- str = "<strong><abbr data-sym-key=\"" + key + "\">" + sym.name + "</abbr></strong>(" + sym.score + ")";
-
+ sym.str += '<abbr data-sym-key="' + key + '">' +
+ sym.name + "</abbr></strong> (" + sym.score + ")</span>";
// Store description for tooltip
symbolDescriptions[key] = sym.description;
} else {
- str = "<strong>" + sym.name + "</strong>(" + sym.score + ")";
+ sym.str += sym.name + "</strong> (" + sym.score + ")</span>";
}
if (sym.options) {
- str += "[" + sym.options.join(",") + "]";
+ sym.str += " [" + sym.options.join(",") + "]";
}
- sym.str = str;
});
unsorted_symbols.push(item.symbols);
item.symbols = sort_symbols(item.symbols, compare_function);
@@ -204,8 +216,7 @@ define(["jquery", "footable", "humanize"],
sortValue: item.unix_time
}
};
- var scan_time = item.time_real.toFixed(3) + " / " +
- item.time_virtual.toFixed(3);
+ var scan_time = item.time_real.toFixed(3) + " / " + item.time_virtual.toFixed(3);
item.scan_time = {
options: {
sortValue: item.time_real