summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2015-11-03 16:30:28 -0500
committerStephen Beaver <sbeaver@netgate.com>2015-11-03 16:31:05 -0500
commitbef0d0d98b646fe6051bbf34d376b0663c681b12 (patch)
treeeb5802ac0e780cb62f2686fceaeb2c6041485443 /src
parentf3e15492165e03d055bcf958962f8c39e6ac5449 (diff)
downloadpfsense-bef0d0d98b646fe6051bbf34d376b0663c681b12.zip
pfsense-bef0d0d98b646fe6051bbf34d376b0663c681b12.tar.gz
Added automatic error recovery and ajax busy flag
Diffstat (limited to 'src')
-rw-r--r--src/usr/local/www/widgets/javascript/thermal_sensors.js42
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);
}
OpenPOWER on IntegriCloud