Watch
0
0
Fork
You've already forked hyperhive
0

swarm ui: a popover stays on the page, and the ssh popover folds its explanations

A popover hung from its anchor and ran off the foot of the window when the anchor sat low. It now goes over the anchor when it fits neither way better below, and otherwise takes the roomier side with its height cut so it scrolls inside itself; the placement is a pure function with a test, and the box places itself again when its content changes size. The ssh popover showed three long paragraphs above its switch: the explainer and the host-key text now sit in a folded how it works section, and the warning and the switch stay visible. Its sections can no longer give the popover a sideways scroll.
This commit is contained in:
iris 2026-11-20 11:47:08 +01:00 • committed by mara
commit da187f8368
2 changed files with 136 additions and 32 deletions

View file

@ -1,7 +1,8 @@
// <AgentSsh> — one agent's SSH access in an opened agent card: a badge that
// opens an explainer, the switch, a folded "on the target" section with the text
// a machine needs to trust the agent's certificates, and a folded "connections"
// section for the agent's named connections (`AgentSshConnections`).
// opens a warning and the switch, then three folded sections: "how it works"
// (the explainer), "on the target" (the text a machine needs to trust the
// agent's certificates) and "connections" (the agent's named connections, in
// `AgentSshConnections`).
//
// The switch is the `ssh` field of `GET/PUT /api/agents/{name}/permissions`,
// shared with the other grant controls through `useGrant`. The CA key comes
@ -86,22 +87,6 @@ export function AgentSsh({ agent, g }: { agent: string; g: GrantState }) {
sandbox stops it doing, it can do on a machine it can log in to. Only
allow this for machines you would let {agent} control completely.
</p>
<p class="ui-badge-popover-help">
Lets {agent} log in over SSH to machines that trust the swarm's SSH
certificate authority. With this on, {agent} signs its own key for a
certificate that names it, on its first <code>ssh</code> after the
swarm has updated its login, which takes seconds. The certificate
lasts one hour, and the key lives in memory only. Switching off stops
new certificates within seconds; one already signed stays valid until
it expires, an hour after signing. A machine has to trust the
authority before anything works: see "on the target" below.
</p>
<p class="ui-badge-popover-help" role="note">
{agent} accepts the key a machine shows on the first connection and
refuses a changed one afterwards (trust on first use). If a host's key
really changed, check the new key out of band, then forget the old one
with <code>{forgetHostKeyCommand(agent)}</code> on the hive host.
</p>
<CheckboxField
id={`ssh-${agent}`}
label={`allow ${agent} to get SSH certificates`}
@ -121,6 +106,27 @@ export function AgentSsh({ agent, g }: { agent: string; g: GrantState }) {
problem={saveError}
/>
) : null}
<details class="ui-agent-ssh-target">
<summary>how it works</summary>
<p class="ui-badge-popover-help">
Lets {agent} log in over SSH to machines that trust the swarm's SSH
certificate authority. With this on, {agent} signs its own key for a
certificate that names it, on its first <code>ssh</code> after the
swarm has updated its login, which takes seconds. The certificate
lasts one hour, and the key lives in memory only. Switching off
stops new certificates within seconds; one already signed stays
valid until it expires, an hour after signing. A machine has to
trust the authority before anything works: see "on the target"
below.
</p>
<p class="ui-badge-popover-help" role="note">
{agent} accepts the key a machine shows on the first connection and
refuses a changed one afterwards (trust on first use). If a host's
key really changed, check the new key out of band, then forget the
old one with <code>{forgetHostKeyCommand(agent)}</code> on the hive
host.
</p>
</details>
<details class="ui-agent-ssh-target">
<summary>on the target</summary>
{snippet === null ? (

View file

@ -1,6 +1,13 @@
/* The named SSH connections of an agent card: a table that scrolls on its own on
a narrow screen rather than breaking the popover. */
/* The sections of the ssh popover never grow past it: a wide table scrolls in its
own box instead of giving the popover a sideways scroll. */
.ui-agent-ssh-target {
max-width: 100%;
}
.ui-agent-ssh-connections {
min-width: 0;
max-width: 100%;
display: flex;
flex-direction: column;
gap: 0.75em;