@surfaces-ui/components 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +4 -0
- package/README.md +51 -2
- package/dist/appComponents.d.ts +86 -0
- package/dist/appComponents.js +555 -0
- package/dist/appComponents.js.map +1 -0
- package/dist/chart/BulletGraph.d.ts +44 -0
- package/dist/chart/BulletGraph.js +41 -0
- package/dist/chart/BulletGraph.js.map +1 -0
- package/dist/chart/Chart.d.ts +178 -0
- package/dist/chart/Chart.js +285 -0
- package/dist/chart/Chart.js.map +1 -0
- package/dist/chart/Sparkline.d.ts +35 -0
- package/dist/chart/Sparkline.js +38 -0
- package/dist/chart/Sparkline.js.map +1 -0
- package/dist/chart/advice.d.ts +32 -0
- package/dist/chart/advice.js +48 -0
- package/dist/chart/advice.js.map +1 -0
- package/dist/chart/option.d.ts +90 -0
- package/dist/chart/option.js +252 -0
- package/dist/chart/option.js.map +1 -0
- package/dist/chart/wheel.d.ts +12 -0
- package/dist/chart/wheel.js +21 -0
- package/dist/chart/wheel.js.map +1 -0
- package/dist/controls/Combobox.d.ts +39 -0
- package/dist/controls/Combobox.js +75 -0
- package/dist/controls/Combobox.js.map +1 -0
- package/dist/controls/ConfirmDialog.d.ts +35 -0
- package/dist/controls/ConfirmDialog.js +84 -0
- package/dist/controls/ConfirmDialog.js.map +1 -0
- package/dist/controls/ItemControls.d.ts +115 -0
- package/dist/controls/ItemControls.js +109 -0
- package/dist/controls/ItemControls.js.map +1 -0
- package/dist/controls/Popover.d.ts +31 -0
- package/dist/controls/Popover.js +114 -0
- package/dist/controls/Popover.js.map +1 -0
- package/dist/controls/ResizeHandle.d.ts +48 -0
- package/dist/controls/ResizeHandle.js +91 -0
- package/dist/controls/ResizeHandle.js.map +1 -0
- package/dist/controls/SegmentedControl.d.ts +27 -0
- package/dist/controls/SegmentedControl.js +17 -0
- package/dist/controls/SegmentedControl.js.map +1 -0
- package/dist/controls/StatusBadge.d.ts +17 -0
- package/dist/controls/StatusBadge.js +10 -0
- package/dist/controls/StatusBadge.js.map +1 -0
- package/dist/controls/context.d.ts +17 -0
- package/dist/controls/context.js +2 -0
- package/dist/controls/context.js.map +1 -0
- package/dist/controls/placement.d.ts +43 -0
- package/dist/controls/placement.js +19 -0
- package/dist/controls/placement.js.map +1 -0
- package/dist/controls/resize.d.ts +23 -0
- package/dist/controls/resize.js +49 -0
- package/dist/controls/resize.js.map +1 -0
- package/dist/data/DataNotes.d.ts +13 -0
- package/dist/data/DataNotes.js +18 -0
- package/dist/data/DataNotes.js.map +1 -0
- package/dist/data/DataSourceProvider.d.ts +11 -0
- package/dist/data/DataSourceProvider.js +21 -0
- package/dist/data/DataSourceProvider.js.map +1 -0
- package/dist/data/export.d.ts +33 -0
- package/dist/data/export.js +77 -0
- package/dist/data/export.js.map +1 -0
- package/dist/data/format.d.ts +44 -0
- package/dist/data/format.js +127 -0
- package/dist/data/format.js.map +1 -0
- package/dist/data/messages.d.ts +13 -0
- package/dist/data/messages.js +2 -0
- package/dist/data/messages.js.map +1 -0
- package/dist/data/useRowWindow.d.ts +70 -0
- package/dist/data/useRowWindow.js +175 -0
- package/dist/data/useRowWindow.js.map +1 -0
- package/dist/discovery/AskData.d.ts +22 -0
- package/dist/discovery/AskData.js +49 -0
- package/dist/discovery/AskData.js.map +1 -0
- package/dist/discovery/ContextBuilder.d.ts +49 -0
- package/dist/discovery/ContextBuilder.js +167 -0
- package/dist/discovery/ContextBuilder.js.map +1 -0
- package/dist/discovery/DataSearch.d.ts +27 -0
- package/dist/discovery/DataSearch.js +73 -0
- package/dist/discovery/DataSearch.js.map +1 -0
- package/dist/discovery/ObjectDetail.d.ts +38 -0
- package/dist/discovery/ObjectDetail.js +129 -0
- package/dist/discovery/ObjectDetail.js.map +1 -0
- package/dist/discovery/RelationshipGraph.d.ts +19 -0
- package/dist/discovery/RelationshipGraph.js +64 -0
- package/dist/discovery/RelationshipGraph.js.map +1 -0
- package/dist/discovery/shared.d.ts +38 -0
- package/dist/discovery/shared.js +64 -0
- package/dist/discovery/shared.js.map +1 -0
- package/dist/editor/SqlEditor.d.ts +41 -0
- package/dist/editor/SqlEditor.js +181 -0
- package/dist/editor/SqlEditor.js.map +1 -0
- package/dist/explore/Explorer.d.ts +110 -0
- package/dist/explore/Explorer.js +471 -0
- package/dist/explore/Explorer.js.map +1 -0
- package/dist/explore/ModelLineage.d.ts +22 -0
- package/dist/explore/ModelLineage.js +70 -0
- package/dist/explore/ModelLineage.js.map +1 -0
- package/dist/explore/ReportBuilder.d.ts +39 -0
- package/dist/explore/ReportBuilder.js +98 -0
- package/dist/explore/ReportBuilder.js.map +1 -0
- package/dist/explore/SemanticModelEditor.d.ts +60 -0
- package/dist/explore/SemanticModelEditor.js +220 -0
- package/dist/explore/SemanticModelEditor.js.map +1 -0
- package/dist/explore/SemanticRows.d.ts +42 -0
- package/dist/explore/SemanticRows.js +121 -0
- package/dist/explore/SemanticRows.js.map +1 -0
- package/dist/explore/SemanticsProvider.d.ts +31 -0
- package/dist/explore/SemanticsProvider.js +72 -0
- package/dist/explore/SemanticsProvider.js.map +1 -0
- package/dist/explore/model.d.ts +151 -0
- package/dist/explore/model.js +344 -0
- package/dist/explore/model.js.map +1 -0
- package/dist/explore/report.d.ts +60 -0
- package/dist/explore/report.js +92 -0
- package/dist/explore/report.js.map +1 -0
- package/dist/explore/semantic-proposal.d.ts +44 -0
- package/dist/explore/semantic-proposal.js +67 -0
- package/dist/explore/semantic-proposal.js.map +1 -0
- package/dist/explore/semantic.d.ts +44 -0
- package/dist/explore/semantic.js +154 -0
- package/dist/explore/semantic.js.map +1 -0
- package/dist/files/FileBrowser.d.ts +42 -0
- package/dist/files/FileBrowser.js +314 -0
- package/dist/files/FileBrowser.js.map +1 -0
- package/dist/files/files.d.ts +65 -0
- package/dist/files/files.js +165 -0
- package/dist/files/files.js.map +1 -0
- package/dist/filter/FilterBar.d.ts +49 -0
- package/dist/filter/FilterBar.js +153 -0
- package/dist/filter/FilterBar.js.map +1 -0
- package/dist/filter/QueryFilters.d.ts +25 -0
- package/dist/filter/QueryFilters.js +58 -0
- package/dist/filter/QueryFilters.js.map +1 -0
- package/dist/form/Form.d.ts +76 -0
- package/dist/form/Form.js +131 -0
- package/dist/form/Form.js.map +1 -0
- package/dist/graph/NodeGraph.d.ts +30 -0
- package/dist/graph/NodeGraph.js +89 -0
- package/dist/graph/NodeGraph.js.map +1 -0
- package/dist/graph/model.d.ts +68 -0
- package/dist/graph/model.js +122 -0
- package/dist/graph/model.js.map +1 -0
- package/dist/grid/DataGrid.d.ts +98 -0
- package/dist/grid/DataGrid.js +400 -0
- package/dist/grid/DataGrid.js.map +1 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +87 -0
- package/dist/index.js.map +1 -0
- package/dist/locale/SurfacesText.d.ts +17 -0
- package/dist/locale/SurfacesText.js +17 -0
- package/dist/locale/SurfacesText.js.map +1 -0
- package/dist/locale/locale.d.ts +305 -0
- package/dist/locale/locale.js +359 -0
- package/dist/locale/locale.js.map +1 -0
- package/dist/menu/ContextMenu.d.ts +31 -0
- package/dist/menu/ContextMenu.js +95 -0
- package/dist/menu/ContextMenu.js.map +1 -0
- package/dist/metric/Metric.d.ts +33 -0
- package/dist/metric/Metric.js +64 -0
- package/dist/metric/Metric.js.map +1 -0
- package/dist/metric/useMeasure.d.ts +25 -0
- package/dist/metric/useMeasure.js +44 -0
- package/dist/metric/useMeasure.js.map +1 -0
- package/dist/model/ModelDiagram.d.ts +142 -0
- package/dist/model/ModelDiagram.js +700 -0
- package/dist/model/ModelDiagram.js.map +1 -0
- package/dist/panzoom/usePanZoom.d.ts +117 -0
- package/dist/panzoom/usePanZoom.js +313 -0
- package/dist/panzoom/usePanZoom.js.map +1 -0
- package/dist/pipeline/DatasetReview.d.ts +48 -0
- package/dist/pipeline/DatasetReview.js +157 -0
- package/dist/pipeline/DatasetReview.js.map +1 -0
- package/dist/pipeline/IngestWizard.d.ts +51 -0
- package/dist/pipeline/IngestWizard.js +79 -0
- package/dist/pipeline/IngestWizard.js.map +1 -0
- package/dist/pipeline/Pipeline.d.ts +171 -0
- package/dist/pipeline/Pipeline.js +203 -0
- package/dist/pipeline/Pipeline.js.map +1 -0
- package/dist/pipeline/PipelineView.d.ts +63 -0
- package/dist/pipeline/PipelineView.js +239 -0
- package/dist/pipeline/PipelineView.js.map +1 -0
- package/dist/pivot/PivotTable.d.ts +94 -0
- package/dist/pivot/PivotTable.js +176 -0
- package/dist/pivot/PivotTable.js.map +1 -0
- package/dist/plan/QueryPlan.d.ts +29 -0
- package/dist/plan/QueryPlan.js +79 -0
- package/dist/plan/QueryPlan.js.map +1 -0
- package/dist/result/QueryResult.d.ts +51 -0
- package/dist/result/QueryResult.js +256 -0
- package/dist/result/QueryResult.js.map +1 -0
- package/dist/review/ActionReceipt.d.ts +52 -0
- package/dist/review/ActionReceipt.js +32 -0
- package/dist/review/ActionReceipt.js.map +1 -0
- package/dist/review/PiiReview.d.ts +37 -0
- package/dist/review/PiiReview.js +29 -0
- package/dist/review/PiiReview.js.map +1 -0
- package/dist/review/PlanReview.d.ts +42 -0
- package/dist/review/PlanReview.js +37 -0
- package/dist/review/PlanReview.js.map +1 -0
- package/dist/review/StepFlow.d.ts +25 -0
- package/dist/review/StepFlow.js +21 -0
- package/dist/review/StepFlow.js.map +1 -0
- package/dist/review/pii.d.ts +21 -0
- package/dist/review/pii.js +67 -0
- package/dist/review/pii.js.map +1 -0
- package/dist/rows/RowList.d.ts +41 -0
- package/dist/rows/RowList.js +72 -0
- package/dist/rows/RowList.js.map +1 -0
- package/dist/schema/ObjectBrowser.d.ts +78 -0
- package/dist/schema/ObjectBrowser.js +467 -0
- package/dist/schema/ObjectBrowser.js.map +1 -0
- package/dist/schema/ObjectInfo.d.ts +25 -0
- package/dist/schema/ObjectInfo.js +69 -0
- package/dist/schema/ObjectInfo.js.map +1 -0
- package/dist/schema/SchemaExplorer.d.ts +32 -0
- package/dist/schema/SchemaExplorer.js +175 -0
- package/dist/schema/SchemaExplorer.js.map +1 -0
- package/dist/schema/refs.d.ts +32 -0
- package/dist/schema/refs.js +65 -0
- package/dist/schema/refs.js.map +1 -0
- package/dist/site/Site.d.ts +191 -0
- package/dist/site/Site.js +138 -0
- package/dist/site/Site.js.map +1 -0
- package/dist/source/ConnectionBuilder.d.ts +54 -0
- package/dist/source/ConnectionBuilder.js +115 -0
- package/dist/source/ConnectionBuilder.js.map +1 -0
- package/dist/source/SourceList.d.ts +17 -0
- package/dist/source/SourceList.js +71 -0
- package/dist/source/SourceList.js.map +1 -0
- package/dist/styles.css +9930 -0
- package/dist/styles.layer.css +9934 -0
- package/dist/table/DataTable.d.ts +72 -0
- package/dist/table/DataTable.js +68 -0
- package/dist/table/DataTable.js.map +1 -0
- package/dist/table/Pagination.d.ts +20 -0
- package/dist/table/Pagination.js +16 -0
- package/dist/table/Pagination.js.map +1 -0
- package/dist/table/SelectionBar.d.ts +43 -0
- package/dist/table/SelectionBar.js +18 -0
- package/dist/table/SelectionBar.js.map +1 -0
- package/dist/text/Markdown.d.ts +71 -0
- package/dist/text/Markdown.js +187 -0
- package/dist/text/Markdown.js.map +1 -0
- package/dist/text/highlight.d.ts +23 -0
- package/dist/text/highlight.js +196 -0
- package/dist/text/highlight.js.map +1 -0
- package/dist/theme/ThemePicker.d.ts +16 -0
- package/dist/theme/ThemePicker.js +50 -0
- package/dist/theme/ThemePicker.js.map +1 -0
- package/dist/theme/ThemeProvider.d.ts +52 -0
- package/dist/theme/ThemeProvider.js +111 -0
- package/dist/theme/ThemeProvider.js.map +1 -0
- package/dist/workspace/NavBar.d.ts +23 -0
- package/dist/workspace/NavBar.js +171 -0
- package/dist/workspace/NavBar.js.map +1 -0
- package/dist/workspace/SideNav.d.ts +61 -0
- package/dist/workspace/SideNav.js +149 -0
- package/dist/workspace/SideNav.js.map +1 -0
- package/dist/workspace/Workspace.d.ts +53 -0
- package/dist/workspace/Workspace.js +243 -0
- package/dist/workspace/Workspace.js.map +1 -0
- package/dist/workspace/icons.d.ts +34 -0
- package/dist/workspace/icons.js +37 -0
- package/dist/workspace/icons.js.map +1 -0
- package/dist/workspace/layout.d.ts +74 -0
- package/dist/workspace/layout.js +276 -0
- package/dist/workspace/layout.js.map +1 -0
- package/package.json +85 -3
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useMemo } from "react";
|
|
3
|
+
import { FIT_PADDING, PanZoomControls, fitView, usePanZoom } from "../panzoom/usePanZoom.js";
|
|
4
|
+
import { numberFormat } from "../locale/locale.js";
|
|
5
|
+
const KIND_LABEL = {
|
|
6
|
+
source: "Source",
|
|
7
|
+
table: "Table",
|
|
8
|
+
view: "View",
|
|
9
|
+
streamingTable: "Streaming table",
|
|
10
|
+
materializedView: "Materialized view",
|
|
11
|
+
temporaryView: "Temporary view",
|
|
12
|
+
sink: "Sink",
|
|
13
|
+
};
|
|
14
|
+
const STATUS_MARK = { idle: "○", starting: "…", running: "…", completed: "✓", failed: "!", cancelled: "×", skipped: "–" };
|
|
15
|
+
const NODE_WIDTH = 200;
|
|
16
|
+
const NODE_HEIGHT = 64;
|
|
17
|
+
const GAP_X = 72;
|
|
18
|
+
const GAP_Y = 20;
|
|
19
|
+
const count = { format: (n) => numberFormat({ notation: "compact", maximumFractionDigits: 1 }).format(n) };
|
|
20
|
+
/**
|
|
21
|
+
* Places nodes in columns from left to right: a node sits one column after
|
|
22
|
+
* the furthest thing that feeds it. The graph itself comes from the engine;
|
|
23
|
+
* this only decides where to draw it. A cycle (which a valid pipeline cannot
|
|
24
|
+
* have) does not hang it.
|
|
25
|
+
*/
|
|
26
|
+
export function layoutPipeline(nodes, edges) {
|
|
27
|
+
const ids = new Set(nodes.map((n) => n.id));
|
|
28
|
+
const inputs = new Map(nodes.map((n) => [n.id, []]));
|
|
29
|
+
for (const edge of edges)
|
|
30
|
+
if (ids.has(edge.from) && ids.has(edge.to))
|
|
31
|
+
inputs.get(edge.to).push(edge.from);
|
|
32
|
+
const column = new Map();
|
|
33
|
+
const visit = (id, trail) => {
|
|
34
|
+
const known = column.get(id);
|
|
35
|
+
if (known !== undefined)
|
|
36
|
+
return known;
|
|
37
|
+
if (trail.has(id))
|
|
38
|
+
return 0;
|
|
39
|
+
trail.add(id);
|
|
40
|
+
const depth = Math.max(-1, ...inputs.get(id).map((from) => visit(from, trail))) + 1;
|
|
41
|
+
trail.delete(id);
|
|
42
|
+
column.set(id, depth);
|
|
43
|
+
return depth;
|
|
44
|
+
};
|
|
45
|
+
for (const node of nodes)
|
|
46
|
+
visit(node.id, new Set());
|
|
47
|
+
const rows = new Map();
|
|
48
|
+
const positions = {};
|
|
49
|
+
for (const node of nodes) {
|
|
50
|
+
const c = column.get(node.id);
|
|
51
|
+
const row = rows.get(c) ?? 0;
|
|
52
|
+
rows.set(c, row + 1);
|
|
53
|
+
positions[node.id] = { x: 16 + c * (NODE_WIDTH + GAP_X), y: 16 + row * (NODE_HEIGHT + GAP_Y), column: c };
|
|
54
|
+
}
|
|
55
|
+
const columns = Math.max(0, ...column.values()) + 1;
|
|
56
|
+
const tallest = Math.max(1, ...rows.values());
|
|
57
|
+
return { positions, width: 32 + columns * NODE_WIDTH + (columns - 1) * GAP_X, height: 32 + tallest * NODE_HEIGHT + (tallest - 1) * GAP_Y };
|
|
58
|
+
}
|
|
59
|
+
/** Everything upstream and downstream of a node, including the node. */
|
|
60
|
+
export function lineageOf(id, edges) {
|
|
61
|
+
const found = new Set([id]);
|
|
62
|
+
const walk = (start, next) => {
|
|
63
|
+
const queue = [start];
|
|
64
|
+
while (queue.length > 0) {
|
|
65
|
+
const at = queue.pop();
|
|
66
|
+
for (const edge of edges) {
|
|
67
|
+
const [here, there] = next(edge);
|
|
68
|
+
if (here === at && !found.has(there)) {
|
|
69
|
+
found.add(there);
|
|
70
|
+
queue.push(there);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
walk(id, (e) => [e.from, e.to]);
|
|
76
|
+
walk(id, (e) => [e.to, e.from]);
|
|
77
|
+
return found;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* A pipeline as a graph: sources, tables, views and sinks from left to
|
|
81
|
+
* right, joined by the flows between them, each with its latest status.
|
|
82
|
+
* Selecting a node highlights what feeds it and what it feeds. Dashed lines
|
|
83
|
+
* are streaming flows.
|
|
84
|
+
*/
|
|
85
|
+
export function PipelineGraph(props) {
|
|
86
|
+
const { nodes, edges, selected, height = 360 } = props;
|
|
87
|
+
const layout = useMemo(() => layoutPipeline(nodes, edges), [nodes, edges]);
|
|
88
|
+
const lineage = useMemo(() => (selected ? lineageOf(selected, edges) : undefined), [selected, edges]);
|
|
89
|
+
const id = useId();
|
|
90
|
+
const panZoom = usePanZoom({ content: { width: layout.width, height: layout.height } });
|
|
91
|
+
// The box is no taller than the whole pipeline needs once fitted to its width, so a wide graph leaves no empty band.
|
|
92
|
+
const fitted = panZoom.viewport.width > 0 ? fitView(layout, { width: panZoom.viewport.width, height }).k : 1;
|
|
93
|
+
const boxHeight = Math.min(height, Math.max(Math.ceil(layout.height * fitted) + FIT_PADDING * 2, Math.min(height, 160)));
|
|
94
|
+
const order = useMemo(() => [...nodes].sort((a, b) => layout.positions[a.id].x - layout.positions[b.id].x || layout.positions[a.id].y - layout.positions[b.id].y), [nodes, layout]);
|
|
95
|
+
const onKeyDown = (event, index) => {
|
|
96
|
+
const step = event.key === "ArrowRight" || event.key === "ArrowDown" ? 1 : event.key === "ArrowLeft" || event.key === "ArrowUp" ? -1 : 0;
|
|
97
|
+
if (step === 0)
|
|
98
|
+
return;
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
const buttons = event.currentTarget.parentElement?.querySelectorAll("button.sf-pipeline-node");
|
|
101
|
+
buttons?.[Math.max(0, Math.min(order.length - 1, index + step))]?.focus();
|
|
102
|
+
};
|
|
103
|
+
if (nodes.length === 0)
|
|
104
|
+
return _jsx("p", { className: "sf-object-muted", children: "This pipeline has no datasets." });
|
|
105
|
+
return (_jsxs("div", { className: ["sf-pipeline-graph", props.className].filter(Boolean).join(" "), children: [_jsx(PanZoomControls, { panZoom: panZoom, label: `Zoom the ${(props.label ?? "pipeline").toLowerCase()}` }), _jsxs("div", { ref: panZoom.viewportRef, className: "sf-pipeline sf-panzoom", style: { height: boxHeight }, role: "group", "aria-label": props.label ?? "Pipeline", "aria-describedby": `${id}-keys`, ...panZoom.viewportProps, children: [_jsx("span", { id: `${id}-keys`, className: "sf-a2-visually-hidden", children: "Drag the background or scroll to move around. Plus and minus zoom, 0 fits the pipeline to view, arrow keys move it." }), _jsxs("div", { className: "sf-pipeline-plane sf-panzoom-plane", style: { width: layout.width, height: layout.height, ...panZoom.planeStyle }, "data-animate": panZoom.animate || undefined, children: [_jsx("svg", { width: layout.width, height: layout.height, "aria-hidden": "true", children: edges.map((edge) => {
|
|
106
|
+
const from = layout.positions[edge.from];
|
|
107
|
+
const to = layout.positions[edge.to];
|
|
108
|
+
if (!from || !to)
|
|
109
|
+
return null;
|
|
110
|
+
const [x1, y1, x2, y2] = [from.x + NODE_WIDTH, from.y + NODE_HEIGHT / 2, to.x, to.y + NODE_HEIGHT / 2];
|
|
111
|
+
const bend = Math.max(24, (x2 - x1) / 2);
|
|
112
|
+
const lit = !lineage || (lineage.has(edge.from) && lineage.has(edge.to));
|
|
113
|
+
return _jsx("path", { d: `M ${x1} ${y1} C ${x1 + bend} ${y1}, ${x2 - bend} ${y2}, ${x2} ${y2}`, "data-mode": edge.mode ?? "batch", "data-dim": lit ? undefined : "" }, `${edge.from}>${edge.to}`);
|
|
114
|
+
}) }), order.map((node, index) => {
|
|
115
|
+
const at = layout.positions[node.id];
|
|
116
|
+
const status = node.status ?? "idle";
|
|
117
|
+
const feeds = edges.filter((e) => e.from === node.id).map((e) => nodes.find((n) => n.id === e.to)?.name).filter(Boolean);
|
|
118
|
+
return (_jsxs("button", { type: "button", className: "sf-pipeline-node", style: { left: at.x, top: at.y, width: NODE_WIDTH, height: NODE_HEIGHT }, "data-status": status, "data-kind": node.kind, "data-dim": lineage && !lineage.has(node.id) ? "" : undefined, "aria-pressed": selected === node.id, onClick: () => props.onSelect?.(node), onKeyDown: (event) => onKeyDown(event, index), children: [_jsxs("span", { className: "sf-pipeline-name", children: [_jsx("span", { className: "sf-pipeline-mark", "aria-hidden": "true", children: STATUS_MARK[status] }), node.name, " ", _jsx("span", { className: "sf-visually-hidden", children: `(${KIND_LABEL[node.kind]}, ${status}${feeds.length > 0 ? `, feeds ${feeds.join(", ")}` : ""})` })] }), _jsxs("span", { className: "sf-pipeline-meta", "aria-hidden": "true", children: [KIND_LABEL[node.kind], node.layer ? ` · ${node.layer}` : ""] }), _jsxs("span", { className: "sf-pipeline-meta", "aria-hidden": "true", children: [node.rowsWritten !== undefined ? `${count.format(node.rowsWritten)} rows` : status, node.expectationsFailed ? ` · ${count.format(node.expectationsFailed)} records broke rules` : "", node.checksFailed ? ` · ${node.checksFailed} ${node.checksFailed === 1 ? "check" : "checks"} failed` : "", node.checksWarned ? ` · ${node.checksWarned} ${node.checksWarned === 1 ? "warning" : "warnings"}` : ""] })] }, node.id));
|
|
119
|
+
})] })] })] }));
|
|
120
|
+
}
|
|
121
|
+
const REFRESH_LABEL = { default: "New data", refresh: "Refresh", fullRefresh: "Full refresh" };
|
|
122
|
+
/** A duration in words, e.g. "1 min 5 s". */
|
|
123
|
+
export function durationText(ms) {
|
|
124
|
+
if (!(ms >= 0))
|
|
125
|
+
return "–";
|
|
126
|
+
const seconds = Math.round(ms / 1000);
|
|
127
|
+
if (seconds < 60)
|
|
128
|
+
return `${seconds} s`;
|
|
129
|
+
const minutes = Math.floor(seconds / 60);
|
|
130
|
+
if (minutes < 60)
|
|
131
|
+
return `${minutes} min ${seconds % 60} s`;
|
|
132
|
+
return `${Math.floor(minutes / 60)} h ${minutes % 60} min`;
|
|
133
|
+
}
|
|
134
|
+
/** The runs of a pipeline, newest first: how each ended, how long it took, what it refreshed and why it failed. */
|
|
135
|
+
export function RunHistory({ runs, selected, onSelect, className }) {
|
|
136
|
+
if (runs.length === 0)
|
|
137
|
+
return _jsx("p", { className: "sf-object-muted", children: "This pipeline has not run yet." });
|
|
138
|
+
const sorted = [...runs].sort((a, b) => b.startTime.localeCompare(a.startTime));
|
|
139
|
+
const longest = Math.max(1, ...sorted.map((r) => (r.endTime ? Date.parse(r.endTime) - Date.parse(r.startTime) : 0)));
|
|
140
|
+
return (_jsx("div", { className: ["sf-object-table sf-runs", className].filter(Boolean).join(" "), tabIndex: 0, role: "region", "aria-label": "Runs", children: _jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: "Run" }), _jsx("th", { scope: "col", children: "Result" }), _jsx("th", { scope: "col", children: "Started" }), _jsx("th", { scope: "col", children: "Took" }), _jsx("th", { scope: "col", children: "Kind" }), _jsx("th", { scope: "col", children: "Started by" })] }) }), _jsx("tbody", { children: sorted.map((run) => {
|
|
141
|
+
const took = run.endTime ? Date.parse(run.endTime) - Date.parse(run.startTime) : Number.NaN;
|
|
142
|
+
return (_jsxs("tr", { "data-status": run.state, "aria-selected": selected === run.id, children: [_jsx("th", { scope: "row", children: onSelect ? (_jsx("button", { type: "button", className: "sf-runs-open", onClick: () => onSelect(run), children: run.id })) : (run.id) }), _jsxs("td", { children: [_jsx("span", { className: "sf-pipeline-mark", "aria-hidden": "true", children: STATUS_MARK[run.state] }), " ", run.state, run.errorMessage && _jsx("span", { className: "sf-object-column-note", children: run.errorMessage })] }), _jsx("td", { children: run.startTime.replace("T", " ").slice(0, 19) }), _jsxs("td", { children: [_jsx("span", { className: "sf-runs-bar", style: { inlineSize: `${Number.isNaN(took) ? 0 : Math.max(2, (took / longest) * 100)}%` }, "aria-hidden": "true" }), Number.isNaN(took) ? "In progress" : durationText(took)] }), _jsxs("td", { children: [REFRESH_LABEL[run.refreshKind ?? "default"], run.datasets && run.datasets.length > 0 ? ` · ${run.datasets.length} ${run.datasets.length === 1 ? "dataset" : "datasets"}` : ""] }), _jsx("td", { children: run.trigger ?? "–" })] }, run.id));
|
|
143
|
+
}) })] }) }));
|
|
144
|
+
}
|
|
145
|
+
const ACTION_LABEL = { warn: "Kept, with a warning", drop: "Dropped", fail: "Fails the run" };
|
|
146
|
+
const full = { format: (n) => numberFormat().format(n) };
|
|
147
|
+
/** Data quality rules for a pipeline, worst first, with how many records passed and failed. The engine does the checking. */
|
|
148
|
+
export function ExpectationsPanel({ expectations, onOpenFailing, className }) {
|
|
149
|
+
if (expectations.length === 0)
|
|
150
|
+
return _jsx("p", { className: "sf-object-muted", children: "No data quality rules are defined." });
|
|
151
|
+
const rate = (e) => (e.passedRecords + e.failedRecords === 0 ? 0 : e.failedRecords / (e.passedRecords + e.failedRecords));
|
|
152
|
+
const sorted = [...expectations].sort((a, b) => rate(b) - rate(a) || a.name.localeCompare(b.name));
|
|
153
|
+
return (_jsx("div", { className: ["sf-object-table sf-expectations", className].filter(Boolean).join(" "), tabIndex: 0, role: "region", "aria-label": "Data quality rules", children: _jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: "Rule" }), _jsx("th", { scope: "col", children: "Dataset" }), _jsx("th", { scope: "col", children: "A failing record is" }), _jsx("th", { scope: "col", className: "sf-object-number", children: "Failed" }), _jsx("th", { scope: "col", children: "Share failing" })] }) }), _jsx("tbody", { children: sorted.map((item) => (_jsxs("tr", { "data-failing": item.failedRecords > 0 || undefined, children: [_jsxs("th", { scope: "row", children: [item.name, _jsx("span", { className: "sf-object-column-note sf-object-type", children: item.constraint })] }), _jsx("td", { children: item.dataset }), _jsx("td", { children: ACTION_LABEL[item.action] }), _jsxs("td", { className: "sf-object-number", children: [full.format(item.failedRecords), " of ", full.format(item.passedRecords + item.failedRecords)] }), _jsxs("td", { children: [_jsx("span", { className: "sf-meter", role: "img", "aria-label": `${(rate(item) * 100).toFixed(1)}% failing`, children: _jsx("span", { style: { inlineSize: `${Math.min(100, rate(item) * 100)}%` }, "data-bad": "" }) }), " ", (rate(item) * 100).toFixed(1), "%", onOpenFailing && item.failedRecords > 0 && (_jsx("button", { type: "button", className: "sf-button sf-expectations-open", onClick: () => onOpenFailing(item), children: "See failing rows" }))] })] }, `${item.dataset}.${item.name}`))) })] }) }));
|
|
154
|
+
}
|
|
155
|
+
/** A dataset's checks, failures first, with what the engine counted. Counts only: no row is read here. */
|
|
156
|
+
export function ChecksPanel({ checks, onOpenFailing, className }) {
|
|
157
|
+
if (checks.length === 0)
|
|
158
|
+
return _jsx("p", { className: "sf-object-muted", children: "No checks on this dataset." });
|
|
159
|
+
const order = (c) => (c.failedRecords === undefined ? 1 : c.failedRecords > 0 ? (c.severity === "fail" ? 0 : 0.5) : 2);
|
|
160
|
+
const sorted = [...checks].sort((a, b) => order(a) - order(b) || a.name.localeCompare(b.name));
|
|
161
|
+
return (_jsx("div", { className: ["sf-object-table sf-checks", className].filter(Boolean).join(" "), tabIndex: 0, role: "region", "aria-label": "Checks", children: _jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: "Check" }), _jsx("th", { scope: "col", children: "Result" }), _jsx("th", { scope: "col", children: "On failure" })] }) }), _jsx("tbody", { children: sorted.map((check) => {
|
|
162
|
+
const failed = (check.failedRecords ?? 0) > 0;
|
|
163
|
+
return (_jsxs("tr", { "data-failing": failed || undefined, children: [_jsxs("th", { scope: "row", children: [check.name, _jsxs("span", { className: "sf-object-column-note sf-object-type", children: [check.description, check.fromKey ? " (from the key)" : ""] })] }), _jsxs("td", { children: [_jsx("span", { className: "sf-check-mark", "data-state": check.failedRecords === undefined ? "unknown" : failed ? check.severity : "pass", children: check.failedRecords === undefined ? "Not run yet" : failed ? (check.severity === "fail" ? "! Failed" : "! Warning") : "✓ Passed" }), check.summary && check.summary !== "Passed." && _jsx("span", { className: "sf-object-column-note", children: check.summary }), onOpenFailing && failed && check.canOpenFailing !== false && (_jsx("button", { type: "button", className: "sf-button sf-expectations-open", onClick: () => onOpenFailing(check), children: "See what breaks it" }))] }), _jsx("td", { children: check.severity === "fail" ? "Stops what reads it" : "Warns" })] }, check.name));
|
|
164
|
+
}) })] }) }));
|
|
165
|
+
}
|
|
166
|
+
const CHANGE_LABEL = { added: "New column", removed: "Missing column", typeChanged: "Type changed" };
|
|
167
|
+
const CHANGE_MARK = { added: "+", removed: "−", typeChanged: "~" };
|
|
168
|
+
/** How incoming data differs from the table it is loaded into: new, missing and retyped columns. */
|
|
169
|
+
export function SchemaDiff({ changes, rescuedCount, mode, className }) {
|
|
170
|
+
return (_jsxs("div", { className: ["sf-schema-diff", className].filter(Boolean).join(" "), children: [(mode || rescuedCount !== undefined) && (_jsx("p", { className: "sf-object-facts", children: [mode ? `New columns: ${mode}` : undefined, rescuedCount !== undefined ? `${full.format(rescuedCount)} records had fields set aside` : undefined].filter(Boolean).join(" · ") })), changes.length === 0 ? (_jsx("p", { className: "sf-object-muted", children: "The incoming data matches the table." })) : (_jsx("ul", { children: changes.map((item) => (_jsxs("li", { "data-change": item.change, children: [_jsx("span", { className: "sf-schema-diff-mark", "aria-hidden": "true", children: CHANGE_MARK[item.change] }), _jsx("strong", { children: item.column }), _jsx("span", { children: CHANGE_LABEL[item.change] }), _jsx("span", { className: "sf-object-type", children: item.change === "typeChanged" ? `${item.before ?? "?"} → ${item.after ?? "?"}` : (item.after ?? item.before ?? "") })] }, `${item.change}:${item.column}`))) }))] }));
|
|
171
|
+
}
|
|
172
|
+
const METRICS = [
|
|
173
|
+
{ key: "inputRowsPerSecond", label: "Input rate", unit: "rows/s" },
|
|
174
|
+
{ key: "processedRowsPerSecond", label: "Processing rate", unit: "rows/s" },
|
|
175
|
+
{ key: "numInputRows", label: "Rows per batch", unit: "rows" },
|
|
176
|
+
{ key: "batchDurationMs", label: "Batch duration", unit: "ms" },
|
|
177
|
+
{ key: "stateRows", label: "Rows in state", unit: "rows" },
|
|
178
|
+
];
|
|
179
|
+
/** Points for a sparkline over a 100 by 28 box. */
|
|
180
|
+
export function sparkline(values) {
|
|
181
|
+
if (values.length === 0)
|
|
182
|
+
return "";
|
|
183
|
+
const max = Math.max(...values);
|
|
184
|
+
const min = Math.min(...values);
|
|
185
|
+
const span = max - min || 1;
|
|
186
|
+
return values.map((v, i) => `${values.length === 1 ? 50 : (i / (values.length - 1)) * 100},${26 - ((v - min) / span) * 24}`).join(" ");
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* How a streaming query is keeping up: input and processing rates, batch
|
|
190
|
+
* size and duration, and state size, each with its latest value and recent
|
|
191
|
+
* trend. A processing rate below the input rate means it is falling behind.
|
|
192
|
+
*/
|
|
193
|
+
export function StreamMetrics({ progress, className }) {
|
|
194
|
+
if (progress.length === 0)
|
|
195
|
+
return _jsx("p", { className: "sf-object-muted", children: "No progress has been reported yet." });
|
|
196
|
+
const latest = progress.at(-1);
|
|
197
|
+
const behind = latest.processedRowsPerSecond < latest.inputRowsPerSecond;
|
|
198
|
+
return (_jsxs("div", { className: ["sf-stream", className].filter(Boolean).join(" "), children: [_jsxs("p", { className: "sf-stream-status", "data-behind": behind || undefined, children: [_jsx("span", { "aria-hidden": "true", children: behind ? "!" : "✓" }), " ", behind ? "Falling behind: rows arrive faster than they are processed." : "Keeping up with its input.", " Last report", " ", latest.timestamp.replace("T", " ").slice(0, 19), "."] }), _jsx("dl", { className: "sf-stream-grid", children: METRICS.filter((m) => progress.some((p) => p[m.key] !== undefined)).map((metric) => {
|
|
199
|
+
const values = progress.map((p) => p[metric.key]).filter((v) => v !== undefined);
|
|
200
|
+
return (_jsxs("div", { className: "sf-stream-tile", children: [_jsx("dt", { children: metric.label }), _jsxs("dd", { children: [count.format(values.at(-1)), " ", _jsx("span", { children: metric.unit }), _jsx("svg", { viewBox: "0 0 100 28", preserveAspectRatio: "none", role: "img", "aria-label": `${metric.label} over the last ${values.length} reports, from ${count.format(Math.min(...values))} to ${count.format(Math.max(...values))}`, children: _jsx("polyline", { points: sparkline(values) }) })] })] }, metric.key));
|
|
201
|
+
}) })] }));
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=Pipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pipeline.js","sourceRoot":"","sources":["../../src/pipeline/Pipeline.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAsB,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AA8BnD,MAAM,UAAU,GAAqC;IACnD,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,iBAAiB;IACjC,gBAAgB,EAAE,mBAAmB;IACrC,aAAa,EAAE,gBAAgB;IAC/B,IAAI,EAAE,MAAM;CACb,CAAC;AACF,MAAM,WAAW,GAAmC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;AAC1J,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,KAAK,GAAG,EAAE,CAAC;AACjB,MAAM,KAAK,GAAG,EAAE,CAAC;AACjB,MAAM,KAAK,GAAG,EAAE,MAAM,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AAQnH;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,KAAqB,EAAE,KAAqB;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MAAM,CAAC,CAAC,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,YACrN,mBAAU,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,GAAI,GACnC,IACH,KAPG,MAAM,CAAC,GAAG,CAQd,CACP,CAAC;gBACJ,CAAC,CAAC,GACC,IACD,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { type KeyboardEvent, useId, useMemo } from \"react\";\nimport { FIT_PADDING, PanZoomControls, fitView, usePanZoom } from \"../panzoom/usePanZoom.js\";\nimport { numberFormat } from \"../locale/locale.js\";\n\nexport type PipelineNodeKind = \"source\" | \"table\" | \"view\" | \"streamingTable\" | \"materializedView\" | \"temporaryView\" | \"sink\";\nexport type PipelineStatus = \"idle\" | \"starting\" | \"running\" | \"completed\" | \"failed\" | \"cancelled\" | \"skipped\";\n\n/** A dataset, source or sink in a pipeline. */\nexport interface PipelineNode {\n id: string;\n name: string;\n kind: PipelineNodeKind;\n status?: PipelineStatus;\n /** Medallion layer, when the pipeline uses one. */\n layer?: \"bronze\" | \"silver\" | \"gold\";\n rowsWritten?: number;\n /** Records that failed a data quality expectation in the latest run. */\n expectationsFailed?: number;\n /** Checks over the whole dataset (unique, not empty, found in, one of, row count) that failed in the latest run. */\n checksFailed?: number;\n /** Checks of severity warn that found rows. */\n checksWarned?: number;\n}\n\n/** A flow: data moving from one node to another. */\nexport interface PipelineEdge {\n from: string;\n to: string;\n flowName?: string;\n mode?: \"streaming\" | \"batch\";\n}\n\nconst KIND_LABEL: Record<PipelineNodeKind, string> = {\n source: \"Source\",\n table: \"Table\",\n view: \"View\",\n streamingTable: \"Streaming table\",\n materializedView: \"Materialized view\",\n temporaryView: \"Temporary view\",\n sink: \"Sink\",\n};\nconst STATUS_MARK: Record<PipelineStatus, string> = { idle: \"○\", starting: \"…\", running: \"…\", completed: \"✓\", failed: \"!\", cancelled: \"×\", skipped: \"–\" };\nconst NODE_WIDTH = 200;\nconst NODE_HEIGHT = 64;\nconst GAP_X = 72;\nconst GAP_Y = 20;\nconst count = { format: (n: number) => numberFormat({ notation: \"compact\", maximumFractionDigits: 1 }).format(n) };\n\nexport interface PipelineLayout {\n positions: Record<string, { x: number; y: number; column: number }>;\n width: number;\n height: number;\n}\n\n/**\n * Places nodes in columns from left to right: a node sits one column after\n * the furthest thing that feeds it. The graph itself comes from the engine;\n * this only decides where to draw it. A cycle (which a valid pipeline cannot\n * have) does not hang it.\n */\nexport function layoutPipeline(nodes: PipelineNode[], edges: PipelineEdge[]): PipelineLayout {\n const ids = new Set(nodes.map((n) => n.id));\n const inputs = new Map<string, string[]>(nodes.map((n) => [n.id, []]));\n for (const edge of edges) if (ids.has(edge.from) && ids.has(edge.to)) inputs.get(edge.to)!.push(edge.from);\n const column = new Map<string, number>();\n const visit = (id: string, trail: Set<string>): number => {\n const known = column.get(id);\n if (known !== undefined) return known;\n if (trail.has(id)) return 0;\n trail.add(id);\n const depth = Math.max(-1, ...inputs.get(id)!.map((from) => visit(from, trail))) + 1;\n trail.delete(id);\n column.set(id, depth);\n return depth;\n };\n for (const node of nodes) visit(node.id, new Set());\n const rows = new Map<number, number>();\n const positions: PipelineLayout[\"positions\"] = {};\n for (const node of nodes) {\n const c = column.get(node.id)!;\n const row = rows.get(c) ?? 0;\n rows.set(c, row + 1);\n positions[node.id] = { x: 16 + c * (NODE_WIDTH + GAP_X), y: 16 + row * (NODE_HEIGHT + GAP_Y), column: c };\n }\n const columns = Math.max(0, ...column.values()) + 1;\n const tallest = Math.max(1, ...rows.values());\n return { positions, width: 32 + columns * NODE_WIDTH + (columns - 1) * GAP_X, height: 32 + tallest * NODE_HEIGHT + (tallest - 1) * GAP_Y };\n}\n\n/** Everything upstream and downstream of a node, including the node. */\nexport function lineageOf(id: string, edges: PipelineEdge[]): Set<string> {\n const found = new Set([id]);\n const walk = (start: string, next: (edge: PipelineEdge) => [string, string]) => {\n const queue = [start];\n while (queue.length > 0) {\n const at = queue.pop()!;\n for (const edge of edges) {\n const [here, there] = next(edge);\n if (here === at && !found.has(there)) {\n found.add(there);\n queue.push(there);\n }\n }\n }\n };\n walk(id, (e) => [e.from, e.to]);\n walk(id, (e) => [e.to, e.from]);\n return found;\n}\n\nexport interface PipelineGraphProps {\n nodes: PipelineNode[];\n edges: PipelineEdge[];\n /** The selected node. Its upstream and downstream are highlighted. */\n selected?: string;\n onSelect?(node: PipelineNode): void;\n /** Largest height of the canvas in px; a smaller pipeline takes less. Defaults to 360. */\n height?: number;\n /** Accessible name. Defaults to \"Pipeline\". */\n label?: string;\n className?: string;\n}\n\n/**\n * A pipeline as a graph: sources, tables, views and sinks from left to\n * right, joined by the flows between them, each with its latest status.\n * Selecting a node highlights what feeds it and what it feeds. Dashed lines\n * are streaming flows.\n */\nexport function PipelineGraph(props: PipelineGraphProps) {\n const { nodes, edges, selected, height = 360 } = props;\n const layout = useMemo(() => layoutPipeline(nodes, edges), [nodes, edges]);\n const lineage = useMemo(() => (selected ? lineageOf(selected, edges) : undefined), [selected, edges]);\n const id = useId();\n const panZoom = usePanZoom({ content: { width: layout.width, height: layout.height } });\n // The box is no taller than the whole pipeline needs once fitted to its width, so a wide graph leaves no empty band.\n const fitted = panZoom.viewport.width > 0 ? fitView(layout, { width: panZoom.viewport.width, height }).k : 1;\n const boxHeight = Math.min(height, Math.max(Math.ceil(layout.height * fitted) + FIT_PADDING * 2, Math.min(height, 160)));\n const order = useMemo(() => [...nodes].sort((a, b) => layout.positions[a.id]!.x - layout.positions[b.id]!.x || layout.positions[a.id]!.y - layout.positions[b.id]!.y), [nodes, layout]);\n\n const onKeyDown = (event: KeyboardEvent<HTMLButtonElement>, index: number) => {\n const step = event.key === \"ArrowRight\" || event.key === \"ArrowDown\" ? 1 : event.key === \"ArrowLeft\" || event.key === \"ArrowUp\" ? -1 : 0;\n if (step === 0) return;\n event.preventDefault();\n const buttons = event.currentTarget.parentElement?.querySelectorAll<HTMLButtonElement>(\"button.sf-pipeline-node\");\n buttons?.[Math.max(0, Math.min(order.length - 1, index + step))]?.focus();\n };\n\n if (nodes.length === 0) return <p className=\"sf-object-muted\">This pipeline has no datasets.</p>;\n return (\n <div className={[\"sf-pipeline-graph\", props.className].filter(Boolean).join(\" \")}>\n <PanZoomControls panZoom={panZoom} label={`Zoom the ${(props.label ?? \"pipeline\").toLowerCase()}`} />\n <div\n ref={panZoom.viewportRef}\n className=\"sf-pipeline sf-panzoom\"\n style={{ height: boxHeight }}\n role=\"group\"\n aria-label={props.label ?? \"Pipeline\"}\n aria-describedby={`${id}-keys`}\n {...panZoom.viewportProps}\n >\n <span id={`${id}-keys`} className=\"sf-a2-visually-hidden\">\n Drag the background or scroll to move around. Plus and minus zoom, 0 fits the pipeline to view, arrow keys move it.\n </span>\n <div className=\"sf-pipeline-plane sf-panzoom-plane\" style={{ width: layout.width, height: layout.height, ...panZoom.planeStyle }} data-animate={panZoom.animate || undefined}>\n <svg width={layout.width} height={layout.height} aria-hidden=\"true\">\n {edges.map((edge) => {\n const from = layout.positions[edge.from];\n const to = layout.positions[edge.to];\n if (!from || !to) return null;\n const [x1, y1, x2, y2] = [from.x + NODE_WIDTH, from.y + NODE_HEIGHT / 2, to.x, to.y + NODE_HEIGHT / 2];\n const bend = Math.max(24, (x2 - x1) / 2);\n const lit = !lineage || (lineage.has(edge.from) && lineage.has(edge.to));\n return <path key={`${edge.from}>${edge.to}`} d={`M ${x1} ${y1} C ${x1 + bend} ${y1}, ${x2 - bend} ${y2}, ${x2} ${y2}`} data-mode={edge.mode ?? \"batch\"} data-dim={lit ? undefined : \"\"} />;\n })}\n </svg>\n {order.map((node, index) => {\n const at = layout.positions[node.id]!;\n const status = node.status ?? \"idle\";\n const feeds = edges.filter((e) => e.from === node.id).map((e) => nodes.find((n) => n.id === e.to)?.name).filter(Boolean);\n return (\n <button\n key={node.id}\n type=\"button\"\n className=\"sf-pipeline-node\"\n style={{ left: at.x, top: at.y, width: NODE_WIDTH, height: NODE_HEIGHT }}\n data-status={status}\n data-kind={node.kind}\n data-dim={lineage && !lineage.has(node.id) ? \"\" : undefined}\n aria-pressed={selected === node.id}\n onClick={() => props.onSelect?.(node)}\n onKeyDown={(event) => onKeyDown(event, index)}\n >\n <span className=\"sf-pipeline-name\">\n <span className=\"sf-pipeline-mark\" aria-hidden=\"true\">\n {STATUS_MARK[status]}\n </span>\n {node.name}\n {/* The name read out begins with the visible name, as WCAG 2.5.3 asks; the lines below say the same for the eye. */}\n {\" \"}\n <span className=\"sf-visually-hidden\">{`(${KIND_LABEL[node.kind]}, ${status}${feeds.length > 0 ? `, feeds ${feeds.join(\", \")}` : \"\"})`}</span>\n </span>\n <span className=\"sf-pipeline-meta\" aria-hidden=\"true\">\n {KIND_LABEL[node.kind]}\n {node.layer ? ` · ${node.layer}` : \"\"}\n </span>\n <span className=\"sf-pipeline-meta\" aria-hidden=\"true\">\n {node.rowsWritten !== undefined ? `${count.format(node.rowsWritten)} rows` : status}\n {node.expectationsFailed ? ` · ${count.format(node.expectationsFailed)} records broke rules` : \"\"}\n {node.checksFailed ? ` · ${node.checksFailed} ${node.checksFailed === 1 ? \"check\" : \"checks\"} failed` : \"\"}\n {node.checksWarned ? ` · ${node.checksWarned} ${node.checksWarned === 1 ? \"warning\" : \"warnings\"}` : \"\"}\n </span>\n </button>\n );\n })}\n </div>\n </div>\n </div>\n );\n}\n\n/** One run (update) of a pipeline. */\nexport interface PipelineRun {\n id: string;\n state: PipelineStatus;\n /** ISO 8601. */\n startTime: string;\n endTime?: string;\n /** What started it, e.g. \"schedule\" or \"manual\". */\n trigger?: string;\n /** \"default\" processes new data; \"refresh\" recomputes; \"fullRefresh\" clears data and checkpoints first. */\n refreshKind?: \"default\" | \"refresh\" | \"fullRefresh\";\n datasets?: string[];\n errorMessage?: string;\n}\n\nconst REFRESH_LABEL = { default: \"New data\", refresh: \"Refresh\", fullRefresh: \"Full refresh\" } as const;\n\n/** A duration in words, e.g. \"1 min 5 s\". */\nexport function durationText(ms: number): string {\n if (!(ms >= 0)) return \"–\";\n const seconds = Math.round(ms / 1000);\n if (seconds < 60) return `${seconds} s`;\n const minutes = Math.floor(seconds / 60);\n if (minutes < 60) return `${minutes} min ${seconds % 60} s`;\n return `${Math.floor(minutes / 60)} h ${minutes % 60} min`;\n}\n\nexport interface RunHistoryProps {\n runs: PipelineRun[];\n selected?: string;\n onSelect?(run: PipelineRun): void;\n className?: string;\n}\n\n/** The runs of a pipeline, newest first: how each ended, how long it took, what it refreshed and why it failed. */\nexport function RunHistory({ runs, selected, onSelect, className }: RunHistoryProps) {\n if (runs.length === 0) return <p className=\"sf-object-muted\">This pipeline has not run yet.</p>;\n const sorted = [...runs].sort((a, b) => b.startTime.localeCompare(a.startTime));\n const longest = Math.max(1, ...sorted.map((r) => (r.endTime ? Date.parse(r.endTime) - Date.parse(r.startTime) : 0)));\n return (\n <div className={[\"sf-object-table sf-runs\", className].filter(Boolean).join(\" \")} tabIndex={0} role=\"region\" aria-label=\"Runs\">\n <table>\n <thead>\n <tr>\n <th scope=\"col\">Run</th>\n <th scope=\"col\">Result</th>\n <th scope=\"col\">Started</th>\n <th scope=\"col\">Took</th>\n <th scope=\"col\">Kind</th>\n <th scope=\"col\">Started by</th>\n </tr>\n </thead>\n <tbody>\n {sorted.map((run) => {\n const took = run.endTime ? Date.parse(run.endTime) - Date.parse(run.startTime) : Number.NaN;\n return (\n <tr key={run.id} data-status={run.state} aria-selected={selected === run.id}>\n <th scope=\"row\">\n {onSelect ? (\n <button type=\"button\" className=\"sf-runs-open\" onClick={() => onSelect(run)}>\n {run.id}\n </button>\n ) : (\n run.id\n )}\n </th>\n <td>\n <span className=\"sf-pipeline-mark\" aria-hidden=\"true\">\n {STATUS_MARK[run.state]}\n </span>{\" \"}\n {run.state}\n {run.errorMessage && <span className=\"sf-object-column-note\">{run.errorMessage}</span>}\n </td>\n <td>{run.startTime.replace(\"T\", \" \").slice(0, 19)}</td>\n <td>\n <span className=\"sf-runs-bar\" style={{ inlineSize: `${Number.isNaN(took) ? 0 : Math.max(2, (took / longest) * 100)}%` }} aria-hidden=\"true\" />\n {Number.isNaN(took) ? \"In progress\" : durationText(took)}\n </td>\n <td>\n {REFRESH_LABEL[run.refreshKind ?? \"default\"]}\n {run.datasets && run.datasets.length > 0 ? ` · ${run.datasets.length} ${run.datasets.length === 1 ? \"dataset\" : \"datasets\"}` : \"\"}\n </td>\n <td>{run.trigger ?? \"–\"}</td>\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n );\n}\n\n/** One data quality rule and how the latest run did against it. */\nexport interface Expectation {\n name: string;\n dataset: string;\n /** The rule, e.g. `amount >= 0`. */\n constraint: string;\n /** What happens to a failing record: kept with a warning, dropped, or the run fails. */\n action: \"warn\" | \"drop\" | \"fail\";\n passedRecords: number;\n failedRecords: number;\n}\n\nconst ACTION_LABEL = { warn: \"Kept, with a warning\", drop: \"Dropped\", fail: \"Fails the run\" } as const;\nconst full = { format: (n: number) => numberFormat().format(n) };\n\nexport interface ExpectationsPanelProps {\n expectations: Expectation[];\n /** Called to look at the records that failed a rule, typically by opening a query. */\n onOpenFailing?(expectation: Expectation): void;\n className?: string;\n}\n\n/** Data quality rules for a pipeline, worst first, with how many records passed and failed. The engine does the checking. */\nexport function ExpectationsPanel({ expectations, onOpenFailing, className }: ExpectationsPanelProps) {\n if (expectations.length === 0) return <p className=\"sf-object-muted\">No data quality rules are defined.</p>;\n const rate = (e: Expectation) => (e.passedRecords + e.failedRecords === 0 ? 0 : e.failedRecords / (e.passedRecords + e.failedRecords));\n const sorted = [...expectations].sort((a, b) => rate(b) - rate(a) || a.name.localeCompare(b.name));\n return (\n <div className={[\"sf-object-table sf-expectations\", className].filter(Boolean).join(\" \")} tabIndex={0} role=\"region\" aria-label=\"Data quality rules\">\n <table>\n <thead>\n <tr>\n <th scope=\"col\">Rule</th>\n <th scope=\"col\">Dataset</th>\n <th scope=\"col\">A failing record is</th>\n <th scope=\"col\" className=\"sf-object-number\">\n Failed\n </th>\n <th scope=\"col\">Share failing</th>\n </tr>\n </thead>\n <tbody>\n {sorted.map((item) => (\n <tr key={`${item.dataset}.${item.name}`} data-failing={item.failedRecords > 0 || undefined}>\n <th scope=\"row\">\n {item.name}\n <span className=\"sf-object-column-note sf-object-type\">{item.constraint}</span>\n </th>\n <td>{item.dataset}</td>\n <td>{ACTION_LABEL[item.action]}</td>\n <td className=\"sf-object-number\">\n {full.format(item.failedRecords)} of {full.format(item.passedRecords + item.failedRecords)}\n </td>\n <td>\n <span className=\"sf-meter\" role=\"img\" aria-label={`${(rate(item) * 100).toFixed(1)}% failing`}>\n <span style={{ inlineSize: `${Math.min(100, rate(item) * 100)}%` }} data-bad=\"\" />\n </span>{\" \"}\n {(rate(item) * 100).toFixed(1)}%\n {onOpenFailing && item.failedRecords > 0 && (\n <button type=\"button\" className=\"sf-button sf-expectations-open\" onClick={() => onOpenFailing(item)}>\n See failing rows\n </button>\n )}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\n/** One check over a built dataset and how the latest run did against it. */\nexport interface CheckOutcome {\n name: string;\n /** The check in words: \"order_id never repeats\". */\n description: string;\n /** Whether a failure stops what reads the dataset, or only warns. */\n severity: \"fail\" | \"warn\";\n /** Rows that break it (for a row count, 1 when it is out of bounds). Absent when the dataset has not been built since the check was added. */\n failedRecords?: number;\n /** What the engine reported, in a sentence. */\n summary?: string;\n /** Whether it was added for the dataset's key. */\n fromKey?: boolean;\n /** False when there is no query for the rows that break it, so none is offered. */\n canOpenFailing?: boolean;\n}\n\nexport interface ChecksPanelProps {\n checks: CheckOutcome[];\n /** Called to look at what breaks a check. Nothing runs unless the host runs it. */\n onOpenFailing?(check: CheckOutcome): void;\n className?: string;\n}\n\n/** A dataset's checks, failures first, with what the engine counted. Counts only: no row is read here. */\nexport function ChecksPanel({ checks, onOpenFailing, className }: ChecksPanelProps) {\n if (checks.length === 0) return <p className=\"sf-object-muted\">No checks on this dataset.</p>;\n const order = (c: CheckOutcome) => (c.failedRecords === undefined ? 1 : c.failedRecords > 0 ? (c.severity === \"fail\" ? 0 : 0.5) : 2);\n const sorted = [...checks].sort((a, b) => order(a) - order(b) || a.name.localeCompare(b.name));\n return (\n <div className={[\"sf-object-table sf-checks\", className].filter(Boolean).join(\" \")} tabIndex={0} role=\"region\" aria-label=\"Checks\">\n <table>\n <thead>\n <tr>\n <th scope=\"col\">Check</th>\n <th scope=\"col\">Result</th>\n <th scope=\"col\">On failure</th>\n </tr>\n </thead>\n <tbody>\n {sorted.map((check) => {\n const failed = (check.failedRecords ?? 0) > 0;\n return (\n <tr key={check.name} data-failing={failed || undefined}>\n <th scope=\"row\">\n {check.name}\n <span className=\"sf-object-column-note sf-object-type\">\n {check.description}\n {check.fromKey ? \" (from the key)\" : \"\"}\n </span>\n </th>\n <td>\n <span className=\"sf-check-mark\" data-state={check.failedRecords === undefined ? \"unknown\" : failed ? check.severity : \"pass\"}>\n {check.failedRecords === undefined ? \"Not run yet\" : failed ? (check.severity === \"fail\" ? \"! Failed\" : \"! Warning\") : \"✓ Passed\"}\n </span>\n {check.summary && check.summary !== \"Passed.\" && <span className=\"sf-object-column-note\">{check.summary}</span>}\n {onOpenFailing && failed && check.canOpenFailing !== false && (\n <button type=\"button\" className=\"sf-button sf-expectations-open\" onClick={() => onOpenFailing(check)}>\n See what breaks it\n </button>\n )}\n </td>\n <td>{check.severity === \"fail\" ? \"Stops what reads it\" : \"Warns\"}</td>\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n );\n}\n\n/** One difference between the schema that arrived and the one expected. */\nexport interface SchemaChange {\n column: string;\n change: \"added\" | \"removed\" | \"typeChanged\";\n before?: string;\n after?: string;\n}\n\nconst CHANGE_LABEL = { added: \"New column\", removed: \"Missing column\", typeChanged: \"Type changed\" } as const;\nconst CHANGE_MARK = { added: \"+\", removed: \"−\", typeChanged: \"~\" } as const;\n\nexport interface SchemaDiffProps {\n changes: SchemaChange[];\n /** Records whose unexpected fields were set aside instead of being loaded. */\n rescuedCount?: number;\n /** How the pipeline treats new columns, e.g. \"addNewColumns\", \"rescue\", \"failOnNewColumns\". */\n mode?: string;\n className?: string;\n}\n\n/** How incoming data differs from the table it is loaded into: new, missing and retyped columns. */\nexport function SchemaDiff({ changes, rescuedCount, mode, className }: SchemaDiffProps) {\n return (\n <div className={[\"sf-schema-diff\", className].filter(Boolean).join(\" \")}>\n {(mode || rescuedCount !== undefined) && (\n <p className=\"sf-object-facts\">{[mode ? `New columns: ${mode}` : undefined, rescuedCount !== undefined ? `${full.format(rescuedCount)} records had fields set aside` : undefined].filter(Boolean).join(\" · \")}</p>\n )}\n {changes.length === 0 ? (\n <p className=\"sf-object-muted\">The incoming data matches the table.</p>\n ) : (\n <ul>\n {changes.map((item) => (\n <li key={`${item.change}:${item.column}`} data-change={item.change}>\n <span className=\"sf-schema-diff-mark\" aria-hidden=\"true\">\n {CHANGE_MARK[item.change]}\n </span>\n <strong>{item.column}</strong>\n <span>{CHANGE_LABEL[item.change]}</span>\n <span className=\"sf-object-type\">{item.change === \"typeChanged\" ? `${item.before ?? \"?\"} → ${item.after ?? \"?\"}` : (item.after ?? item.before ?? \"\")}</span>\n </li>\n ))}\n </ul>\n )}\n </div>\n );\n}\n\n/** One progress report from a streaming query. Field names follow Spark's StreamingQueryProgress. */\nexport interface StreamProgress {\n /** ISO 8601. */\n timestamp: string;\n numInputRows: number;\n inputRowsPerSecond: number;\n processedRowsPerSecond: number;\n /** Time the whole micro-batch took (durationMs.triggerExecution). */\n batchDurationMs: number;\n /** Rows held in state (stateOperators.numRowsTotal), when the query keeps state. */\n stateRows?: number;\n}\n\nconst METRICS: { key: keyof Omit<StreamProgress, \"timestamp\">; label: string; unit: string }[] = [\n { key: \"inputRowsPerSecond\", label: \"Input rate\", unit: \"rows/s\" },\n { key: \"processedRowsPerSecond\", label: \"Processing rate\", unit: \"rows/s\" },\n { key: \"numInputRows\", label: \"Rows per batch\", unit: \"rows\" },\n { key: \"batchDurationMs\", label: \"Batch duration\", unit: \"ms\" },\n { key: \"stateRows\", label: \"Rows in state\", unit: \"rows\" },\n];\n\n/** Points for a sparkline over a 100 by 28 box. */\nexport function sparkline(values: number[]): string {\n if (values.length === 0) return \"\";\n const max = Math.max(...values);\n const min = Math.min(...values);\n const span = max - min || 1;\n return values.map((v, i) => `${values.length === 1 ? 50 : (i / (values.length - 1)) * 100},${26 - ((v - min) / span) * 24}`).join(\" \");\n}\n\nexport interface StreamMetricsProps {\n /** Progress reports, oldest first. The numbers are plotted as reported; nothing is derived here. */\n progress: StreamProgress[];\n className?: string;\n}\n\n/**\n * How a streaming query is keeping up: input and processing rates, batch\n * size and duration, and state size, each with its latest value and recent\n * trend. A processing rate below the input rate means it is falling behind.\n */\nexport function StreamMetrics({ progress, className }: StreamMetricsProps) {\n if (progress.length === 0) return <p className=\"sf-object-muted\">No progress has been reported yet.</p>;\n const latest = progress.at(-1)!;\n const behind = latest.processedRowsPerSecond < latest.inputRowsPerSecond;\n return (\n <div className={[\"sf-stream\", className].filter(Boolean).join(\" \")}>\n <p className=\"sf-stream-status\" data-behind={behind || undefined}>\n <span aria-hidden=\"true\">{behind ? \"!\" : \"✓\"}</span> {behind ? \"Falling behind: rows arrive faster than they are processed.\" : \"Keeping up with its input.\"} Last report{\" \"}\n {latest.timestamp.replace(\"T\", \" \").slice(0, 19)}.\n </p>\n <dl className=\"sf-stream-grid\">\n {METRICS.filter((m) => progress.some((p) => p[m.key] !== undefined)).map((metric) => {\n const values = progress.map((p) => p[metric.key]).filter((v): v is number => v !== undefined);\n return (\n <div key={metric.key} className=\"sf-stream-tile\">\n <dt>{metric.label}</dt>\n <dd>\n {count.format(values.at(-1)!)} <span>{metric.unit}</span>\n <svg viewBox=\"0 0 100 28\" preserveAspectRatio=\"none\" role=\"img\" aria-label={`${metric.label} over the last ${values.length} reports, from ${count.format(Math.min(...values))} to ${count.format(Math.max(...values))}`}>\n <polyline points={sparkline(values)} />\n </svg>\n </dd>\n </div>\n );\n })}\n </dl>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Pipelines } from "@surfaces-ui/data";
|
|
2
|
+
import { type Dataset, type Pipeline, type Run } from "@surfaces-ui/proto";
|
|
3
|
+
import { type ReactNode } from "react";
|
|
4
|
+
import type { ContextNote } from "../controls/context.js";
|
|
5
|
+
import { type CheckOutcome, type PipelineEdge, type PipelineNode, type PipelineRun } from "./Pipeline.js";
|
|
6
|
+
/** Makes a Pipelines backend available to the pipeline and ingest components below it. */
|
|
7
|
+
export declare function PipelinesProvider({ pipelines, children }: {
|
|
8
|
+
pipelines: Pipelines;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
/** The Pipelines backend if one is available, for places that must work without it. */
|
|
12
|
+
export declare function useOptionalPipelines(override?: Pipelines): Pipelines | undefined;
|
|
13
|
+
export declare function usePipelines(override?: Pipelines): Pipelines;
|
|
14
|
+
/** The graph a pipeline draws as, with each dataset's state taken from a run when one is given. */
|
|
15
|
+
export declare function pipelineGraph(pipeline: Pipeline, run?: Run): {
|
|
16
|
+
nodes: PipelineNode[];
|
|
17
|
+
edges: PipelineEdge[];
|
|
18
|
+
};
|
|
19
|
+
/** A run in the shape RunHistory draws. */
|
|
20
|
+
export declare function runRow(run: Run): PipelineRun;
|
|
21
|
+
/** A dataset's checks with how a run did against each, for `ChecksPanel`. */
|
|
22
|
+
export declare function checkOutcomes(dataset: Dataset, run?: Run): CheckOutcome[];
|
|
23
|
+
/** What happened to a run a person started here, for the host or the agent. */
|
|
24
|
+
export interface PipelineRunEvent {
|
|
25
|
+
kind: "started" | "finished";
|
|
26
|
+
runId: string;
|
|
27
|
+
state: "running" | "completed" | "failed" | "cancelled";
|
|
28
|
+
/** Datasets built, failed and skipped, when it has finished. */
|
|
29
|
+
built?: number;
|
|
30
|
+
failed?: string[];
|
|
31
|
+
/** Checks that failed, as dataset.check. */
|
|
32
|
+
failedChecks?: string[];
|
|
33
|
+
dryRun?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** A run as the `finished` event and note describe it. */
|
|
36
|
+
export declare function runEvent(run: Run, kind: PipelineRunEvent["kind"]): PipelineRunEvent;
|
|
37
|
+
/** SQL for the records of a dataset that break one rule, to look at them in a grid. */
|
|
38
|
+
export declare function failingRowsSql(dataset: Dataset, constraint: string): string;
|
|
39
|
+
export interface PipelineViewProps {
|
|
40
|
+
pipelineId: string;
|
|
41
|
+
/** Called to look at a dataset's rows, typically by opening a query. */
|
|
42
|
+
onOpenTable?(table: string, sourceId: string): void;
|
|
43
|
+
/** Called with SQL for the records that broke a rule. Nothing runs unless the host runs it. */
|
|
44
|
+
onOpenSql?(sql: string, sourceId: string): void;
|
|
45
|
+
/** How often to ask for progress while a run is going, in ms. Defaults to 1000. */
|
|
46
|
+
pollMs?: number;
|
|
47
|
+
/** Called when a run started here begins and when it ends. */
|
|
48
|
+
onRun?(event: PipelineRunEvent): void;
|
|
49
|
+
/** What a person did here (started, checked, selected a dataset), for the agent's next turn. */
|
|
50
|
+
onContext?(note: ContextNote): void;
|
|
51
|
+
/** Offer a full refresh. Defaults to true; a host whose backend refuses one (an MCP app) passes false. */
|
|
52
|
+
fullRefresh?: boolean;
|
|
53
|
+
pipelines?: Pipelines;
|
|
54
|
+
className?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A pipeline, live: its datasets and how they feed one another, its runs,
|
|
58
|
+
* and for the selected dataset its query and data quality results. A person
|
|
59
|
+
* can start a run, check the pipeline without building anything, rebuild
|
|
60
|
+
* one dataset and what depends on it, or cancel. A full refresh, which
|
|
61
|
+
* clears tables first, asks for confirmation.
|
|
62
|
+
*/
|
|
63
|
+
export declare function PipelineView(props: PipelineViewProps): import("react").JSX.Element;
|