$("#actionsFormField").attr("disabled", true);
}
- function saveActions(is_cluster) {
+ function saveActions(server) {
var elts = loadActionsFromForm();
// String to array for comparison
var eltsArray = JSON.parse(loadActionsFromForm());
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");
}
saveActions();
});
$("#saveActionsClusterBtn").on("click", function () {
- saveActions(true);
+ saveActions("All SERVERS");
});
},
});
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",
} 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,
rspamd.alertMessage("alert-error", "Cannot receive stats data from: " +
serv.name + ", error: " + errorThrown);
}
- }, "GET", {}, {}, {}, true);
+ }, "GET", {}, {}, {}, "All SERVERS");
},
};
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 = [];
"POST", {}, {
data: JSON.stringify(values),
dataType: "json",
- }, {}, is_cluster
+ }, {}, server
);
}
function decimalStep(number) {
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);
});
});
.on("click", ":button", function () {
var value = $(this).data("save");
if (!value) return;
- saveSymbols(rspamd, "./savesymbols", "symbolsTable", value === "cluster");
+ saveSymbols(rspamd, "./savesymbols", "symbolsTable", value);
});
};