summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/index.php
diff options
context:
space:
mode:
authorSteve Beaver <sbeaver@netgate.com>2017-08-09 10:50:19 -0400
committerSteve Beaver <sbeaver@netgate.com>2017-08-09 10:50:19 -0400
commit67dd6c11a4668673c0daac09bacf58685b80f1bf (patch)
treed6710a2f688d2279292d76e49c9b2ecc769241a1 /src/usr/local/www/index.php
parentec922197ed92e3dc0e15ab4d6ba340015f46bf43 (diff)
downloadpfsense-67dd6c11a4668673c0daac09bacf58685b80f1bf.zip
pfsense-67dd6c11a4668673c0daac09bacf58685b80f1bf.tar.gz
dd system information widget to central refresh system
Add ability for a widget to specify how often it wants to be updated
Diffstat (limited to 'src/usr/local/www/index.php')
-rw-r--r--src/usr/local/www/index.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/usr/local/www/index.php b/src/usr/local/www/index.php
index e14f2a3..8a1b997 100644
--- a/src/usr/local/www/index.php
+++ b/src/usr/local/www/index.php
@@ -572,6 +572,7 @@ function set_widget_checkbox_events(checkbox_panel_ref, all_none_button_id) {
var ajaxspecs = new Array(); // Array to hold widget refresh specifications (objects )
var ajaxidx = 0;
var ajaxmutex = false;
+var ajaxcntr = 0;
// Add a widget refresh object to the array list
function register_ajax(ws) {
@@ -661,9 +662,20 @@ events.push(function() {
// results back to the widget's callback function
function executewidget() {
if (ajaxspecs.length > 0) {
+ var freq = ajaxspecs[ajaxidx].freq; // widget can specifify it should be called freq times around hte loop
+
if (!ajaxmutex) {
- make_ajax_call(ajaxspecs[ajaxidx]);
- ajaxidx = ++ajaxidx % ajaxspecs.length;
+ if ((ajaxcntr % freq) === 0) {
+ make_ajax_call(ajaxspecs[ajaxidx]);
+ }
+
+ if (++ajaxidx >= ajaxspecs.length) {
+ ajaxidx = 0;
+
+ if (++ajaxcntr >= 4096) {
+ ajaxcntr = 0;
+ }
+ }
}
setTimeout(function() { executewidget(); }, 2000);
OpenPOWER on IntegriCloud