webui: render temperature settings as mobile cards
This commit is contained in:
@@ -1149,21 +1149,30 @@ function renderConfigControls(data){
|
|||||||
const tempBox=$("tempConfigList");
|
const tempBox=$("tempConfigList");
|
||||||
if(tempBox){
|
if(tempBox){
|
||||||
tempBox.innerHTML=temps.map((t,i)=>`
|
tempBox.innerHTML=temps.map((t,i)=>`
|
||||||
<div class="configrow tempConfigRow">
|
<div class="tempConfigCard">
|
||||||
<label>${t.id}</label>
|
<div class="tempConfigTop">
|
||||||
|
<div class="tempConfigTitle">Temp Slot ${i+1}</div>
|
||||||
|
<button class="danger tempClear" onclick="clearTempAssignment('${t.id}')">Clear Assignment</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label class="inputHelp" for="tempName${i}">Name</label>
|
||||||
<input id="tempName${i}" value="${t.name||""}" placeholder="Temp name">
|
<input id="tempName${i}" value="${t.name||""}" placeholder="Temp name">
|
||||||
<div class="checkGroup">
|
|
||||||
<label class="checkPill">
|
<div>
|
||||||
|
<div class="inputHelp">Address</div>
|
||||||
|
<div class="tempConfigAddress">${t.address||"unassigned"}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tempConfigControls">
|
||||||
|
<label class="tempCheck">
|
||||||
<input id="tempEnabled${i}" type="checkbox" ${t.enabled?"checked":""} onchange="saveTempConfig()">
|
<input id="tempEnabled${i}" type="checkbox" ${t.enabled?"checked":""} onchange="saveTempConfig()">
|
||||||
On
|
Enabled
|
||||||
</label>
|
</label>
|
||||||
<label class="checkPill">
|
<label class="tempCheck">
|
||||||
<input id="tempWeather${i}" type="checkbox" ${t.weather?"checked":""} onchange="saveTempConfig()">
|
<input id="tempWeather${i}" type="checkbox" ${t.weather?"checked":""} onchange="saveTempConfig()">
|
||||||
Weather
|
Weather Badge
|
||||||
</label>
|
</label>
|
||||||
<button class="off" onclick="clearTempAssignment('${t.id}')">Clear</button>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="tempAddress">Address: ${t.address||"unassigned"}</div>
|
|
||||||
</div>`).join("");
|
</div>`).join("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -538,3 +538,17 @@ def test_embedded_webui_mobile_temperature_config_cards():
|
|||||||
assert "Clear Assignment" in source
|
assert "Clear Assignment" in source
|
||||||
assert "Weather Badge" in source
|
assert "Weather Badge" in source
|
||||||
assert "@media(max-width:700px)" in source
|
assert "@media(max-width:700px)" in source
|
||||||
|
|
||||||
|
|
||||||
|
def test_embedded_webui_temp_config_uses_mobile_cards():
|
||||||
|
source = firmware_source()
|
||||||
|
start = source.index('const tempBox=$("tempConfigList");')
|
||||||
|
end = source.index("async function saveRelayConfig", start)
|
||||||
|
body = source[start:end]
|
||||||
|
|
||||||
|
assert "tempConfigCard" in body
|
||||||
|
assert "Temp Slot " in body
|
||||||
|
assert "Clear Assignment" in body
|
||||||
|
assert "Weather Badge" in body
|
||||||
|
assert "configrow tempConfigRow" not in body
|
||||||
|
assert "Address:" not in body
|
||||||
|
|||||||
Reference in New Issue
Block a user