@@ -271,9 +271,7 @@ define(["jquery"], | |||
success: function () { | |||
save_map_success(rspamd); | |||
}, | |||
error: function (serv, jqXHR, textStatus, errorThrown) { | |||
save_map_error(rspamd, serv, jqXHR, textStatus, errorThrown); | |||
}, | |||
errorMessage: "Save map error", | |||
method: "POST", | |||
headers: { | |||
Map: id, |
@@ -704,11 +704,7 @@ define(["jquery", "footable", "humanize"], | |||
ui.getHistory(rspamd, tables, neighbours, checked_server); | |||
ui.getErrors(rspamd, tables, neighbours, checked_server); | |||
}, | |||
error: function (serv, jqXHR, textStatus, errorThrown) { | |||
var serv_name = (typeof serv === "string") ? serv : serv.name; | |||
rspamd.alertMessage("alert-error", | |||
"Cannot reset history log on " + serv_name + ": " + errorThrown); | |||
} | |||
errorMessage: "Cannot reset history log" | |||
}); | |||
}); | |||
}; | |||
@@ -757,12 +753,10 @@ define(["jquery", "footable", "humanize"], | |||
beforeSend: function (xhr) { | |||
xhr.setRequestHeader("Password", rspamd.getPassword()); | |||
}, | |||
error: function () { | |||
rspamd.alertMessage("alert-error", "Cannot receive errors"); | |||
}, | |||
success: function (data) { | |||
drawErrorsTable(data); | |||
} | |||
}, | |||
errorMessage: "Cannot receive errors" | |||
}); | |||
} else { | |||
rspamd.query("errors", { |
@@ -211,8 +211,8 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, | |||
o.error(neighbours_status[ind], | |||
jqXHR, textStatus, errorThrown); | |||
} else { | |||
alertMessage("alert-error", "Cannot receive data from " + | |||
neighbours_status[ind].host + ": " + errorThrown); | |||
alertMessage("alert-error", neighbours_status[ind].name + " > " + | |||
((o.errorMessage) ? o.errorMessage : "Request failed") + ": " + errorThrown); | |||
} | |||
}, | |||
complete: function () { | |||
@@ -459,6 +459,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, | |||
* | |||
* @param {Object|string|Array} [options.data] - Data to be sent to the server. | |||
* @param {Function} [options.error] - A function to be called if the request fails. | |||
* @param {string} [options.errorMessage] - Text to display in the alert message if the request fails. | |||
* @param {Object} [options.headers] - An object of additional header key/value pairs to send along with requests | |||
* using the XMLHttpRequest transport. | |||
* @param {string} [options.method] - The HTTP method to use for the request. | |||
@@ -472,7 +473,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, | |||
// Force options to be an object | |||
var o = options || {}; | |||
Object.keys(o).forEach(function (option) { | |||
if (["data", "error", "headers", "method", "params", "server", "success"].indexOf(option) < 0) { | |||
if (["data", "error", "errorMessage", "headers", "method", "params", "server", "success"].indexOf(option) < 0) { | |||
throw new Error("Unknown option: " + option); | |||
} | |||
}); |
@@ -50,11 +50,7 @@ define(["jquery", "footable"], | |||
success: function () { | |||
rspamd.alertMessage("alert-modal alert-success", "Symbols successfully saved"); | |||
}, | |||
error: function (serv, jqXHR, textStatus, errorThrown) { | |||
var serv_name = (typeof serv === "string") ? serv : serv.name; | |||
rspamd.alertMessage("alert-modal alert-error", | |||
"Save symbols error on " + serv_name + ": " + errorThrown); | |||
}, | |||
errorMessage: "Save symbols error", | |||
method: "POST", | |||
params: { | |||
data: JSON.stringify(values), | |||
@@ -237,9 +233,6 @@ define(["jquery", "footable"], | |||
} | |||
}); | |||
}, | |||
error: function (data) { | |||
rspamd.alertMessage("alert-modal alert-error", data.statusText); | |||
}, | |||
server: (checked_server === "All SERVERS") ? "local" : checked_server | |||
}); | |||
$("#symbolsTable") | |||
@@ -260,9 +253,6 @@ define(["jquery", "footable"], | |||
var items = process_symbols_data(data[0].data)[0]; | |||
ft.symbols.rows.load(items); | |||
}, | |||
error: function (data) { | |||
rspamd.alertMessage("alert-modal alert-error", data.statusText); | |||
}, | |||
server: (checked_server === "All SERVERS") ? "local" : checked_server | |||
}); | |||
}); |
@@ -148,10 +148,7 @@ define(["jquery"], | |||
rspamd.alertMessage("alert-error", "Cannot scan data"); | |||
} | |||
}, | |||
error: function (jqXHR, textStatus, errorThrown) { | |||
rspamd.alertMessage("alert-error", "Cannot upload data: " + | |||
textStatus + ", " + errorThrown); | |||
}, | |||
errorMessage: "Cannot upload data", | |||
statusCode: { | |||
404: function () { | |||
rspamd.alertMessage("alert-error", "Cannot upload data, no server found"); |