From: moisseev Date: Fri, 20 Nov 2020 10:14:54 +0000 (+0300) Subject: [WebUI] Disable Refresh until ongoing requests X-Git-Tag: 2.7~130^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F3555%2Fhead;p=rspamd.git [WebUI] Disable Refresh until ongoing requests are finished --- diff --git a/interface/js/app/graph.js b/interface/js/app/graph.js index d2e3c5ac6..54daf79c1 100644 --- a/interface/js/app/graph.js +++ b/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} diff --git a/interface/js/app/history.js b/interface/js/app/history.js index e9642d26a..edf9e19cf 100644 --- a/interface/js/app/history.js +++ b/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", }); }; diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index 3da8a82ed..7fb985347 100644 --- a/interface/js/app/rspamd.js +++ b/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); } diff --git a/interface/js/app/stats.js b/interface/js/app/stats.js index 582c5017f..b674d25c3 100644 --- a/interface/js/app/stats.js +++ b/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"