swarm-ui: add a jobs tab, and type JobqGraph as real TypeScript
New /jobs route in swarm-ui, reusing the shared JobqGraph component against swarm-controller's own GET /api/jobq/graph (same wire shape hive-c0re's dashboard already consumes, different endpoint, no fork). Converted JobqGraph.jsx to JobqGraph.tsx with real prop/wire types (mirrors hive_jobq_wire's GraphNode/GraphDep/State by hand) instead of a hand-maintained ambient .d.ts at the swarm-ui consumer side — the .d.ts would duplicate the prop list and drift from the source the moment the component's signature changes without the declaration being touched. Both dashboard (untyped consumer, esbuild strips types) and swarm-ui (tsc --noEmit) build/typecheck clean off the one file.
This commit is contained in:
parent
61977514c6
commit
527ed8f3e2
6 changed files with 134 additions and 31 deletions
|
|
@ -7,6 +7,7 @@ import { useEffect, useState } from 'preact/hooks';
|
|||
import { Route, Switch } from 'wouter-preact';
|
||||
import { Shell } from './shell/Shell.js';
|
||||
import { ComponentsPage } from './pages/ComponentsPage.js';
|
||||
import { JobsPage } from './pages/JobsPage.js';
|
||||
import { Panel } from './ui/panel/Panel.js';
|
||||
import { StatusChip } from './ui/status-chip/StatusChip.js';
|
||||
import { Table, type TableColumn } from './ui/table/Table.js';
|
||||
|
|
@ -70,6 +71,7 @@ export function App() {
|
|||
<Shell>
|
||||
<Switch>
|
||||
<Route path="/" component={Home} />
|
||||
<Route path="/jobs" component={JobsPage} />
|
||||
<Route path="/components" component={ComponentsPage} />
|
||||
<Route component={NotFound} />
|
||||
</Switch>
|
||||
|
|
|
|||
7
frontend/packages/swarm-ui/src/pages/JobsPage.css
Normal file
7
frontend/packages/swarm-ui/src/pages/JobsPage.css
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/* JobsPage — wraps the shared JobqGraph component pointed at the
|
||||
swarm-controller's own /api/jobq/graph endpoint (same wire shape
|
||||
hive-c0re's dashboard consumes, see hive-jobq-wire's README). Styles
|
||||
are @hive/shared's jobq-graph.css, @import'ed here rather than from
|
||||
the component file itself — see JobqGraph.jsx's own comment for why
|
||||
that split exists (esbuild's loader map is global per bundle call). */
|
||||
@import "@hive/shared/jobq-graph.css";
|
||||
20
frontend/packages/swarm-ui/src/pages/JobsPage.tsx
Normal file
20
frontend/packages/swarm-ui/src/pages/JobsPage.tsx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// <JobsPage> — the swarm-level job graph. Reuses the shared JobqGraph
|
||||
// component (originally built for the per-hive dashboard's rebuild
|
||||
// queue) pointed at swarm-controller's own GET /api/jobq/graph instead
|
||||
// of hive-c0re's — same wire shape (Vec<hive_jobq_wire::GraphNode>),
|
||||
// different endpoint, no component fork. swarm-controller's graph has
|
||||
// no real node kinds wired in yet (see swarm-controller/src/main.rs's
|
||||
// SwarmNodeKind/SwarmResourceKind), so this renders an empty tree today
|
||||
// — the page exists so the wiring is in place before the first real
|
||||
// swarm-level job (e.g. CreateAgent) lands.
|
||||
import { JobqGraph } from '@hive/shared/jobq-graph.js';
|
||||
import { Panel } from '../ui/panel/Panel.js';
|
||||
import './JobsPage.css';
|
||||
|
||||
export function JobsPage() {
|
||||
return (
|
||||
<Panel title="jobs">
|
||||
<JobqGraph endpoint="/api/jobq/graph" />
|
||||
</Panel>
|
||||
);
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ import './Shell.css';
|
|||
|
||||
const NAV_ITEMS: { href: string; label: string }[] = [
|
||||
{ href: '/', label: 'overview' },
|
||||
{ href: '/jobs', label: 'jobs' },
|
||||
{ href: '/components', label: 'components' },
|
||||
];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue