Browse Source

[WebUI] Disable Refresh until ongoing requests

are finished
pull/3555/head
moisseev 5 years ago
parent
commit
94744ca826
  1. 1
      interface/js/app/graph.js
  2. 1
      interface/js/app/history.js
  3. 7
      interface/js/app/rspamd.js
  4. 1
      interface/js/app/stats.js

1
interface/js/app/graph.js

@ -285,6 +285,7 @@ define(["jquery", "d3evolution", "footable"],
}
updateWidgets(data);
},
complete: function () { $("#refresh").removeAttr("disabled").removeClass("disabled"); },
errorMessage: "Cannot receive throughput data",
errorOnceId: "alerted_graph_",
data: {type:type}

1
interface/js/app/history.js

@ -370,6 +370,7 @@ define(["jquery", "footable"],
rspamd.destroyTable("history");
}
},
complete: function () { $("#refresh").removeAttr("disabled").removeClass("disabled"); },
errorMessage: "Cannot receive history",
});
};

7
interface/js/app/rspamd.js

@ -91,7 +91,7 @@ function ($, D3pie, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_
var tab_id = id;
if ($(id).attr("disabled")) return;
var navBarControls = $("#selSrv, #navBar li, #navBar a, #navBar button");
navBarControls.attr("disabled", true).addClass("disabled", true);
if (id !== "#autoRefresh") navBarControls.attr("disabled", true).addClass("disabled", true);
stopTimers();
@ -126,6 +126,8 @@ function ($, D3pie, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_
if (!refreshInterval) return;
timer_id[timer] = Visibility.every(refreshInterval, function () {
countdown(refreshInterval);
if ($("#refresh").attr("disabled")) return;
$("#refresh").attr("disabled", true).addClass("disabled", true);
callback();
});
}
@ -200,6 +202,9 @@ function ($, D3pie, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_
}
setTimeout(function () {
// Do not enable Refresh button until AJAX requests to all neighbours are finished
if (tab_id === "#history_nav") navBarControls = $(navBarControls).not("#refresh");
navBarControls.removeAttr("disabled").removeClass("disabled");
}, (id === "#autoRefresh") ? 0 : 1000);
}

1
interface/js/app/stats.js

@ -367,6 +367,7 @@ define(["jquery", "d3pie"],
});
}, promises.length ? 100 : 0);
},
complete: function () { $("#refresh").removeAttr("disabled").removeClass("disabled"); },
errorMessage: "Cannot receive stats data",
errorOnceId: "alerted_stats_",
server: "All SERVERS"

Loading…
Cancel
Save