summaryrefslogtreecommitdiffstats
path: root/interface/js
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2018-07-22 15:13:19 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2018-07-22 15:13:19 +0300
commit1c458fb87095401a74513f297843cea01a19c9f5 (patch)
tree992d548658097a86d6dcd2bae7577fe4a1886d8d /interface/js
parentc609a22631380f40a938deffb97fe6353a6138bb (diff)
downloadrspamd-1c458fb87095401a74513f297843cea01a19c9f5.tar.gz
rspamd-1c458fb87095401a74513f297843cea01a19c9f5.zip
[WebUI] Do not execute `on_success` callback
if all requests to neighbours failed
Diffstat (limited to 'interface/js')
-rw-r--r--interface/js/app/rspamd.js25
1 files changed, 11 insertions, 14 deletions
diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js
index 5d2fd682a..2d82a99c7 100644
--- a/interface/js/app/rspamd.js
+++ b/interface/js/app/rspamd.js
@@ -402,16 +402,9 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
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].status = true; // serv works
neighbours_status[ind].data = json;
}
- if (neighbours_status.every(function (elt) { return elt.checked; })) {
- if (on_success) {
- on_success(neighbours_status);
- } else {
- alertMessage("alert-success", "Request completed");
- }
- }
},
error: function (jqXHR, textStatus, errorThrown) {
neighbours_status[ind].status = false;
@@ -423,16 +416,20 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
alertMessage("alert-error", "Cannot receive data from " +
neighbours_status[ind].host + ": " + errorThrown);
}
- if (neighbours_status.every(
- function (elt) { return elt.checked; })) {
- if (on_success) {
- on_success(neighbours_status);
+ },
+ complete: function () {
+ if (neighbours_status.every(function (elt) { return elt.checked; })) {
+ if (neighbours_status.some(function (elt) { return elt.status; })) {
+ if (on_success) {
+ on_success(neighbours_status);
+ } else {
+ alertMessage("alert-success", "Request completed");
+ }
} else {
- alertMessage("alert-success", "Request completed");
+ alertMessage("alert-error", "Request failed");
}
}
}
- // error display
};
if (params) {
$.each(params, function (k, v) {