diff options
author | moisseev <moiseev@mezonplus.ru> | 2020-11-19 11:06:54 +0300 |
---|---|---|
committer | moisseev <moiseev@mezonplus.ru> | 2020-11-19 11:06:54 +0300 |
commit | 4f1af03dc3c233be07caf289130690f5a9f9f3c0 (patch) | |
tree | 6f0f3bc7f010309d3dcf0a8e33d6189fb6efa25b /interface/js | |
parent | b6607510aa62373dc807583908db47139af80424 (diff) | |
download | rspamd-4f1af03dc3c233be07caf289130690f5a9f9f3c0.tar.gz rspamd-4f1af03dc3c233be07caf289130690f5a9f9f3c0.zip |
[WebUI] Add History tab autorefreshing
Issue: #820
Diffstat (limited to 'interface/js')
-rw-r--r-- | interface/js/app/rspamd.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index 360ba603e..5312efa51 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -145,6 +145,7 @@ function ($, D3pie, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_ if (id !== "#autoRefresh") tab_stat.statWidgets(ui, graphs, checked_server); $(".preset").show(); + $(".history").hide(); $(".dynamic").hide(); }()); break; @@ -165,6 +166,7 @@ function ($, D3pie, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_ if (id !== "#autoRefresh") tab_graph.draw(ui, graphs, tables, neighbours, checked_server, selData); $(".preset").hide(); + $(".history").hide(); $(".dynamic").show(); }()); break; @@ -176,8 +178,20 @@ function ($, D3pie, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_ tab_symbols.getSymbols(ui, tables, checked_server); break; case "#history_nav": - tab_history.getHistory(ui, tables); - tab_history.getErrors(ui, tables); + (function () { + function getHistoryAndErrors() { + tab_history.getHistory(ui, tables); + tab_history.getErrors(ui, tables); + } + var refreshInterval = $(".dropdown-menu a.active.history").data("value"); + setAutoRefresh(refreshInterval, "history", + function () { return getHistoryAndErrors(); }); + if (id !== "#autoRefresh") getHistoryAndErrors(); + + $(".preset").hide(); + $(".history").show(); + $(".dynamic").hide(); + }()); break; case "#disconnect": disconnect(); @@ -414,7 +428,7 @@ function ($, D3pie, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_ $(".dropdown-menu a").click(function (e) { e.preventDefault(); var classList = $(this).attr("class"); - var menuClass = (/\b(?:dynamic|preset)\b/).exec(classList)[0]; + var menuClass = (/\b(?:dynamic|history|preset)\b/).exec(classList)[0]; $(".dropdown-menu a.active." + menuClass).removeClass("active"); $(this).addClass("active"); tabClick("#autoRefresh"); |