diff --git a/drb-edge-node/app/templates/index.html b/drb-edge-node/app/templates/index.html index 2391461..ed8f6b2 100644 --- a/drb-edge-node/app/templates/index.html +++ b/drb-edge-node/app/templates/index.html @@ -547,8 +547,12 @@ let rank = 0; sdrRows.forEach((row, i) => { const [name, hint] = SDR_LABELS[row.mode] || [row.mode, '']; - const running = sdrRunning.includes(row.mode); - const state = !row.enabled ? 'Off' : running ? 'Running' : (sdrDirty ? 'Unsaved' : 'Waiting for SDR'); + const running = (sdrRunning || []).includes(row.mode); + // Unsaved first: a reorder must not keep claiming the old order is live. + const state = !row.enabled ? 'Off' + : sdrDirty ? 'Unsaved' + : sdrRunning === null ? 'Unknown' + : running ? 'Running' : 'Waiting for SDR'; const el = document.createElement('div'); el.className = 'sdr-row'; el.innerHTML = ` @@ -557,7 +561,7 @@ ${name}${hint} - ${state}`; + ${state}`; const [box] = el.getElementsByTagName('input'); const [up, down] = el.getElementsByTagName('button'); box.onchange = () => { row.enabled = box.checked; markSdrDirty(); }; @@ -580,7 +584,7 @@ const r = await fetch('/api/secondary'); if (!r.ok) return; const d = await r.json(); - sdrRunning = d.running || []; + sdrRunning = d.running; // null = secondary SDR service unreachable sdrRows = [ ...d.priority.map(mode => ({ mode, enabled: true })), ...d.modes.filter(m => !d.priority.includes(m)).map(mode => ({ mode, enabled: false })),