Browse code

minor revisions

Gandolf authored on 07/09/2021 23:35:12
Showing 1 changed files
... ...
@@ -231,6 +231,7 @@ function main() {
231 231
     initializeDateSelector();
232 232
     getNodeData();
233 233
     getNodeCharts();
234
+    setInterval(getNodeData, 10000);
234 235
 }
235 236
 
236 237
 function getNodeData() {
... ...
@@ -292,23 +293,19 @@ function displayData(dataItem) {
292 293
     statusElmt.innerHTML = "Online";
293 294
     statusElmt.style.color = "green";
294 295
 
295
-    chartUpdateInterval = dataItem.chartUpdateInterval;
296
-    dataRequestInterval = dataItem.dataRequestInterval;
296
+    chartUpdateInterval =  dataItem.chartUpdateInterval;
297 297
     periodElmt.innerHTML = chartUpdateInterval / 60;
298
-    setInterval(getNodeData, 1000 * dataRequestInterval);
299 298
     setInterval(getNodeCharts, 1000 * chartUpdateInterval);
300 299
 }
301 300
 
302 301
 function displayOfflineStatus() {
302
+    var localTimeZone;
303 303
     var d = new Date();
304
-    localTimeZone = d.getTimezoneOffset() / 60;
305
-    dateElmt.innerHTML = (d.getMonth() + 1) + "/" + d.getDate() + "/" +
306
-                          d.getFullYear();    
307
-    timeElmt.innerHTML = d.getHours() + ":" + d.getMinutes() +
308
-                         "  <small>(GMT+" + localTimeZone + ")</small>";
309
-    periodElmt.innerHTML = "?";    
304
+
310 305
     statusElmt.innerHTML = "offline";    
311 306
     statusElmt.style.color = "red";
307
+
308
+    periodElmt.innerHTML = "?";    
312 309
 }
313 310
 
314 311
 function initializeDateSelector() {
Browse code

minor revision

Gandolf authored on 07/06/2021 21:24:13
Showing 1 changed files
1 1
old mode 100644
2 2
new mode 100755
... ...
@@ -125,8 +125,9 @@ Charts update every: <span id="period"></span> minutes
125 125
  onclick="setChartPeriod(2)">4 weeks</span></li>
126 126
 <li class="selectorElement"><span class="selectorElement"
127 127
  onclick="setChartPeriod(3)">12 months</span></li>
128
-<li class="selectorElement"><span class="selectorElement"
129
- onclick="setChartPeriod(0)">Custom…</span></li>
128
+<li id="customSelector" class="selectorElement" style="visibility:hidden;">
129
+<span  class="selectorElement"
130
+ onclick="setChartPeriod(0)">Custom...</span></li>
130 131
 </ul>
131 132
 </span>
132 133
 
... ...
@@ -177,10 +178,10 @@ www.arednmesh.org</a>.</li>
177 178
 <br>
178 179
 
179 180
 <script>
180
-
181
+"use strict";
181 182
 /* Global constants */
182 183
 
183
-var nodeDataUrl = "dynamic/nodeOnline.js";
184
+var nodeDataUrl = "dynamic/arednsigData.js";
184 185
 
185 186
 /* Global DOM objects */
186 187
 
... ...
@@ -199,6 +200,7 @@ var customChartsContainer = document.getElementById("customChartsContainer");
199 200
 var stockChartsContainer = document.getElementById("stockChartsContainer");
200 201
 var fmDateSelector = document.getElementById("fmDateSelector");
201 202
 var errorMsg = document.getElementById("errorMsg");
203
+var customSelector = document.getElementById("customSelector");
202 204
 
203 205
 /* Global objects */
204 206
 
... ...
@@ -207,9 +209,12 @@ var httpRequest = new XMLHttpRequest();
207 209
 /* Global variables */
208 210
 
209 211
 var chartPeriod = 1;
210
-var chartRefreshRate = 0; // chart refresh rate in minutes
212
+var chartUpdateInterval; // chart refresh rate in seconds
213
+var dataRequestInterval; // data request interval in seconds
211 214
 
212 215
 function main() {
216
+    httpRequest.timeout = 3000;
217
+
213 218
     /* Register call back function to process http requests */
214 219
     httpRequest.onreadystatechange = function() {
215 220
         if (httpRequest.readyState == 4 && httpRequest.status == 200) {
... ...
@@ -229,8 +234,7 @@ function main() {
229