fix(ui): sync role select to live role; mark RF chip unavailable on poll failure
This commit is contained in:
@@ -269,7 +269,7 @@
|
||||
<script src="js/xterm-addon-fit.min.js"></script>
|
||||
<script src="js/terminal.js?v=20260820-4"></script>
|
||||
<script src="js/pager.js?v=20260820-4"></script>
|
||||
<script src="js/views.js?v=20260822-2"></script>
|
||||
<script src="js/app.js?v=20260822-1"></script>
|
||||
<script src="js/views.js?v=20260822-3"></script>
|
||||
<script src="js/app.js?v=20260822-3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -482,6 +482,7 @@ views.pineap = (root) => {
|
||||
const rfResult = h('div', { class: 'mk8-rf-result', text: '' });
|
||||
function renderRfStatus(d) {
|
||||
const role = d.role || 'idle';
|
||||
if (document.activeElement !== rfSel) rfSel.value = role;
|
||||
rfStatusBadge.textContent = role.toUpperCase();
|
||||
rfStatusBadge.className = 'badge ' +
|
||||
(role === 'uplink' ? (d.assoc ? 'on' : 'warn') : role === 'attack' ? 'warn' : 'off');
|
||||
|
||||
Reference in New Issue
Block a user