diff options
author | Alexander Moisseev <moiseev@mezonplus.ru> | 2018-07-21 15:00:22 +0300 |
---|---|---|
committer | Alexander Moisseev <moiseev@mezonplus.ru> | 2018-07-21 15:00:22 +0300 |
commit | 58912d8fcac2e5998841a1af017f442fc495d743 (patch) | |
tree | 96ddf4e087a552c3b1bc31dfaf4e6d257a0d4a02 /interface/js/app | |
parent | 4d6ccd8c06cee3cfe7fa7762060f31d58a8be992 (diff) | |
download | rspamd-58912d8fcac2e5998841a1af017f442fc495d743.tar.gz rspamd-58912d8fcac2e5998841a1af017f442fc495d743.zip |
[WebUI] Fix history reset for "All SERVERS" (#2346)
Diffstat (limited to 'interface/js/app')
-rw-r--r-- | interface/js/app/history.js | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/interface/js/app/history.js b/interface/js/app/history.js index b46ffd655..e91970663 100644 --- a/interface/js/app/history.js +++ b/interface/js/app/history.js @@ -696,29 +696,21 @@ define(["jquery", "footable", "humanize"], ft.errors.destroy(); delete ft.errors; } - if (checked_server === "All SERVERS") { - rspamd.queryNeighbours("errors", function () { - ui.getHistory(rspamd, tables, neighbours, checked_server); - ui.getErrors(rspamd, tables, neighbours, checked_server); - }); - } else { - $.ajax({ - dataType: "json", - type: "GET", - jsonp: false, - url: neighbours[checked_server].url + "historyreset", - beforeSend: function (xhr) { - xhr.setRequestHeader("Password", rspamd.getPassword()); - }, - success: function () { + + (function (callback) { + callback("historyreset", + function () { ui.getHistory(rspamd, tables, neighbours, checked_server); ui.getErrors(rspamd, tables, neighbours, checked_server); }, - error: function (data) { - rspamd.alertMessage("alert-modal alert-error", data.statusText); - } - }); - } + 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); + }, + "GET", {}, {} + ); + }((checked_server === "All SERVERS") ? rspamd.queryNeighbours : rspamd.queryLocal)); }); }; |