A machine is titled by its own hostname, and follows a rename
The name a machine was added under stays its identity — the URL, its accent, what the hub's API calls it — and is what the Machines page shows as 'Added as'. The hostname is read live rather than at start-up, so renaming a machine reaches the console without a restart. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
ec94cb8bff
commit
dbfe163a75
@@ -56,6 +56,12 @@ async function req<T>(method: string, path: string, body?: unknown, local = fals
|
||||
|
||||
export interface Me { demo_url?: string; addr?: string; host: string; user: string; version: string; load: string; uptime: number; reboot_needed?: boolean; fingerprint?: string; arch?: string }
|
||||
export interface PushResult { name: string; ok: boolean; version?: string; error?: string }
|
||||
// What a machine is called on screen: the hostname it reports, which follows a rename within
|
||||
// a poll. The name it was added under stays its identity — the URL, its accent colour, and
|
||||
// what the hub's own API calls it — and is what we fall back to until it has been reached.
|
||||
export const titleOf = (name: string | null, machines: MachineStatus[], hubHost: string): string =>
|
||||
name ? machines.find((m) => m.name === name)?.host || name : hubHost
|
||||
|
||||
export interface MachineStatus { name: string; url: string; fingerprint?: string; added: string; online: boolean; host?: string; version?: string; load?: string; uptime?: number; reboot_needed?: boolean; last_seen?: string; error?: string }
|
||||
export interface Term { id: string; name: string; running: boolean; exit_code: number; created: string; clients: number }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user