diff options
author | Alexander Moisseev <moiseev@mezonplus.ru> | 2018-07-25 10:42:02 +0300 |
---|---|---|
committer | Alexander Moisseev <moiseev@mezonplus.ru> | 2018-07-25 10:42:02 +0300 |
commit | d8977873d6e6552b0290c0171c6908c6c45bb24f (patch) | |
tree | f04c0820f6dc39e2c6567e86933c5350661391f5 /interface/js/app/history.js | |
parent | 6d95ea817c68b5fd507ec85b63ce1d7f8b4295e5 (diff) | |
download | rspamd-d8977873d6e6552b0290c0171c6908c6c45bb24f.tar.gz rspamd-d8977873d6e6552b0290c0171c6908c6c45bb24f.zip |
[WebUI] Refactor query functions into one
Diffstat (limited to 'interface/js/app/history.js')
-rw-r--r-- | interface/js/app/history.js | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/interface/js/app/history.js b/interface/js/app/history.js index e91970663..4e5a69870 100644 --- a/interface/js/app/history.js +++ b/interface/js/app/history.js @@ -570,7 +570,7 @@ define(["jquery", "footable", "humanize"], }; if (checked_server === "All SERVERS") { - rspamd.queryNeighbours("history", function (req_data) { + rspamd.query("history", function (req_data) { function differentVersions(neighbours_data) { var dv = neighbours_data.some(function (e) { return e.version !== neighbours_data[0].version; @@ -697,20 +697,18 @@ define(["jquery", "footable", "humanize"], delete ft.errors; } - (function (callback) { - callback("historyreset", - function () { - ui.getHistory(rspamd, tables, neighbours, checked_server); - ui.getErrors(rspamd, tables, neighbours, checked_server); - }, - 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)); + rspamd.query("historyreset", + function () { + ui.getHistory(rspamd, tables, neighbours, checked_server); + ui.getErrors(rspamd, tables, neighbours, checked_server); + }, + 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", {}, {} + ); }); }; @@ -766,7 +764,7 @@ define(["jquery", "footable", "humanize"], } }); } else { - rspamd.queryNeighbours("errors", function (req_data) { + rspamd.query("errors", function (req_data) { var neighbours_data = req_data .filter(function (d) { return d.status; |