|
294 | 294 | .then(json => { |
295 | 295 | console.log("then(json => ..)"); |
296 | 296 | //console.log("parsed .., data is ["+ JSON.stringify(json)+"]"); |
| 297 | + needReload = false; |
297 | 298 | data = json.otmonitor; |
298 | 299 | for( let i in data ) |
299 | 300 | { |
|
306 | 307 | rowDiv.setAttribute("class", "otmonrow"); |
307 | 308 | //rowDiv.setAttribute("id", "otmon_"+data[i].name); |
308 | 309 | rowDiv.style.background = "lightblue"; |
| 310 | + rowDiv.style.visibility = ((data[i].epoch==0)?"collapse":"visible"); |
| 311 | + // rowDiv.style.display = ((data[i].epoch==0)?"none":"table-row"); |
| 312 | + var epoch = document.createElement("INPUT"); |
| 313 | + epoch.setAttribute("type", "hidden"); |
| 314 | + epoch.setAttribute("id", "otmon_epoch_"+data[i].name); |
| 315 | + epoch.name = data[i].name; |
| 316 | + epoch.value = data[i].epoch; |
| 317 | + rowDiv.appendChild(epoch); |
309 | 318 | //--- field Name --- |
310 | 319 | var fldDiv = document.createElement("div"); |
311 | 320 | fldDiv.setAttribute("class", "otmoncolumn1"); |
|
326 | 335 | } |
327 | 336 | else |
328 | 337 | { //if the element exists, then update the value |
329 | | - document.getElementById("otmon_"+data[i].name).textContent = data[i].value; |
| 338 | + var update = document.getElementById("otmon_"+data[i].name); |
| 339 | + var epoch = document.getElementById("otmon_epoch_"+data[i].name); |
| 340 | + if ((Number(epoch.value)==0) && (Number(data[i].epoch)>0)) { |
| 341 | + //console.log ("unhide based on epoch"); |
| 342 | + //setTimeout(function () { update.style.visibility = 'visible';}, 0); |
| 343 | + needReload = true; |
| 344 | + } |
| 345 | + epoch.value = data[i].epoch; |
| 346 | + //if (update.style.visibility == 'visible') update.textContent = data[i].value; |
| 347 | + |
330 | 348 | } |
331 | 349 | } |
332 | | - |
| 350 | + if (needReload) window.location.reload(true); |
333 | 351 | }) |
334 | 352 | .catch(function(error) { |
335 | 353 | var p = document.createElement('p'); |
|
0 commit comments