fix: make console graph demo usable

This commit is contained in:
lda
2026-07-02 23:14:06 +07:00 Verified
parent 3cdcf6ff3b
commit 86ccbe35cf
9 changed files with 1560 additions and 23 deletions
@@ -85,6 +85,7 @@ describe("WorkflowGraph", () => {
expect(findNodeById(container, "start")).not.toBeNull();
expect(findNodeById(container, "review")).not.toBeNull();
expect(findNodeById(container, "end")).not.toBeNull();
expect(container.querySelectorAll(".react-flow__handle")).toHaveLength(6);
});
it("calls onNodeSelect when node is clicked", () => {
+4 -2
View File
@@ -3,7 +3,8 @@ import {
ReactFlow,
Background,
Controls,
MiniMap,
Handle,
Position,
type Node,
type Edge,
type NodeTypes,
@@ -47,10 +48,12 @@ const CustomNode = ({ data, selected }: { data: WorkflowGraphNodeData; selected:
className={`graph-node graph-node--${data.kind} ${selected ? "graph-node--selected" : ""} ${isActive ? "graph-node--active" : ""}`}
style={{ borderColor: nodeColor(data) }}
>
<Handle type="target" position={Position.Top} />
<div className="graph-node__label">{data.label}</div>
{data.nodeRef && (
<div className="graph-node__ref">{data.nodeRef}</div>
)}
<Handle type="source" position={Position.Bottom} />
</div>
);
};
@@ -113,7 +116,6 @@ export const WorkflowGraph = ({ model, activeNodeId = null, onNodeSelect }: Work
>
<Background />
<Controls />
<MiniMap />
</ReactFlow>
</div>
);