feat(web-ui): show decky IP on SwarmDeckies, drop compose-hash column
Operators want to know what address to poke when triaging a swarm decky; the compose-hash column was debug scaffolding that never paid off. DeckyShard has no IP column (the deploy-time IP lives on DecnetConfig), so the list endpoint resolves it at read time by joining shards against the stored deployment state by decky_name. Missing lookups render as "—" rather than erroring — the list stays useful even after a master restart that hasn't persisted a config yet.
This commit is contained in:
@@ -333,6 +333,7 @@ class SwarmHostView(BaseModel):
|
||||
class DeckyShardView(BaseModel):
|
||||
"""One decky → host mapping, enriched with the host's identity for display."""
|
||||
decky_name: str
|
||||
decky_ip: Optional[str] = None # resolved from the stored DecnetConfig at read time
|
||||
host_uuid: str
|
||||
host_name: str
|
||||
host_address: str
|
||||
|
||||
@@ -22,6 +22,15 @@ async def list_deckies(
|
||||
shards = await repo.list_decky_shards(host_uuid)
|
||||
hosts = {h["uuid"]: h for h in await repo.list_swarm_hosts()}
|
||||
|
||||
# IPs live on the stored DecnetConfig, not on the shard row. Resolve by
|
||||
# decky_name — if the master rebooted without a config, the column falls
|
||||
# back to "—" rather than blocking the list.
|
||||
deploy_state = await repo.get_state("deployment") or {}
|
||||
cfg_deckies = (deploy_state.get("config") or {}).get("deckies") or []
|
||||
ip_by_name: dict[str, str] = {
|
||||
d.get("name"): d.get("ip") for d in cfg_deckies if d.get("name")
|
||||
}
|
||||
|
||||
out: list[DeckyShardView] = []
|
||||
for s in shards:
|
||||
if state and s.get("state") != state:
|
||||
@@ -29,6 +38,7 @@ async def list_deckies(
|
||||
host = hosts.get(s["host_uuid"], {})
|
||||
out.append(DeckyShardView(
|
||||
decky_name=s["decky_name"],
|
||||
decky_ip=ip_by_name.get(s["decky_name"]),
|
||||
host_uuid=s["host_uuid"],
|
||||
host_name=host.get("name") or "<unknown>",
|
||||
host_address=host.get("address") or "",
|
||||
|
||||
@@ -6,6 +6,7 @@ import { Boxes, PowerOff, RefreshCw } from 'lucide-react';
|
||||
|
||||
interface DeckyShard {
|
||||
decky_name: string;
|
||||
decky_ip: string | null;
|
||||
host_uuid: string;
|
||||
host_name: string;
|
||||
host_address: string;
|
||||
@@ -87,9 +88,9 @@ const SwarmDeckies: React.FC = () => {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Decky</th>
|
||||
<th>IP</th>
|
||||
<th>State</th>
|
||||
<th>Services</th>
|
||||
<th>Compose</th>
|
||||
<th>Updated</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
@@ -98,9 +99,9 @@ const SwarmDeckies: React.FC = () => {
|
||||
{h.shards.map((s) => (
|
||||
<tr key={`${uuid}-${s.decky_name}`}>
|
||||
<td>{s.decky_name}</td>
|
||||
<td><code>{s.decky_ip || '—'}</code></td>
|
||||
<td>{s.state}{s.last_error ? ` — ${s.last_error}` : ''}</td>
|
||||
<td>{s.services.join(', ')}</td>
|
||||
<td><code>{s.compose_hash ? s.compose_hash.slice(0, 8) : '—'}</code></td>
|
||||
<td>{new Date(s.updated_at).toLocaleString()}</td>
|
||||
<td>
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user