diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2014-10-03 23:25:43 +0300 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2014-10-03 23:25:43 +0300 |
commit | 6542f06c08ce415917da41f8dc65b0669201ae37 (patch) | |
tree | 7ea0f6cfe91b801b141cd1a7e904b891dae7ebac | |
parent | f1424df13468aa08c4968cd405fa032f1a45e971 (diff) |
fixed minor issue in app_groups; prevent refreshing the charts if the page does not have focus
-rwxr-xr-x | conf.d/apps_groups.conf | 7 | ||||
-rwxr-xr-x[-rw-r--r--] | web/index.js | 22 |
2 files changed, 23 insertions, 6 deletions
diff --git a/conf.d/apps_groups.conf b/conf.d/apps_groups.conf index 7d8015aba7..53446158f3 100755 --- a/conf.d/apps_groups.conf +++ b/conf.d/apps_groups.conf @@ -20,10 +20,11 @@ # If a group_name starts with a -, the dimension will be hidden (cpu chart only) # -media: mplayer vlc xine mediatomb +compile: cc1 cc1plus as gcc +media: mplayer vlc xine mediatomb omxplayer omxplayer.bin squid: squid squid2 squid3 apache: apache apache2 -mysql: mysqld as mysql +mysql: mysqld mysql asterisk: asterisk opensips: opensips opensips-mi-pro stund radius: radiusd radiusclient @@ -46,7 +47,7 @@ vbox: vboxwebsrv VBoxXPCOMIPCD VBoxSVC log: ulogd syslogd syslog-ng rsyslogd logrotate nms: snmpd vnstatd smokeping zabbix_agentd monit munin-node mon openhpid ppp: ppp pppd pptpd pptpctrl -inetd: inetd xinetd as inetd +inetd: inetd xinetd openvpn: openvpn cron: cron atd ha: corosync hs_logd ha_logd stonithd diff --git a/web/index.js b/web/index.js index e2422259f2..9f7becb57e 100644..100755 --- a/web/index.js +++ b/web/index.js @@ -1,3 +1,5 @@ +var page_is_visible = 1;
+
var TARGET_THUMB_GRAPH_WIDTH = 500; // thumb charts width will range from 0.5 to 1.5 of that
var MINIMUM_THUMB_GRAPH_WIDTH = 400; // thumb chart will generally try to be wider than that
var TARGET_THUMB_GRAPH_HEIGHT = 180; // the height of the thumb charts
@@ -504,14 +506,19 @@ function checkRefreshThread() { // never call it directly, or new javascript threads will be spawn
var timeout = null;
function chartsRefresh() {
+ last_refresh = new Date().getTime();
+
+ if(!page_is_visible) {
+ timeout = setTimeout(triggerRefresh, 500);
+ return;
+ }
+
if(resize_request) {
resizeCharts();
resize_request = false;
// refresh_mode = REFRESH_ALWAYS;
}
- last_refresh = new Date().getTime();
-
if(refresh_mode == REFRESH_PAUSED) {
if(mode == MODE_MAIN && mainchart.last_updated == 0) {
mainChartRefresh();
@@ -991,6 +998,15 @@ function initCharts() { });
}
+$(window).blur(function() {
+ page_is_visible = 0;
+ mylog('blur');
+});
+
+$(window).focus(function() {
+ page_is_visible = 1;
+ mylog('focus');
+});
+
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(initCharts);
-
|