@@ -17,9 +17,15 @@ import { WithStyles, createStyles, withStyles } from '@material-ui/core/styles'
1717import { Zoom } from '@visx/zoom'
1818import { bindActionCreators } from 'redux'
1919import { connect } from 'react-redux'
20- import { fetchLineage , resetLineage , setSelectedNode } from '../../store/actionCreators'
20+ import {
21+ fetchLineage ,
22+ resetLineage ,
23+ setLineageGraphDepth ,
24+ setSelectedNode
25+ } from '../../store/actionCreators'
2126import { generateNodeId } from '../../helpers/nodes'
2227import { localPoint } from '@visx/event'
28+ import DepthConfig from './components/depth-config/DepthConfig'
2329import Edge from './components/edge/Edge'
2430import MqEmpty from '../core/empty/MqEmpty'
2531import MqText from '../core/text/MqText'
@@ -44,6 +50,7 @@ const DOUBLE_CLICK_MAGNIFICATION = 1.1
4450interface StateProps {
4551 lineage : LineageGraph
4652 selectedNode : string
53+ depth : number
4754}
4855
4956interface LineageState {
@@ -96,24 +103,30 @@ export class Lineage extends React.Component<LineageProps, LineageState> {
96103 this . props . fetchLineage (
97104 this . props . match . params . nodeType . toUpperCase ( ) as JobOrDataset ,
98105 this . props . match . params . namespace ,
99- this . props . match . params . nodeName
106+ this . props . match . params . nodeName ,
107+ this . props . depth
100108 )
101109 }
102110 }
103111
104112 componentDidUpdate ( prevProps : Readonly < LineageProps > ) {
105113 if (
106- JSON . stringify ( this . props . lineage ) !== JSON . stringify ( prevProps . lineage ) &&
114+ ( JSON . stringify ( this . props . lineage ) !== JSON . stringify ( prevProps . lineage ) ||
115+ this . props . depth !== prevProps . depth ) &&
107116 this . props . selectedNode
108117 ) {
109118 this . initGraph ( )
110119 this . buildGraphAll ( this . props . lineage . graph )
111120 }
112- if ( this . props . selectedNode !== prevProps . selectedNode ) {
121+ if (
122+ this . props . selectedNode !== prevProps . selectedNode ||
123+ this . props . depth !== prevProps . depth
124+ ) {
113125 this . props . fetchLineage (
114126 this . props . match . params . nodeType . toUpperCase ( ) as JobOrDataset ,
115127 this . props . match . params . namespace ,
116- this . props . match . params . nodeName
128+ this . props . match . params . nodeName ,
129+ this . props . depth
117130 )
118131 this . getEdges ( )
119132 }
@@ -224,6 +237,7 @@ export class Lineage extends React.Component<LineageProps, LineageState> {
224237 </ MqEmpty >
225238 </ Box >
226239 ) }
240+ < DepthConfig depth = { this . props . depth } />
227241 { this . state . graph && (
228242 < ParentSize >
229243 { parent => (
@@ -303,15 +317,17 @@ export class Lineage extends React.Component<LineageProps, LineageState> {
303317
304318const mapStateToProps = ( state : IState ) => ( {
305319 lineage : state . lineage . lineage ,
306- selectedNode : state . lineage . selectedNode
320+ selectedNode : state . lineage . selectedNode ,
321+ depth : state . lineage . depth
307322} )
308323
309324const mapDispatchToProps = ( dispatch : Redux . Dispatch ) =>
310325 bindActionCreators (
311326 {
312327 setSelectedNode : setSelectedNode ,
313328 fetchLineage : fetchLineage ,
314- resetLineage : resetLineage
329+ resetLineage : resetLineage ,
330+ setDepth : setLineageGraphDepth
315331 } ,
316332 dispatch
317333 )
0 commit comments