From d8977873d6e6552b0290c0171c6908c6c45bb24f Mon Sep 17 00:00:00 2001 From: Alexander Moisseev Date: Wed, 25 Jul 2018 10:42:02 +0300 Subject: [WebUI] Refactor query functions into one --- interface/js/app/history.js | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'interface/js/app/history.js') 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; -- cgit v1.2.3