fix(ui): sync role select to live role; mark RF chip unavailable on poll failure

This commit is contained in:
2026-08-22 19:26:39 -06:00
parent a1b449c9be
commit 107cf17611
3 changed files with 18 additions and 7 deletions
@@ -527,11 +527,21 @@ const Live = (() => {
}
}
function pollRfplan() {
fetch(App.apiBase + '/api/rfplan', { credentials: 'include' }).then((r) => r.json())
.then((d) => {
rfState = d && typeof d.role === 'string' ? d : null;
renderRfChip();
}).catch(() => {});
fetch(App.apiBase + '/api/rfplan', { credentials: 'include' }).then((r) => {
if (!r.ok) throw new Error('http ' + r.status);
return r.json();
}).then((d) => {
rfState = d && typeof d.role === 'string' ? d : null;
renderRfChip();
}).catch(() => {
rfState = null;
const el = document.getElementById('rf-chip');
if (el) {
el.textContent = 'PHY1: ?';
el.title = 'RF plan unavailable';
el.className = 'health-chip warn';
}
});
}
function renderRfChip() {
const el = document.getElementById('rf-chip');