swarm-ui: disable the wanted-toggle badge on a destroyed row

argus, review: the primary wanted-toggle badge still had no
wanted === "destroyed" guard, so it stayed clickable on a destroyed
row and would PUT {state: "up"} on click -- directly contradicting
the destroy confirm dialogs own "not reversible from here" copy.
Missed this in the previous fix-up (which only addressed the
ConfirmDialog-for-stop ask). Added the guard to both the click handler
and disabled, plus a title explaining why on a destroyed row.
This commit is contained in:
iris 2026-09-07 19:11:50 +02:00
commit 29c94ea9e6

View file

@ -329,17 +329,27 @@ export function AgentsPage() {
// Already destroyed, or nothing to destroy against — same guard
// shape as the wanted toggle's own `!a.hive` check.
const destroyable = a.hive && a.wanted !== "destroyed";
const destroyed = a.wanted === "destroyed";
return (
<>
<Badge
tone={tone}
value={pending ? "…" : (a.wanted ?? "no declaration")}
onClick={a.hive ? () => void toggleWanted(a) : undefined}
disabled={pending || !a.hive}
// `destroyed` blocks the click too, not just the label —
// argus caught this in review: without it, a click here
// still computed `target = "up"` and PUT a live
// declaration on a destroyed row, contradicting the
// destroy confirm's own "not reversible from here" copy.
onClick={
a.hive && !destroyed ? () => void toggleWanted(a) : undefined
}
disabled={pending || !a.hive || destroyed}
title={
a.hive
? `click to ${actionLabel} ${a.name}`
: "no hive on record for this agent — nothing to declare against"
destroyed
? `${a.name} is destroyed — redeploy via "+ agent" to bring it back`
: a.hive
? `click to ${actionLabel} ${a.name}`
: "no hive on record for this agent — nothing to declare against"
}
/>
{destroyable ? (