From 602369d9900ab3406aadd6ea955ec163e0b71e7f Mon Sep 17 00:00:00 2001 From: Ewoud Date: Mon, 30 Oct 2023 15:42:41 +0100 Subject: [PATCH] Lambda [this] for Files, Model and Modules, add loop1s and loop10s index.js: - generateHTML: select: add isPartOfTable - small changes AppModLeds: use loop1s & private vars Module.h: replace secondMillis by loop1s and loop10s SysModFiles - remove static for filesChanged and dirToJson SysModModel - remove static for doWriteModel and doShowObsolete - use loop1s SysModModules - remove static for modules - add oneSecondMillis and tenSecondMillis - loop: implement loop1s and loop10s SysModNetwork: use loop1s SysModSystem: use loop1s and loop10s SysModUI: use loop1s SysModWeb: use loop1s UserModInstances: use loop10s --- data/index.js | 115 +- src/App/AppModLeds.h | 18 +- src/Module.h | 3 +- src/Sys/SysModFiles.cpp | 8 +- src/Sys/SysModFiles.h | 4 +- src/Sys/SysModModel.cpp | 14 +- src/Sys/SysModModel.h | 7 +- src/Sys/SysModModules.cpp | 24 +- src/Sys/SysModModules.h | 6 +- src/Sys/SysModNetwork.cpp | 9 +- src/Sys/SysModNetwork.h | 1 + src/Sys/SysModPins.cpp | 14 +- src/Sys/SysModPins.h | 2 +- src/Sys/SysModPrint.cpp | 2 + src/Sys/SysModSystem.cpp | 27 +- src/Sys/SysModSystem.h | 3 +- src/Sys/SysModUI.cpp | 14 +- src/Sys/SysModUI.h | 1 + src/Sys/SysModWeb.cpp | 44 +- src/Sys/SysModWeb.h | 2 +- src/User/UserModE131.h | 2 - src/User/UserModInstances.h | 13 +- src/User/UserModWLEDAudio.h | 2 - src/html_ui.h | 2205 ++++++++++++++++++----------------- 24 files changed, 1277 insertions(+), 1263 deletions(-) diff --git a/data/index.js b/data/index.js index 5fed21d9..c5d7533c 100644 --- a/data/index.js +++ b/data/index.js @@ -136,6 +136,8 @@ function generateHTML(parentNode, json, rowNr = -1) { let labelNode = cE("label"); labelNode.innerText = initCap(json.id); + let isPartOfTable = (rowNr != -1); + if (json.type == "module") { ndivNeeded = false; newNode = cE("div"); @@ -170,45 +172,67 @@ function generateHTML(parentNode, json, rowNr = -1) { } else { //primitive types - //table header + //table header //no newNode created if (parentNode.nodeName.toLocaleLowerCase() == "table") { //table add the id in the header - let tdNode = cE("th"); - tdNode.id = json.id; - tdNode.innerText = initCap(json.id); //label uiFun response can change it - parentNode.firstChild.firstChild.appendChild(tdNode); // + let thNode = cE("th"); + thNode.id = json.id; + thNode.innerText = initCap(json.id); //label uiFun response can change it + parentNode.firstChild.firstChild.appendChild(thNode); // } else { if (json.type == "select") { - if (json.ro) { //e.g. for reset/restart reason: do not show a select but only show the selected option + //if part of a table, use the saved list of options, otheriwise create select and uiFun will get the options + + //newNode has no id here ... + + if (!isPartOfTable) { newNode = cE("p"); - newNode.appendChild(labelNode); - let spanNode = cE("span"); - spanNode.id = json.id; - if (json.value) spanNode.innerText = json.value; - newNode.appendChild(spanNode); + if (json.type != "button") newNode.appendChild(labelNode); //add label + } + + let valueNode; + if (json.ro) { //e.g. for reset/restart reason: do not show a select but only show the selected option + valueNode = cE("span"); + if (json.value) valueNode.innerText = json.value; } else { //

with