aboutsummaryrefslogtreecommitdiffstats
path: root/interface
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2018-09-28 12:48:19 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2018-09-28 12:48:19 +0300
commit60d43c5247baf5231608166f9387d6e066cf6531 (patch)
treef89db991d615cf23676d083f9969c72afd725de3 /interface
parent4cf94ce5492657adf002920df2fa6f03c1f02f5f (diff)
downloadrspamd-60d43c5247baf5231608166f9387d6e066cf6531.tar.gz
rspamd-60d43c5247baf5231608166f9387d6e066cf6531.zip
[WebUI] History: add sorting by symbol score value
Diffstat (limited to 'interface')
-rw-r--r--interface/index.html3
-rw-r--r--interface/js/app/history.js26
2 files changed, 20 insertions, 9 deletions
diff --git a/interface/index.html b/interface/index.html
index 6eebef1d4..1cf363b96 100644
--- a/interface/index.html
+++ b/interface/index.html
@@ -291,7 +291,8 @@
<div class="form-group widget-title-form">
<label for="selSymOrder">Symbols order:</label>
<select id="selSymOrder" class="form-control">
- <option value="score" selected>Score</option>
+ <option value="magnitude" selected>Score magnitude</option>
+ <option value="score">Score value</option>
<option value="name">Name</option>
</select>
</div>
diff --git a/interface/js/app/history.js b/interface/js/app/history.js
index f82925b26..3d1983b23 100644
--- a/interface/js/app/history.js
+++ b/interface/js/app/history.js
@@ -113,7 +113,7 @@ define(["jquery", "footable", "humanize"],
}
function process_history_v2(data) {
- // Display no more than rcpt_lim recipients
+ // Display no more than rcpt_lim recipients
var rcpt_lim = 3;
var items = [];
@@ -121,13 +121,23 @@ define(["jquery", "footable", "humanize"],
var e = document.getElementById(id);
return e.options[e.selectedIndex].value;
}
- var compare = (getSelector("selSymOrder") === "score")
- ? function (e1, e2) {
- return Math.abs(e2.score) - Math.abs(e1.score);
- }
- : function (e1, e2) {
- return e1.name.localeCompare(e2.name);
- };
+ var compare = null;
+ switch (getSelector("selSymOrder")) {
+ case "score":
+ compare = function (e1, e2) {
+ return e2.score - e1.score;
+ };
+ break;
+ case "name":
+ compare = function (e1, e2) {
+ return e1.name.localeCompare(e2.name);
+ };
+ break;
+ default:
+ compare = function (e1, e2) {
+ return Math.abs(e2.score) - Math.abs(e1.score);
+ };
+ }
$("#selSymOrder, label[for='selSymOrder']").show();