fixed minor issue in app_groups; prevent refreshing the charts if the page does not have focus
Costa Tsaousis (ktsaou) committed
Oct 3, 2014 at 23:25 UTC
6542f06c08ce415917da41f8dc65b0669201ae37
2 files changed
+23
-6
conf.d/apps_groups.conf
+4
-3
@@ -20,10 +20,11 @@
20
# If a group_name starts with a -, the dimension will be hidden (cpu chart only)
21
#
22
23
-media: mplayer vlc xine mediatomb
23
+compile: cc1 cc1plus as gcc
24
+media: mplayer vlc xine mediatomb omxplayer omxplayer.bin
25
squid: squid squid2 squid3
26
apache: apache apache2
26
-mysql: mysqld as mysql
27
+mysql: mysqld mysql
28
asterisk: asterisk
29
opensips: opensips opensips-mi-pro stund
30
radius: radiusd radiusclient
@@ -46,7 +47,7 @@ vbox: vboxwebsrv VBoxXPCOMIPCD VBoxSVC
47
log: ulogd syslogd syslog-ng rsyslogd logrotate
48
nms: snmpd vnstatd smokeping zabbix_agentd monit munin-node mon openhpid
49
ppp: ppp pppd pptpd pptpctrl
49
-inetd: inetd xinetd as inetd
50
+inetd: inetd xinetd
51
openvpn: openvpn
52
cron: cron atd
53
ha: corosync hs_logd ha_logd stonithd
web/index.js
+19
-3
@@ -1,3 +1,5 @@
1
+var page_is_visible = 1;
2
+
3
var TARGET_THUMB_GRAPH_WIDTH = 500; // thumb charts width will range from 0.5 to 1.5 of that
4
var MINIMUM_THUMB_GRAPH_WIDTH = 400; // thumb chart will generally try to be wider than that
5
var TARGET_THUMB_GRAPH_HEIGHT = 180; // the height of the thumb charts
@@ -504,14 +506,19 @@ function checkRefreshThread() {
506
// never call it directly, or new javascript threads will be spawn
507
var timeout = null;
508
function chartsRefresh() {
509
+ last_refresh = new Date().getTime();
510
+
511
+ if(!page_is_visible) {
512
+ timeout = setTimeout(triggerRefresh, 500);
513
+ return;
514
+ }
515
+
516
if(resize_request) {
517
resizeCharts();
518
resize_request = false;
519
// refresh_mode = REFRESH_ALWAYS;
520
}
521
513
- last_refresh = new Date().getTime();
514
-
522
if(refresh_mode == REFRESH_PAUSED) {
523
if(mode == MODE_MAIN && mainchart.last_updated == 0) {
524
mainChartRefresh();
@@ -991,6 +998,15 @@ function initCharts() {
998
});
999
}
1000
1001
+$(window).blur(function() {
1002
+ page_is_visible = 0;
1003
+ mylog('blur');
1004
+});
1005
+
1006
+$(window).focus(function() {
1007
+ page_is_visible = 1;
1008
+ mylog('focus');
1009
+});
1010
+
1011
// Set a callback to run when the Google Visualization API is loaded.
1012
google.setOnLoadCallback(initCharts);
996
-