11import * as Redux from 'redux'
22import { ActionBar } from './ActionBar'
33import { Box } from '@mui/system'
4+ import { DEFAULT_MAX_SCALE , Graph , ZoomPanControls } from '../../../libs/graph'
45import { Drawer } from '@mui/material'
5- import { Graph , ZoomPanControls } from '../../../libs/graph'
66import { IState } from '../../store/reducers'
77import { JobOrDataset } from '../../components/lineage/types'
88import { LineageGraph } from '../../types/api'
@@ -41,8 +41,8 @@ const ColumnLevel: React.FC<ColumnLevelProps> = ({
4141
4242 const [ depth , setDepth ] = useState ( Number ( searchParams . get ( 'depth' ) ) || 2 )
4343
44- const [ isCompact , setIsCompact ] = useState ( false )
45- const [ isFull , setIsFull ] = useState ( true )
44+ const [ isCompact , setIsCompact ] = useState ( searchParams . get ( 'isCompact' ) === 'true' )
45+ const [ isFull , setIsFull ] = useState ( searchParams . get ( 'isFull' ) === ' true' )
4646
4747 const graphControls = useRef < ZoomPanControls > ( )
4848
@@ -64,6 +64,13 @@ const ColumnLevel: React.FC<ColumnLevelProps> = ({
6464 graphControls . current ?. fitContent ( )
6565 }
6666
67+ const handleCenterOnNode = ( ) => {
68+ graphControls . current ?. centerOnPositionedNode (
69+ `${ nodeType } :${ namespace } :${ name } ` ,
70+ DEFAULT_MAX_SCALE
71+ )
72+ }
73+
6774 const setGraphControls = useCallbackRef ( ( zoomControls ) => {
6875 graphControls . current = zoomControls
6976 } )
@@ -103,7 +110,11 @@ const ColumnLevel: React.FC<ColumnLevelProps> = ({
103110 < TableLevelDrawer />
104111 </ Box >
105112 </ Drawer >
106- < ZoomControls handleScaleZoom = { handleScaleZoom } handleResetZoom = { handleResetZoom } />
113+ < ZoomControls
114+ handleCenterOnNode = { handleCenterOnNode }
115+ handleScaleZoom = { handleScaleZoom }
116+ handleResetZoom = { handleResetZoom }
117+ />
107118 < ParentSize >
108119 { ( parent ) => (
109120 < Graph < JobOrDataset , TableLevelNodeData >
0 commit comments