File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed
components/dag-visualizer Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,15 @@ export function DAG() {
4949 fitView ( ) ; // Keep an eye on performance here
5050 } , [ width , height ] ) ;
5151
52+ useEffect ( ( ) => {
53+ const timeout = setTimeout ( ( ) => {
54+ fitView ( { duration : 200 } ) ;
55+ } , 100 ) ;
56+ return ( ) => {
57+ clearTimeout ( timeout ) ;
58+ } ;
59+ } , [ data ] ) ;
60+
5261 useLayoutEffect ( ( ) => {
5362 onDagreLayout ( ) ;
5463 } , [ data ?. nodes , data ?. edges , onDagreLayout ] ) ;
@@ -82,7 +91,7 @@ export function DAG() {
8291 onEdgesChange = { onEdgesChange }
8392 fitView
8493 >
85- < DagControls />
94+ < DagControls runId = { runId } />
8695 </ ReactFlow >
8796 ) ;
8897}
Original file line number Diff line number Diff line change @@ -2,11 +2,21 @@ import { Button } from "@zenml-io/react-component-library/components";
22import Plus from "@/assets/icons/plus.svg?react" ;
33import Minus from "@/assets/icons/minus.svg?react" ;
44import Maximize from "@/assets/icons/maximize.svg?react" ;
5+ import Refresh from "@/assets/icons/refresh.svg?react" ;
56import { useReactFlow } from "reactflow" ;
7+ import { usePipelineRun } from "../../data/pipeline-runs/pipeline-run-detail-query" ;
8+ import { usePipelineRunGraph } from "../../data/pipeline-runs/pipeline-run-graph-query" ;
69
7- export function DagControls ( ) {
10+ type Props = {
11+ runId : string ;
12+ } ;
13+
14+ export function DagControls ( { runId } : Props ) {
815 const { fitView, zoomIn, zoomOut } = useReactFlow ( ) ;
916
17+ const run = usePipelineRun ( { runId } ) ;
18+ const graph = usePipelineRunGraph ( { runId } ) ;
19+
1020 return (
1121 < div aria-label = "Dag Controls" className = "absolute left-4 top-4 z-10 flex flex-col gap-1" >
1222 < div className = "divide-y divide-neutral-300 overflow-hidden rounded-md border border-neutral-300" >
@@ -39,6 +49,18 @@ export function DagControls() {
3949 >
4050 < Maximize className = "h-5 w-5 fill-theme-text-primary" />
4151 </ Button >
52+ < Button
53+ className = "h-6 w-6 bg-theme-surface-primary p-0.5"
54+ onClick = { ( ) => {
55+ run . refetch ( ) ;
56+ graph . refetch ( ) ;
57+ } }
58+ emphasis = "subtle"
59+ intent = "secondary"
60+ >
61+ < span className = "sr-only" > Refresh</ span >
62+ < Refresh className = "h-5 w-5 fill-theme-text-primary" />
63+ </ Button >
4264 </ div >
4365 ) ;
4466}
You can’t perform that action at this time.
0 commit comments