diff options
author | Phil Davis <phil.davis@inf.org> | 2015-07-01 14:15:10 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-07-01 14:15:10 +0545 |
commit | e24519893a2a740a42430aa57b8d9cf2d89d7f1e (patch) | |
tree | 46e41485590a046c6b091a089c6fb3551137b397 /usr/local/www/widgets/javascript | |
parent | 342f509028bc675c81172fb89275fd60ec761399 (diff) | |
download | pfsense-e24519893a2a740a42430aa57b8d9cf2d89d7f1e.zip pfsense-e24519893a2a740a42430aa57b8d9cf2d89d7f1e.tar.gz |
Only process Traffic Graph object if it is open
Reduces useless CPU use on the pfSense box when the dashboard is
displayed with the Traffic Graphs widget.
Diffstat (limited to 'usr/local/www/widgets/javascript')
-rw-r--r-- | usr/local/www/widgets/javascript/traffic_graph.js | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/usr/local/www/widgets/javascript/traffic_graph.js b/usr/local/www/widgets/javascript/traffic_graph.js index dcfd4f3..383a549 100644 --- a/usr/local/www/widgets/javascript/traffic_graph.js +++ b/usr/local/www/widgets/javascript/traffic_graph.js @@ -1,34 +1,41 @@ -function trafficshowDiv(incDiv,swapButtons){ - //appear element +function trafficshowDiv(incDiv,ifDescription,refreshIntervalSec,swapButtons) { + // put the graph object HTML in the element and make it appear selectedDiv = incDiv + "graphdiv"; - jQuery('#' + selectedDiv).effect('blind',{mode:'show'},1000); - d = document; - if (swapButtons){ + jQuery('#' + selectedDiv).html( + '<object data="graph.php?ifnum=' + incDiv + '&ifname=' + ifDescription + '&timeint=' + refreshIntervalSec + '&initdelay=0" height="100%" width="100%">' + + '<param name="id" value="graph" />' + + '<param name="type" value="image/svg+xml" />' + + '<param name="pluginspage" value="http://www.adobe.com/svg/viewer/install/auto" />' + + '</object>'); + jQuery('#' + selectedDiv).effect('blind',{mode:'show'},1000); + d = document; + if (swapButtons) { selectIntLink = selectedDiv + "-min"; textlink = d.getElementById(selectIntLink); - textlink.style.display = "inline"; - + textlink.style.display = "inline"; + selectIntLink = selectedDiv + "-open"; textlink = d.getElementById(selectIntLink); textlink.style.display = "none"; } - document.iform["shown[" + incDiv + "]"].value = "show"; + document.traffic_graphs_widget_iform["shown[" + incDiv + "]"].value = "show"; } - -function trafficminimizeDiv(incDiv,swapButtons){ - //fade element + +function trafficminimizeDiv(incDiv,swapButtons) { + // remove the graph object HTML from the element (so it does not keep using CPU) and fade selectedDiv = incDiv + "graphdiv"; + jQuery('#' + selectedDiv).html(''); jQuery('#' + selectedDiv).effect('blind',{mode:'hide'},1000); - d = document; - if (swapButtons){ + d = document; + if (swapButtons) { selectIntLink = selectedDiv + "-open"; textlink = d.getElementById(selectIntLink); - textlink.style.display = "inline"; - + textlink.style.display = "inline"; + selectIntLink = selectedDiv + "-min"; textlink = d.getElementById(selectIntLink); textlink.style.display = "none"; - } - document.iform["shown[" + incDiv + "]"].value = "hide"; + } + document.traffic_graphs_widget_iform["shown[" + incDiv + "]"].value = "hide"; } |