@@ -75,7 +75,6 @@ | |||
"no-loop-func": "off", | |||
"no-negated-condition": "off", | |||
"no-param-reassign": "off", | |||
"no-shadow": "off", | |||
"no-underscore-dangle": "off", | |||
"no-use-before-define": "off", | |||
"one-var-declaration-per-line": "off", |
@@ -49,8 +49,8 @@ define(["jquery"], | |||
xhr.setRequestHeader("Map", id); | |||
xhr.setRequestHeader("Debug", true); | |||
}, | |||
error: function (data) { | |||
save_map_error(rspamd, "local", null, null, data.statusText); | |||
error: function (jqXHR) { | |||
save_map_error(rspamd, "local", null, null, jqXHR.statusText); | |||
}, | |||
success: function () { save_map_success(rspamd); }, | |||
}); |
@@ -159,10 +159,10 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, | |||
function displayUI() { | |||
// @toggle auth and main | |||
var disconnect = $("#navBar .pull-right"); | |||
var buttons = $("#navBar .pull-right"); | |||
$("#mainUI").show(); | |||
$("#progress").show(); | |||
$(disconnect).show(); | |||
$(buttons).show(); | |||
tabClick("#refresh"); | |||
$("#progress").hide(); | |||
} | |||
@@ -284,12 +284,12 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, | |||
beforeSend: function (xhr) { | |||
xhr.setRequestHeader("Password", password); | |||
}, | |||
success: function (data) { | |||
success: function (json) { | |||
$("#connectPassword").val(""); | |||
if (data.auth === "failed") { | |||
if (json.auth === "failed") { | |||
// Is actually never returned by Rspamd | |||
} else { | |||
if (data.read_only) { | |||
if (json.read_only) { | |||
ui.read_only = true; | |||
$("#learning_nav").hide(); | |||
$("#resetHistory").attr("disabled", true); | |||
@@ -307,8 +307,8 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, | |||
displayUI(); | |||
} | |||
}, | |||
error: function (data) { | |||
ui.alertMessage("alert-modal alert-error", data.statusText); | |||
error: function (jqXHR) { | |||
ui.alertMessage("alert-modal alert-error", jqXHR.statusText); | |||
$("#connectPassword").val(""); | |||
$("#connectPassword").focus(); | |||
} | |||
@@ -402,14 +402,14 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, | |||
} | |||
}, | |||
url: neighbours_status[ind].url + req_url, | |||
success: function (data) { | |||
success: function (json) { | |||
neighbours_status[ind].checked = true; | |||
if (jQuery.isEmptyObject(data)) { | |||
if (jQuery.isEmptyObject(json)) { | |||
neighbours_status[ind].status = false; // serv does not work | |||
} else { | |||
neighbours_status[ind].status = true; // serv does not work | |||
neighbours_status[ind].data = data; | |||
neighbours_status[ind].data = json; | |||
} | |||
if (neighbours_status.every(function (elt) { return elt.checked; })) { | |||
if (on_success) { |
@@ -56,9 +56,9 @@ define(["jquery"], | |||
xhr.setRequestHeader(name, value); | |||
}); | |||
}, | |||
success: function (data) { | |||
success: function (json) { | |||
cleanTextUpload(source); | |||
if (data.success) { | |||
if (json.success) { | |||
rspamd.alertMessage("alert-success", "Data successfully uploaded"); | |||
} | |||
}, | |||
@@ -89,38 +89,37 @@ define(["jquery"], | |||
beforeSend: function (xhr) { | |||
xhr.setRequestHeader("Password", rspamd.getPassword()); | |||
}, | |||
success: function (input) { | |||
var data = input; | |||
if (data.action) { | |||
success: function (json) { | |||
if (json.action) { | |||
rspamd.alertMessage("alert-success", "Data successfully scanned"); | |||
var action = ""; | |||
if (data.action === "clean" || "no action") { | |||
if (json.action === "clean" || "no action") { | |||
action = "label-success"; | |||
} | |||
else if (data.action === "rewrite subject" || "add header" || "probable spam") { | |||
else if (json.action === "rewrite subject" || "add header" || "probable spam") { | |||
action = "label-warning"; | |||
} | |||
else if (data.action === "spam") { | |||
else if (json.action === "spam") { | |||
action = "label-danger"; | |||
} | |||
var score = ""; | |||
if (data.score <= data.required_score) { | |||
if (json.score <= json.required_score) { | |||
score = "label-success"; | |||
} | |||
else if (data.score >= data.required_score) { | |||
else if (json.score >= json.required_score) { | |||
score = "label-danger"; | |||
} | |||
$("<tbody id=\"tmpBody\"><tr>" + | |||
"<td><span class=\"label " + action + "\">" + data.action + "</span></td>" + | |||
"<td><span class=\"label " + score + "\">" + data.score.toFixed(2) + "/" + data.required_score.toFixed(2) + "</span></td>" + | |||
"<td><span class=\"label " + action + "\">" + json.action + "</span></td>" + | |||
"<td><span class=\"label " + score + "\">" + json.score.toFixed(2) + "/" + json.required_score.toFixed(2) + "</span></td>" + | |||
"</tr></tbody>") | |||
.insertAfter("#scanOutput thead"); | |||
var sym_desc = {}; | |||
var nsym = 0; | |||
$.each(data.symbols, function (i, item) { | |||
$.each(json.symbols, function (i, item) { | |||
if (typeof item === "object") { | |||
var sym_id = "sym_" + nsym; | |||
if (item.description) { |