web: workflow graph rendering in the pipeline detail (P6)
Close P6 of web/PARITY.md: the pipeline detail's Graph tab now renders the
pipeline's workflow graph — stage nodes in declaration order, labelled outcome
edges, and the #failure/#success terminals on a shared lower row — plus a
definition pane opened from a node.
- src/graph.js (new): reusable `mount(container, graph, options) -> { unmount }`
plus the pure helpers it is built from (layout, edges, `error*`, lanes,
fit/clamp/zoom, hit-test, stage-definition fields). Definition view only, so
the run-detail Graph tab (R5) can reuse it. Mirrors WorkflowGraph.kt,
GraphPalette.kt, GraphSemantics.kt, StageDetailPane.kt and RunGraphTab.kt.
- src/app.js: wiring only — mount the graph in the Graph tab, drop the previous
mount on every re-render.
- styles.css: the .graph-* styles in the app's dark palette.
- test/graph.test.mjs (new): focused unit tests for the pure helpers, no DOM.
- test/ui-smoke.mjs: open "Plan and land", switch to Graph, capture the graph,
a stage pane and the expanded view, and assert the zoom/pan clamps and the
empty-pane wording against the live server.
- PARITY.md: P6 done with the 2026-10-19 captures; P3 notes the Graph tab now
renders the graph; R5 stays todo.
Checks: node --check on all five touched JS/MJS files; `node --test test/`
137 pass / 0 fail; `node test/ui-smoke.mjs --out ../captures` UI SMOKE PASS
against ws://127.0.0.1:8080/connect.
This commit is contained in:
@@ -22,6 +22,10 @@ import {
|
||||
sessionExportArtifact,
|
||||
viewerIndexByUrl,
|
||||
} from "./artifacts.js";
|
||||
import {
|
||||
PIPELINE_GRAPH_EMPTY,
|
||||
mount as mountGraph,
|
||||
} from "./graph.js";
|
||||
import {
|
||||
PIPELINE_SORTS,
|
||||
PIPELINE_DETAIL_TABS,
|
||||
@@ -112,6 +116,10 @@ const state = {
|
||||
pipelineSort: "server_order",
|
||||
pipelineMenu: null,
|
||||
pipelineTab: "summary",
|
||||
// The mounted workflow graph (P6) and whether its panel is expanded. The
|
||||
// handle is dropped on every re-render so its listeners can never leak.
|
||||
pipelineGraph: null,
|
||||
pipelineGraphExpanded: false,
|
||||
versionsExpanded: false,
|
||||
pipelinesLoaded: false,
|
||||
runsLoaded: false,
|
||||
@@ -247,6 +255,13 @@ function render() {
|
||||
}
|
||||
|
||||
function renderContent() {
|
||||
// The graph owns wheel/pointer/resize listeners; drop the previous mount
|
||||
// before rebuilding the DOM so a re-render, tab switch or view switch never
|
||||
// leaves an observer or listener behind.
|
||||
if (state.pipelineGraph) {
|
||||
state.pipelineGraph.unmount();
|
||||
state.pipelineGraph = null;
|
||||
}
|
||||
const nodes = [];
|
||||
if (state.error) {
|
||||
nodes.push(h("div", { class: "banner error" }, h("strong", { text: "Error: " }), state.error));
|
||||
@@ -550,6 +565,19 @@ function renderPipelineDetail() {
|
||||
);
|
||||
if (state.pipelineTab === "graph") {
|
||||
pane.append(h("p", { class: "graph-note muted", text: graphNote() }));
|
||||
const stages = d.graph?.stages ?? [];
|
||||
if (!stages.length) {
|
||||
pane.append(h("div", { class: "muted pad", text: PIPELINE_GRAPH_EMPTY }));
|
||||
return pane;
|
||||
}
|
||||
const host = h("div", { class: "graph-host" });
|
||||
pane.append(host);
|
||||
state.pipelineGraph = mountGraph(host, d.graph, {
|
||||
expanded: state.pipelineGraphExpanded,
|
||||
onExpandedChange: (value) => {
|
||||
state.pipelineGraphExpanded = value;
|
||||
},
|
||||
});
|
||||
return pane;
|
||||
}
|
||||
if (state.pipelineTab === "source") {
|
||||
|
||||
+1245
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user