]> source.dussan.org Git - rspamd.git/commitdiff
[WebUI] Disable Refresh until ongoing requests 3555/head
authormoisseev <moiseev@mezonplus.ru>
Fri, 20 Nov 2020 10:14:54 +0000 (13:14 +0300)
committermoisseev <moiseev@mezonplus.ru>
Fri, 20 Nov 2020 10:14:54 +0000 (13:14 +0300)
are finished

interface/js/app/graph.js
interface/js/app/history.js
interface/js/app/rspamd.js
interface/js/app/stats.js

index d2e3c5ac6a0e5cc6cca3aa5135ebfffafc7ef7d5..54daf79c1d2ef02644ce35646b74f0cbac069c6b 100644 (file)
@@ -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}
index e9642d26a517cd5479e4e4e1ecde0722d5743c88..edf9e19cf6f3b72c8d5ee866100c4ba0c70c68c2 100644 (file)
@@ -370,6 +370,7 @@ define(["jquery", "footable"],
                         rspamd.destroyTable("history");
                     }
                 },
+                complete: function () { $("#refresh").removeAttr("disabled").removeClass("disabled"); },
                 errorMessage: "Cannot receive history",
             });
         };
index 3da8a82ed5cc225f02a9d2310be92ce2709e1425..7fb985347f62698c783e760a0d13245487d99061 100644 (file)
@@ -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);
     }
index 582c5017fd2e92cddeb03810e5115ce42c10e196..b674d25c370bd99679b058c0c11063347d0fed73 100644 (file)
@@ -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"