aboutsummaryrefslogtreecommitdiffstats
path: root/interface/js
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2016-12-30 16:49:16 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2016-12-30 18:35:13 +0300
commit2b0a2b8286a97792b805d3b40d0e36df7703c831 (patch)
tree5d8f8d82a05f50f99e7a55a435004c08f6638be0 /interface/js
parent6376057981199bb1a3e51babf8b446a5a0681977 (diff)
downloadrspamd-2b0a2b8286a97792b805d3b40d0e36df7703c831.tar.gz
rspamd-2b0a2b8286a97792b805d3b40d0e36df7703c831.zip
[WebUI] Stop stats refreshing if the page is hidden
Diffstat (limited to 'interface/js')
-rw-r--r--interface/js/rspamd.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/interface/js/rspamd.js b/interface/js/rspamd.js
index f2690baf5..6f3fc5040 100644
--- a/interface/js/rspamd.js
+++ b/interface/js/rspamd.js
@@ -69,7 +69,7 @@
symbols.destroy();
symbols = null;
}
- clearTimeout(stat_timeout);
+ Visibility.stop(stat_timeout);
cleanCredentials();
connectRSPAMD();
// window.location.reload();
@@ -78,11 +78,14 @@
$('#refresh').on('click', function (event) {
if (!$(this).attr('disabled')) {
$(this).attr('disabled', true);
- clearTimeout(stat_timeout);
+ Visibility.stop(stat_timeout);
+ statWidgets();
+ stat_timeout = Visibility.every(10000, function () {
+ statWidgets();
+ });
getChart();
getGraphData(selected.selData);
- statWidgets();
setTimeout(function () {
$('#refresh').removeAttr('disabled');
@@ -382,7 +385,6 @@
$('#statWidgets .left,#statWidgets .right').wrapAll('<li class="stat-box pull-right"><div class="widget"></div></li>');
$('#statWidgets').find('li.pull-right').appendTo('#statWidgets');
$(widgets).show();
- stat_timeout = window.setTimeout(statWidgets, 10000);
}
// @opem modal with target form enabled
$(document).on('click', '[data-toggle="modal"]', function (e) {
@@ -1264,6 +1266,9 @@
// @toggle auth and main
var disconnect = $('#navBar .pull-right');
statWidgets();
+ stat_timeout = Visibility.every(10000, function () {
+ statWidgets();
+ });
$('#mainUI').show();
$('#progress').show();