diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2015-11-03 16:30:28 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2015-11-03 16:31:05 -0500 |
commit | bef0d0d98b646fe6051bbf34d376b0663c681b12 (patch) | |
tree | eb5802ac0e780cb62f2686fceaeb2c6041485443 /src/usr | |
parent | f3e15492165e03d055bcf958962f8c39e6ac5449 (diff) | |
download | pfsense-bef0d0d98b646fe6051bbf34d376b0663c681b12.zip pfsense-bef0d0d98b646fe6051bbf34d376b0663c681b12.tar.gz |
Added automatic error recovery and ajax busy flag
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/local/www/widgets/javascript/thermal_sensors.js | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/src/usr/local/www/widgets/javascript/thermal_sensors.js b/src/usr/local/www/widgets/javascript/thermal_sensors.js index 8db1c11..d48f925 100644 --- a/src/usr/local/www/widgets/javascript/thermal_sensors.js +++ b/src/usr/local/www/widgets/javascript/thermal_sensors.js @@ -54,29 +54,31 @@ warningTemp = 9999; criticalTemp = 100; +ajaxBusy = false; //should be called from "thermal_sensors.widget.php" function showThermalSensorsData() { - - //get data from thermal_sensors.widget.php - url = "/widgets/widgets/thermal_sensors.widget.php?getThermalSensorsData=1" - //IE fix to disable cache when using http:// , just append timespan - + new Date().getTime(); - - jQuery.ajax(url, { - type: 'get', - success: function(data) { - var thermalSensorsData = data || ""; - buildThermalSensorsData(thermalSensorsData); - }, - error: function(jqXHR, status, error) { - buildThermalSensorsDataRaw( - "Error getting data from [thermal_sensors.widget.php] - |" + - "status: [" + (status || "") + "]|" + - "error: [" + (error || "") + "]"); - } - }); - + if(!ajaxBusy) { + ajaxBusy = true; + //get data from thermal_sensors.widget.php + url = "/widgets/widgets/thermal_sensors.widget.php?getThermalSensorsData=1" + //IE fix to disable cache when using http:// , just append timespan + + new Date().getTime(); + + jQuery.ajax(url, { + type: 'get', + success: function(data) { + var thermalSensorsData = data || ""; + buildThermalSensorsData(thermalSensorsData); + }, + error: function(jqXHR, status, error) { + warningTemp = 9999; + buildThermalSensorsDataRaw('<span class="alert-danger">Temperature data could not be read.</span>'); + } + }); + + ajaxBusy = false; + } //call itself in 11 seconds window.setTimeout(showThermalSensorsData, 11000); } |