]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Allow to query specific host 2374/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Thu, 26 Jul 2018 10:22:03 +0000 (13:22 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Thu, 26 Jul 2018 10:22:03 +0000 (13:22 +0300)
For now we need just `local`

interface/js/app/config.js
interface/js/app/rspamd.js
interface/js/app/stats.js
interface/js/app/symbols.js

index 490974209234f1cc64a95d4d6fcc87171425c89e..ab0aa937125882f8b9f776f4b87891d0c993ad97 100644 (file)
@@ -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");
                     });
                 },
             });
index c4832abdaa7291f8c341139ad45a1109e088a7b3..5edf24deb1168d9b6e47d184cae67b7845fc0db2 100644 (file)
@@ -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,
index 79e7cd6b501745aca75de7b2dda30e74a1aaf152..9eb36669a8ebd1a95dc3c9da8baf34382e911b69 100644 (file)
@@ -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");
             },
         };
 
index a8a0cc769ed73107dc945d52b3d2e63532fd9467..90ae71cf03cddfe8f72d45c3d355a499e55d5939 100644 (file)
@@ -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>" +
-                "&nbsp;<button data-save=\"cluster\" type=\"button\" class=\"btn btn-primary btn-sm mb-disabled\">Save in cluster</button>";
+                "&nbsp;<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);
                 });
         };