fix(webpage): hide Temperatures section when setup has no temperature data
renderInstrument() checked setup.temperatures for truthiness, but an empty JS object is truthy, so LamNI's deliberately-empty temperatures dict (it has no monitoring device) still rendered an empty "Temperatures" heading/table. flomni only worked by coincidence since its _TEMP_MAP always has entries. Adds a hasTemps check (Object.keys(...).length>0), mirroring the existing hasParams idiom one line above for the same card. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit was merged in pull request #269.
This commit is contained in:
@@ -2610,7 +2610,8 @@ function renderInstrument(setup){{
|
||||
const card=document.getElementById('instrument-card'),grid=document.getElementById('instrument-grid');
|
||||
const cp=(setup&&setup.current_params)||null;
|
||||
const hasParams=cp&&Object.keys(cp).length>0;
|
||||
if(!setup||(!setup.temperatures&&!hasParams)){{card.style.display='none';return;}}
|
||||
const hasTemps=setup&&setup.temperatures&&Object.keys(setup.temperatures).length>0;
|
||||
if(!setup||(!hasTemps&&!hasParams)){{card.style.display='none';return;}}
|
||||
card.style.display='';
|
||||
let html='';
|
||||
if(hasParams){{
|
||||
@@ -2622,7 +2623,7 @@ function renderInstrument(setup){{
|
||||
html+=buildParamRows(cp);
|
||||
html+='</table></div>';
|
||||
}}
|
||||
if(setup.temperatures){{
|
||||
if(hasTemps){{
|
||||
html+='<div class="instrument-section"><h3>Temperatures (°C)</h3><table class="kv-table">';
|
||||
for(const[k,v] of Object.entries(setup.temperatures)){{
|
||||
const cls=v==null?' class="temp-null"':'';
|
||||
|
||||
Reference in New Issue
Block a user