fix(devices): offline signal glyph, plus firmware UI across Device Detail tabs

SignalIndicator now takes an isOnline prop — when a device is offline it
renders a dimmed amber glyph with an X instead of showing the last-known
(possibly full-bars) RSSI reading, which was misleading on the Device List
table view. Card view already special-cased offline devices and is
unaffected.

Also, while working the device details surface:
- DeviceDetail: hover-to-reveal copy button next to the serial number
  subtitle in the page header.
- OverviewTab hero: swapped the redundant "Location" field (already shown
  in detail on the General tab's map) for live Firmware Version.
- GeneralTab: new full-width, compact Firmware hero row (version, channel,
  validation state, boot count, backup slot) sourced from firmware.status.
- ControlTab: max width brought in line with every other tab (2000, was
  1400), and added a 4th "Firmware" section with channel selection,
  Update Now, custom-URL flash, and commit/rollback controls, wired to the
  firmware.status / ota.* / firmware.commit / firmware.rollback commands
  documented in the API Reference.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-22 11:47:10 +03:00
co-authored by Claude Sonnet 5
parent c8ac0b78c5
commit 529e866fff
6 changed files with 415 additions and 17 deletions
@@ -886,6 +886,7 @@ export default function GeneralTab({
// needed since nothing else in the console ever writes it.
const hasSyncedRef = useRef(false)
const [networkInfo, setNetworkInfo] = useState(null)
const [firmwareStatus, setFirmwareStatus] = useState(null)
useEffect(() => {
if (!sendMqttCommandSilent || !device) return
if (hasSyncedRef.current) return
@@ -926,6 +927,12 @@ export default function GeneralTab({
}).catch(() => {
// Device offline or didn't reply — Network Info card stays empty/dash.
})
sendMqttCommandSilent('firmware.status').then((reply) => {
setFirmwareStatus(reply?.data || null)
}).catch(() => {
// Device offline or didn't reply — Firmware card stays empty/dash.
})
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [device?.id, device?.device_id])
@@ -1015,6 +1022,91 @@ export default function GeneralTab({
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--space-6)', width: '100%', maxWidth: 2000, margin: '0 auto' }}>
{/* ════════════════════════════════════════════════════════════════════
ROW 0 — Firmware (full width, short)
════════════════════════════════════════════════════════════════════ */}
<GlassCard>
<div style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
gap: 'var(--space-6)',
flexWrap: 'wrap',
}}>
<div style={{ display: 'flex', alignItems: 'center', gap: 'var(--space-3)', minWidth: 0 }}>
<div style={{
width: 36, height: 36, flexShrink: 0,
borderRadius: 'var(--radius-md)',
background: 'var(--color-primary-subtle)',
border: '1px solid rgba(192,193,255,0.20)',
display: 'flex', alignItems: 'center', justifyContent: 'center',
}}>
<Icon name="firmware" size={17} color="var(--color-primary)" />
</div>
<div style={{ minWidth: 0 }}>
<SectionLabel>Firmware</SectionLabel>
<div style={{ display: 'flex', alignItems: 'baseline', gap: 'var(--space-2)', marginTop: 2 }}>
<span style={{
fontSize: 'var(--font-size-lg)',
fontWeight: 'var(--font-weight-semibold)',
fontFamily: 'var(--font-family-mono)',
color: 'var(--color-text-primary)',
}}>
{firmwareStatus?.current_version ? `v${firmwareStatus.current_version}` : '—'}
</span>
{firmwareStatus?.build_date && (
<span style={{ fontSize: 'var(--font-size-xs)', color: 'var(--color-text-muted)' }}>
built {firmwareStatus.build_date}
</span>
)}
</div>
</div>
</div>
<div style={{ display: 'flex', alignItems: 'center', gap: 'var(--space-6)', flexWrap: 'wrap' }}>
<div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
<SectionLabel>Channel</SectionLabel>
<StatusBadge variant={firmwareStatus?.ota_channel === 'stable' ? 'success' : firmwareStatus?.ota_channel === 'beta' ? 'warning' : 'neutral'}>
{firmwareStatus?.ota_channel || '—'}
</StatusBadge>
</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
<SectionLabel>Validation</SectionLabel>
<StatusBadge variant={
firmwareStatus?.validation_state === 'VALIDATED' ? 'success' :
firmwareStatus?.is_testing ? 'warning' : 'neutral'
}>
{firmwareStatus?.validation_state || '—'}
</StatusBadge>
</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
<SectionLabel>Boot Count</SectionLabel>
<span style={{ fontSize: 'var(--font-size-base)', fontWeight: 'var(--font-weight-medium)', fontFamily: 'var(--font-family-mono)', color: 'var(--color-text-primary)' }}>
{Number.isFinite(firmwareStatus?.boot_count) ? firmwareStatus.boot_count : '—'}
</span>
</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
<SectionLabel>Backup Slot</SectionLabel>
<span style={{ fontSize: 'var(--font-size-base)', fontWeight: 'var(--font-weight-medium)', fontFamily: 'var(--font-family-mono)', color: 'var(--color-text-primary)' }}>
{firmwareStatus?.backup_version ? `v${firmwareStatus.backup_version}` : '—'}
{firmwareStatus?.backup_version && (
<span style={{ marginLeft: 6, fontSize: 'var(--font-size-xs)', fontFamily: 'var(--font-family-base)', color: firmwareStatus?.backup_is_valid ? 'var(--color-success)' : 'var(--color-danger)' }}>
{firmwareStatus?.backup_is_valid ? 'valid' : 'invalid'}
</span>
)}
</span>
</div>
{firmwareStatus?.is_testing && (
<StatusBadge variant="warning">Testing — awaiting commit</StatusBadge>
)}
</div>
</div>
</GlassCard>
{/* ════════════════════════════════════════════════════════════════════
ROW 1 — Map (2/3) + Safety Settings (1/3) equal height
════════════════════════════════════════════════════════════════════ */}