@@ -12,7 +12,6 @@ import {
12
12
useWorkflowNamesAndVersions ,
13
13
} from "../../data/workflow" ;
14
14
import WorkflowDAG from "../../components/diagram/WorkflowDAG" ;
15
- import WorkflowGraph from "../../components/diagram/WorkflowGraph" ;
16
15
import ResetConfirmationDialog from "./ResetConfirmationDialog" ;
17
16
import {
18
17
configureMonaco ,
@@ -23,6 +22,7 @@ import SaveWorkflowDialog from "./SaveWorkflowDialog";
23
22
import update from "immutability-helper" ;
24
23
import { usePushHistory } from "../../components/NavLink" ;
25
24
import { timestampRenderer } from "../../utils/helpers" ;
25
+ import { WorkflowVisualizer } from "orkes-workflow-visualizer" ;
26
26
27
27
import {
28
28
KeyboardArrowLeftRounded ,
@@ -67,8 +67,8 @@ const useStyles = makeStyles({
67
67
gap : 8 ,
68
68
} ,
69
69
editorLineDecorator : {
70
- backgroundColor : "rgb(45, 45, 45, 0.1)"
71
- }
70
+ backgroundColor : "rgb(45, 45, 45, 0.1)" ,
71
+ } ,
72
72
} ) ;
73
73
74
74
const actions = {
@@ -240,21 +240,26 @@ export default function Workflow() {
240
240
} ;
241
241
242
242
const handleWorkflowNodeClick = ( node ) => {
243
- let editor = editorRef . current . getModel ( )
244
- let searchResult = editor . findMatches ( `"taskReferenceName": "${ node . ref } "` )
245
- if ( searchResult . length ) {
246
- editorRef . current . revealLineInCenter ( searchResult [ 0 ] ?. range ?. startLineNumber , 0 ) ;
247
- setDecorations ( editorRef . current . deltaDecorations ( decorations , [
248
- {
249
- range : searchResult [ 0 ] ?. range ,
250
- options : {
251
- isWholeLine : true ,
252
- inlineClassName : classes . editorLineDecorator
253
- }
254
- }
255
- ] ) )
243
+ let editor = editorRef . current . getModel ( ) ;
244
+ let searchResult = editor . findMatches ( `"taskReferenceName": "${ node . ref } "` ) ;
245
+ if ( searchResult . length ) {
246
+ editorRef . current . revealLineInCenter (
247
+ searchResult [ 0 ] ?. range ?. startLineNumber ,
248
+ 0
249
+ ) ;
250
+ setDecorations (
251
+ editorRef . current . deltaDecorations ( decorations , [
252
+ {
253
+ range : searchResult [ 0 ] ?. range ,
254
+ options : {
255
+ isWholeLine : true ,
256
+ inlineClassName : classes . editorLineDecorator ,
257
+ } ,
258
+ } ,
259
+ ] )
260
+ ) ;
256
261
}
257
- }
262
+ } ;
258
263
259
264
return (
260
265
< >
@@ -369,8 +374,17 @@ export default function Workflow() {
369
374
className = { classes . resizer }
370
375
onMouseDown = { ( e ) => handleMouseDown ( e ) }
371
376
/>
372
- < div className = { classes . workflowGraph } >
373
- { dag && < WorkflowGraph dag = { dag } onClick = { handleWorkflowNodeClick } /> }
377
+ < div className = { classes . workflowGraph } style = { { overflow : "scroll" } } >
378
+ { dag && dag ?. workflowDef && (
379
+ < WorkflowVisualizer
380
+ maxHeightOverride
381
+ pannable
382
+ zoomable
383
+ zoom = { 0.7 }
384
+ data = { dag ?. workflowDef }
385
+ onClick = { ( e , data ) => handleWorkflowNodeClick ( { ref : data ?. id } ) }
386
+ />
387
+ ) }
374
388
</ div >
375
389
</ div >
376
390
</ >
0 commit comments