diff options
author | Alexander Moisseev <moiseev@mezonplus.ru> | 2018-07-26 13:22:03 +0300 |
---|---|---|
committer | Alexander Moisseev <moiseev@mezonplus.ru> | 2018-07-26 13:22:03 +0300 |
commit | b26dcfab8b83b54ef545cbe32a27dd1e62075558 (patch) | |
tree | ffcc66c117b8afbf816a8cae57dc4026ddca32dc /interface/js | |
parent | 27517142cf5364fd8cc8532e76e18adb8cf11a4d (diff) | |
download | rspamd-b26dcfab8b83b54ef545cbe32a27dd1e62075558.tar.gz rspamd-b26dcfab8b83b54ef545cbe32a27dd1e62075558.zip |
[Minor] Allow to query specific host
For now we need just `local`
Diffstat (limited to 'interface/js')
-rw-r--r-- | interface/js/app/config.js | 6 | ||||
-rw-r--r-- | interface/js/app/rspamd.js | 11 | ||||
-rw-r--r-- | interface/js/app/stats.js | 2 | ||||
-rw-r--r-- | interface/js/app/symbols.js | 8 |
4 files changed, 14 insertions, 13 deletions
diff --git a/interface/js/app/config.js b/interface/js/app/config.js index 490974209..ab0aa9371 100644 --- a/interface/js/app/config.js +++ b/interface/js/app/config.js @@ -197,7 +197,7 @@ define(["jquery"], $("#actionsFormField").attr("disabled", true); } - function saveActions(is_cluster) { + function saveActions(server) { var elts = loadActionsFromForm(); // String to array for comparison var eltsArray = JSON.parse(loadActionsFromForm()); @@ -217,7 +217,7 @@ define(["jquery"], rspamd.query("saveactions", null, null, "POST", {}, { data: elts, dataType: "json" - }, {}, is_cluster); + }, {}, server); } else { rspamd.alertMessage("alert-modal alert-error", "Incorrect order of metric actions threshold"); } @@ -227,7 +227,7 @@ define(["jquery"], saveActions(); }); $("#saveActionsClusterBtn").on("click", function () { - saveActions(true); + saveActions("All SERVERS"); }); }, }); diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index c4832abda..5edf24deb 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -464,8 +464,9 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, ui.getPassword = getPassword; - ui.query = function (req_url, on_success, on_error, method, headers, params, req_data, is_cluster) { - if (checked_server === "All SERVERS" || is_cluster) { + ui.query = function (req_url, on_success, on_error, method, headers, params, req_data, server) { + var srv = (server) ? server : checked_server; + if (srv === "All SERVERS") { $.ajax({ dataType: "json", type: "GET", @@ -507,9 +508,9 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, } else { var neighbours_status = []; neighbours_status[0] = { - name: checked_server, - url: neighbours[checked_server].url, - host: neighbours[checked_server].host, + name: srv, + url: (srv === "local") ? "" : neighbours[srv].url, + host: (srv === "local") ? "local" : neighbours[srv].host, checked: false, data: {}, status: false, diff --git a/interface/js/app/stats.js b/interface/js/app/stats.js index 79e7cd6b5..9eb36669a 100644 --- a/interface/js/app/stats.js +++ b/interface/js/app/stats.js @@ -227,7 +227,7 @@ define(["jquery", "d3pie", "humanize"], rspamd.alertMessage("alert-error", "Cannot receive stats data from: " + serv.name + ", error: " + errorThrown); } - }, "GET", {}, {}, {}, true); + }, "GET", {}, {}, {}, "All SERVERS"); }, }; diff --git a/interface/js/app/symbols.js b/interface/js/app/symbols.js index a8a0cc769..90ae71cf0 100644 --- a/interface/js/app/symbols.js +++ b/interface/js/app/symbols.js @@ -30,7 +30,7 @@ define(["jquery", "footable"], var ft = {}; var ui = {}; - function saveSymbols(rspamd, action, id, is_cluster) { + function saveSymbols(rspamd, action, id, server) { var inputs = $("#" + id + " :input[data-role=\"numerictextbox\"]"); var url = action; var values = []; @@ -53,7 +53,7 @@ define(["jquery", "footable"], "POST", {}, { data: JSON.stringify(values), dataType: "json", - }, {}, is_cluster + }, {}, server ); } function decimalStep(number) { @@ -103,7 +103,7 @@ define(["jquery", "footable"], distinct_groups.push(item.group); } item.save = "<button type=\"button\" data-save=\"local\" class=\"btn btn-primary btn-sm mb-disabled\">Save</button>" + - " <button data-save=\"cluster\" type=\"button\" class=\"btn btn-primary btn-sm mb-disabled\">Save in cluster</button>"; + " <button data-save=\"All SERVERS\" type=\"button\" class=\"btn btn-primary btn-sm mb-disabled\">Save in cluster</button>"; items.push(item); }); }); @@ -240,7 +240,7 @@ define(["jquery", "footable"], .on("click", ":button", function () { var value = $(this).data("save"); if (!value) return; - saveSymbols(rspamd, "./savesymbols", "symbolsTable", value === "cluster"); + saveSymbols(rspamd, "./savesymbols", "symbolsTable", value); }); }; |