summaryrefslogtreecommitdiffstats
path: root/interface/js
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2018-07-27 13:18:21 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2018-07-27 13:18:21 +0300
commit6414e55b02989de0ee7e1a7b5eb5c608933f9d3c (patch)
treef337f1fa246af0155878444815985472d65871f2 /interface/js
parentd2c793e71622bd55caea493c3f8f628a74c3e46b (diff)
downloadrspamd-6414e55b02989de0ee7e1a7b5eb5c608933f9d3c.tar.gz
rspamd-6414e55b02989de0ee7e1a7b5eb5c608933f9d3c.zip
[Minor] Use query function to get actions,
get actions from "local" if "All SERVERS" option is selected, sort conditional operators by action index
Diffstat (limited to 'interface/js')
-rw-r--r--interface/js/app/config.js30
-rw-r--r--interface/js/app/rspamd.js2
2 files changed, 12 insertions, 20 deletions
diff --git a/interface/js/app/config.js b/interface/js/app/config.js
index ab0aa9371..b0ba4fcc8 100644
--- a/interface/js/app/config.js
+++ b/interface/js/app/config.js
@@ -135,29 +135,21 @@ define(["jquery"],
return JSON.stringify(values);
}
- function getActions(rspamd) {
- $.ajax({
- dataType: "json",
- type: "GET",
- url: "actions",
- jsonp: false,
- beforeSend: function (xhr) {
- xhr.setRequestHeader("Password", rspamd.getPassword());
- },
- success: function (data) {
- // Order of sliders greylist -> probable spam -> rewrite subject -> spam
+ ui.getActions = function getActions(rspamd, checked_server) {
+ rspamd.query("actions",
+ function (data) {
$("#actionsBody").empty();
$("#actionsForm").empty();
var items = [];
- $.each(data, function (i, item) {
+ $.each(data[0].data, function (i, item) {
var idx = -1;
var label;
- if (item.action === "add header") {
- label = "Probably Spam";
- idx = 1;
- } else if (item.action === "greylist") {
+ 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;
@@ -230,8 +222,9 @@ define(["jquery"],
saveActions("All SERVERS");
});
},
- });
- }
+ null, "GET", {}, {}, {}, (checked_server === "All SERVERS") ? "local" : checked_server
+ );
+ };
// @upload edited actions
ui.setup = function (rspamd) {
@@ -278,7 +271,6 @@ define(["jquery"],
});
};
- ui.getActions = getActions;
ui.getMaps = getMaps;
return ui;
diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js
index 162717288..909e34900 100644
--- a/interface/js/app/rspamd.js
+++ b/interface/js/app/rspamd.js
@@ -119,7 +119,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
});
break;
case "#configuration_nav":
- tab_config.getActions(ui);
+ tab_config.getActions(ui, checked_server);
tab_config.getMaps(ui);
break;
case "#symbols_nav":