swarm-ui: the jobs and builds cards are folded by default
Both cards on the jobs tab start shut and read nothing until opened; a link with ?run= opens the builds card. The fold-and-build-on-first-open part of the hives card is now one LazyDisclosure, which the hives card uses too. Docs follow.
This commit is contained in:
parent
a2f000bab4
commit
8f5b3a2fa8
2 changed files with 96 additions and 36 deletions
|
|
@ -54,3 +54,8 @@
|
|||
.ui-builds-empty {
|
||||
color: var(--muted);
|
||||
}
|
||||
.ui-builds-refresh {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-block-end: 0.5em;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { useSearch } from "wouter-preact";
|
|||
import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
|
||||
import { Badge } from "@hive/shared/badge.js";
|
||||
import { Card } from "../../ui/card/Card.js";
|
||||
import { Panel } from "../../ui/panel/Panel.js";
|
||||
import { LazyDisclosure } from "../../ui/disclosure/LazyDisclosure.js";
|
||||
import {
|
||||
RefreshIntervalPicker,
|
||||
type RefreshIntervalMs,
|
||||
|
|
@ -93,7 +93,7 @@ function BuildCard({
|
|||
);
|
||||
}
|
||||
|
||||
export function BuildsCard() {
|
||||
function BuildsBody() {
|
||||
const wanted = wantedRun(useSearch());
|
||||
const [intervalMs, setIntervalMs] =
|
||||
useState<RefreshIntervalMs>(DEFAULT_INTERVAL_MS);
|
||||
|
|
@ -129,17 +129,14 @@ export function BuildsCard() {
|
|||
wanted !== null && runs !== null && !runs.some((r) => r.id === wanted);
|
||||
|
||||
return (
|
||||
<Panel
|
||||
title="builds"
|
||||
icon="🔨"
|
||||
actions={
|
||||
<>
|
||||
<div class="ui-builds-refresh">
|
||||
<RefreshIntervalPicker
|
||||
id="builds-refresh"
|
||||
value={intervalMs}
|
||||
onChange={setIntervalMs}
|
||||
/>
|
||||
}
|
||||
>
|
||||
</div>
|
||||
<p>
|
||||
The agent config PR heads the swarm builder built, newest first: how
|
||||
each ended, and what nix printed when one failed. Select a build to read
|
||||
|
|
@ -170,6 +167,21 @@ export function BuildsCard() {
|
|||
/>
|
||||
))}
|
||||
</div>
|
||||
</Panel>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
// Shut by default, and open from the start when the URL names a build: a
|
||||
// status link goes straight to that build's card.
|
||||
export function BuildsCard() {
|
||||
return (
|
||||
<LazyDisclosure
|
||||
title="builds"
|
||||
icon="🔨"
|
||||
hint="the agent config PRs the swarm builder built"
|
||||
startOpen={wantedRun(useSearch()) !== null}
|
||||
>
|
||||
<BuildsBody />
|
||||
</LazyDisclosure>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue