From 5c1e967fdc479293d9459db5fd01ae8136a0320d Mon Sep 17 00:00:00 2001 From: Yurii Date: Wed, 4 Dec 2024 06:09:20 +0300 Subject: [PATCH] refactor: improved display of sensors on Dashboard --- src/PortalTask.h | 1 + src_data/pages/dashboard.html | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/PortalTask.h b/src/PortalTask.h index 7a77651..f2aec3e 100644 --- a/src/PortalTask.h +++ b/src/PortalTask.h @@ -509,6 +509,7 @@ class PortalTask : public LeanTask { for (uint8_t sensorId = 0; sensorId <= Sensors::getMaxSensorId(); sensorId++) { if (detailed) { auto& sSensor = Sensors::settings[sensorId]; + doc[sensorId][FPSTR(S_ENABLED)] = sSensor.enabled; doc[sensorId][FPSTR(S_NAME)] = sSensor.name; doc[sensorId][FPSTR(S_PURPOSE)] = static_cast(sSensor.purpose); sensorResultToJson(sensorId, doc[sensorId]); diff --git a/src_data/pages/dashboard.html b/src_data/pages/dashboard.html index 65d5549..d8e9faf 100644 --- a/src_data/pages/dashboard.html +++ b/src_data/pages/dashboard.html @@ -581,12 +581,12 @@

dashboard.name

} const sData = result[sensorId]; - if (sData.purpose == 255) { - sensorNode.classList.add("hidden"); + if (!sData.enabled || sData.purpose == 255) { + sensorNode.classList.toggle("hidden", true); continue; } - sensorNode.classList.remove("hidden"); + sensorNode.classList.toggle("hidden", false); setStatus( ".sStatus",