Header dot: don't go red on machine switch; reflect remote reachability

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Mitchell-Johnson
2026-09-18 11:36:04 -07:00
co-authored by Claude Fable 5.1
parent 7dcdb5dc98
commit 340232b724
2 changed files with 3 additions and 4 deletions
+2 -2
View File
@@ -75,7 +75,7 @@ export default function Shell({ me: hubMe, onLoggedOut }: { me: Me; onLoggedOut:
// Switching machines: reset everything that belongs to a host, then re-fetch its identity. // Switching machines: reset everything that belongs to a host, then re-fetch its identity.
const switchMachine = (name: string | null) => { const switchMachine = (name: string | null) => {
setMachine(name); sessionStorage.setItem('hamlab.machine', name ?? ''); if (!name) sessionStorage.removeItem('hamlab.machine') setMachine(name); sessionStorage.setItem('hamlab.machine', name ?? ''); if (!name) sessionStorage.removeItem('hamlab.machine')
handles.current = {}; setTerms([]); setActive(null); setRemoteMe(null); setRemoteErr(''); setDrawer(false) handles.current = {}; setTerms([]); setActive(null); setRemoteMe(null); setRemoteErr(''); setDrawer(false); setOnline(true)
setMachineState(name) setMachineState(name)
if (view === 'machines') setView('dashboard') if (view === 'machines') setView('dashboard')
} }
@@ -136,7 +136,7 @@ export default function Shell({ me: hubMe, onLoggedOut }: { me: Me; onLoggedOut:
{machine && remoteErr && <span className="badge bad" title={remoteErr}>offline</span>} {machine && remoteErr && <span className="badge bad" title={remoteErr}>offline</span>}
<span className="spacer" /> <span className="spacer" />
<span className="stat" title="load average">{me.load}</span> <span className="stat" title="load average">{me.load}</span>
<span className={'dot ' + (online ? 'ok' : 'bad')} title={online ? 'connected' : 'disconnected'} /> <span className={'dot ' + (online && !remoteErr ? 'ok' : 'bad')} title={remoteErr ? `${machine} unreachable` : online ? 'connected' : 'disconnected'} />
<Power host={me.host} rebootNeeded={me.reboot_needed} /> <Power host={me.host} rebootNeeded={me.reboot_needed} />
<Btn className="link" onClick={logout}>logout</Btn> <Btn className="link" onClick={logout}>logout</Btn>
</header> </header>
+1 -2
View File
@@ -80,9 +80,8 @@ export default function TerminalPane({ id, active, register, onStatus, onExit }:
} catch { /* ignore */ } } catch { /* ignore */ }
} }
sock.onclose = () => { sock.onclose = () => {
if (ws !== sock) return if (ws !== sock || closed) return
cbs.current.onStatus(false) cbs.current.onStatus(false)
if (closed) return
setConn('reconnecting') setConn('reconnecting')
retryTimer = window.setTimeout(connect, Math.min(1000 * 2 ** retry++, 15000)) retryTimer = window.setTimeout(connect, Math.min(1000 * 2 ** retry++, 15000))
} }