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
1 changed files with 96 additions and 36 deletions
|
|
@ -21,7 +21,7 @@
|
|||
import { useState } from "preact/hooks";
|
||||
import { JobqGraph } from "@hive/shared/jobq-graph.js";
|
||||
import { JobqRollup } from "@hive/shared/jobq-rollup.js";
|
||||
import { Panel } from "../ui/panel/Panel.js";
|
||||
import { LazyDisclosure } from "../ui/disclosure/LazyDisclosure.js";
|
||||
import { BuildsCard } from "./builds/BuildsPage.js";
|
||||
import {
|
||||
RefreshIntervalPicker,
|
||||
|
|
@ -35,7 +35,7 @@ import "./JobsPage.css";
|
|||
// just solve staleness rather than require an opt-in every visit.
|
||||
const DEFAULT_INTERVAL_MS: RefreshIntervalMs = 30_000;
|
||||
|
||||
function JobsCard() {
|
||||
function JobsBody() {
|
||||
const [intervalMs, setIntervalMs] =
|
||||
useState<RefreshIntervalMs>(DEFAULT_INTERVAL_MS);
|
||||
const [refreshToken, setRefreshToken] = useState(0);
|
||||
|
|
@ -51,29 +51,32 @@ function JobsCard() {
|
|||
useRefreshInterval(intervalMs, () => setRefreshToken((t) => t + 1));
|
||||
|
||||
return (
|
||||
<Panel
|
||||
title="jobs"
|
||||
icon="🧩"
|
||||
actions={
|
||||
<>
|
||||
<div class="ui-jobs-refresh">
|
||||
<RefreshIntervalPicker
|
||||
id="jobs-refresh"
|
||||
value={intervalMs}
|
||||
onChange={setIntervalMs}
|
||||
/>
|
||||
}
|
||||
>
|
||||
</div>
|
||||
<JobqRollup endpoint="/api/jobq/rollup" refreshToken={refreshToken} />
|
||||
<JobqGraph endpoint="/api/jobq/graph" refreshToken={refreshToken} />
|
||||
</Panel>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
// The jobs tab holds two cards: the controller's job graph, and the swarm
|
||||
// builder's recent builds under it.
|
||||
// The jobs tab holds two folded cards: the controller's job graph, and the swarm
|
||||
// builder's recent builds under it. Neither reads anything until it is opened.
|
||||
export function JobsPage() {
|
||||
return (
|
||||
<div class="ui-jobs-page">
|
||||
<JobsCard />
|
||||
<LazyDisclosure
|
||||
title="jobs"
|
||||
icon="🧩"
|
||||
hint="the controller's job graph: agent creation, credential mints"
|
||||
>
|
||||
<JobsBody />
|
||||
</LazyDisclosure>
|
||||
<BuildsCard />
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue