commit 587c521: [WebUI] Use actions names as labels

moisseev moiseev at mezonplus.ru
Fri Aug 7 17:14:07 UTC 2020


Author: moisseev
Date: 2020-08-07 20:03:13 +0300
URL: https://github.com/rspamd/rspamd/commit/587c5215b6bab63f073fc202dcfe44fa3b84d725 (refs/pull/3462/head)

[WebUI] Use actions names as labels

---
 interface/js/app/config.js | 19 +++----------------
 interface/js/app/graph.js  | 12 ++++++------
 interface/js/app/stats.js  | 10 +++++-----
 3 files changed, 14 insertions(+), 27 deletions(-)

diff --git a/interface/js/app/config.js b/interface/js/app/config.js
index 8b391582b..082806088 100644
--- a/interface/js/app/config.js
+++ b/interface/js/app/config.js
@@ -33,27 +33,14 @@ define(["jquery", "codejar", "linenumbers", "prism"],
                     $("#actionsFormField").empty();
                     var items = [];
                     $.each(data[0].data, function (i, item) {
-                        var idx = -1;
-                        var label = null;
-                        if (item.action === "greylist") {
-                            label = "Greylist";
-                            idx = 0;
-                        } else if (item.action === "add header") {
-                            label = "Probably Spam";
-                            idx = 1;
-                        } else if (item.action === "rewrite subject") {
-                            label = "Rewrite subject";
-                            idx = 2;
-                        } else if (item.action === "reject") {
-                            label = "Spam";
-                            idx = 3;
-                        }
+                        var actionsOrder = ["greylist", "add header", "rewrite subject", "reject"];
+                        var idx = actionsOrder.indexOf(item.action);
                         if (idx >= 0) {
                             items.push({
                                 idx: idx,
                                 html:
                                 '<div class="form-group">' +
-                                    '<label class="col-form-label col-md-2 float-left">' + label + "</label>" +
+                                    '<label class="col-form-label col-md-2 float-left">' + item.action + "</label>" +
                                     '<div class="controls slider-controls col-md-10">' +
                                         '<input class="action-scores form-control" data-id="action" type="number" value="' +
                                           item.value + '">' +
diff --git a/interface/js/app/graph.js b/interface/js/app/graph.js
index 624566a8a..d2e3c5ac6 100644
--- a/interface/js/app/graph.js
+++ b/interface/js/app/graph.js
@@ -65,22 +65,22 @@ define(["jquery", "d3evolution", "footable"],
             legend: {
                 space: 140,
                 entries: [{
-                    label: "Rejected",
+                    label: "reject",
                     color: "#FF0000"
                 }, {
-                    label: "Temporarily rejected",
+                    label: "soft reject",
                     color: "#BF8040"
                 }, {
-                    label: "Subject rewritten",
+                    label: "rewrite subject",
                     color: "#FF6600"
                 }, {
-                    label: "Probable spam",
+                    label: "add header",
                     color: "#FFAD00"
                 }, {
-                    label: "Greylisted",
+                    label: "greylist",
                     color: "#436EEE"
                 }, {
-                    label: "Clean",
+                    label: "no action",
                     color: "#66CC00"
                 }]
             }
diff --git a/interface/js/app/stats.js b/interface/js/app/stats.js
index 26ac26b44..18c3a2c08 100644
--- a/interface/js/app/stats.js
+++ b/interface/js/app/stats.js
@@ -146,27 +146,27 @@ define(["jquery", "d3pie"],
             var data = creds[checked_server].data.actions;
             var new_data = [{
                 color: "#66CC00",
-                label: "Clean",
+                label: "no action",
                 data: data["no action"],
                 value: data["no action"]
             }, {
                 color: "#BF8040",
-                label: "Temporarily rejected",
+                label: "soft reject",
                 data: data["soft reject"],
                 value: data["soft reject"]
             }, {
                 color: "#FFAD00",
-                label: "Probable spam",
+                label: "add header",
                 data: data["add header"],
                 value: data["add header"]
             }, {
                 color: "#436EEE",
-                label: "Greylisted",
+                label: "greylist",
                 data: data.greylist,
                 value: data.greylist
             }, {
                 color: "#FF0000",
-                label: "Rejected",
+                label: "reject",
                 data: data.reject,
                 value: data.reject
             }];


More information about the Commits mailing list