diff --git a/dashboard/components/DdlGraph.tsx b/dashboard/components/DdlGraph.tsx index aab761f758ed0..2683fd476bc97 100644 --- a/dashboard/components/DdlGraph.tsx +++ b/dashboard/components/DdlGraph.tsx @@ -22,7 +22,8 @@ import { FragmentBoxPosition, Position, generateFragmentEdges, - layoutItem, + generateDdlEdges, + layoutItem, DdlBox, DdlBoxPosition } from "../lib/layout" import { PlanNodeDatum } from "../pages/fragment_graph" import { StreamNode } from "../proto/gen/stream_plan" @@ -42,10 +43,10 @@ const fragmentDistanceX = nodeRadius * 2 const fragmentDistanceY = nodeRadius * 2 export default function DdlGraph({ - fragmentDependency, + ddlDependency, backPressures, }: { - fragmentDependency: FragmentBox[] // This is just the layout info. + ddlDependency: DdlBox[] // This is just the layout info. backPressures?: Map // relation_id -> relation_id: back pressure rate }) { const svgRef = useRef(null) @@ -53,37 +54,37 @@ export default function DdlGraph({ const { isOpen, onOpen, onClose } = useDisclosure() const [currentStreamNode, setCurrentStreamNode] = useState() - const planNodeDependencyDagCallback = useCallback(() => { - const fragmentDependencyDag = cloneDeep(fragmentDependency) + const ddlDependencyDagCallback = useCallback(() => { + const ddlDependencyDag = cloneDeep(ddlDependency) - const layoutFragmentResult = new Map() - const includedFragmentIds = new Set() - for (const fragmentBox of fragmentDependencyDag) { - let fragmentId = fragmentBox.id; + const layoutDdlResult = new Map() + const includedDdlIds = new Set() + for (const ddlBox of ddlDependencyDag) { + let ddlId = ddlBox.id; let width = 100; let height = 100; - layoutFragmentResult.set(fragmentId, { + layoutDdlResult.set(ddlId, { width, height, }) - includedFragmentIds.add(fragmentId) + includedDdlIds.add(ddlId) } - const fragmentLayout = layoutItem( - fragmentDependencyDag.map(({ width: _1, height: _2, id, ...data }) => { + const ddlLayout = layoutItem( + ddlDependencyDag.map(({ width: _1, height: _2, id, ...data }) => { return { width: 100, height: 100, id, ...data } }), fragmentDistanceX, fragmentDistanceY ) - const fragmentLayoutPosition = new Map() - fragmentLayout.forEach(({ id, x, y }: FragmentBoxPosition) => { - fragmentLayoutPosition.set(id, { x, y }) + const ddlLayoutPosition = new Map() + ddlLayout.forEach(({ id, x, y }: DdlBoxPosition) => { + ddlLayoutPosition.set(id, { x, y }) }) - const layoutResult: FragmentLayout[] = [] - for (const [fragmentId, result] of layoutFragmentResult) { - const { x, y } = fragmentLayoutPosition.get(fragmentId)! + const layoutResult: ddlLayout[] = [] + for (const [fragmentId, result] of layoutDdlResult) { + const { x, y } = ddlLayoutPosition.get(fragmentId)! layoutResult.push({ id: fragmentId, x, y, ...result }) } @@ -93,7 +94,7 @@ export default function DdlGraph({ svgHeight = Math.max(svgHeight, y + height + 50) svgWidth = Math.max(svgWidth, x + width) }) - const edges = generateFragmentEdges(fragmentLayout) + const edges = generateDdlEdges(ddlLayout) return { layoutResult, @@ -101,14 +102,14 @@ export default function DdlGraph({ svgHeight, edges, } - }, [fragmentDependency]) + }, [ddlDependency]) const { svgWidth, svgHeight, edges: fragmentEdgeLayout, layoutResult: fragmentLayout, - } = planNodeDependencyDagCallback() + } = ddlDependencyDagCallback() useEffect(() => { if (fragmentLayout) { diff --git a/dashboard/pages/ddl_graph.tsx b/dashboard/pages/ddl_graph.tsx index c68af059c38dd..eb109d8501536 100644 --- a/dashboard/pages/ddl_graph.tsx +++ b/dashboard/pages/ddl_graph.tsx @@ -110,10 +110,10 @@ const SampleDdlDependencyGraph: DdlBox[] = [ ] const SampleDdlBackpressures: Map = new Map([ - ["1-2", 0.1], - ["1-3", 0.2], - ["2-4", 0.3], - ["3-4", 0.4], + ["1_2", 0.1], + ["1_3", 0.2], + ["2_4", 0.3], + ["3_4", 0.4], ]) function buildPlanNodeDependency( @@ -553,10 +553,8 @@ export default function Streaming() { Fragment Graph {planNodeDependencies && fragmentDependency && ( )}