1 import * as React from 'react';
2 import { WorkflowResource } from "~/models/workflow";
3 import { WorkflowFactory } from "cwlts/models";
4 import * as yaml from 'js-yaml';
5 import "~/lib/cwl-svg/assets/styles/themes/rabix-dark/theme.css";
6 import "~/lib/cwl-svg/plugins/port-drag/theme.dark.css";
7 import "~/lib/cwl-svg/plugins/selection/theme.dark.css";
13 SVGPortDragPlugin, Workflow,
15 } from "~/lib/cwl-svg";
17 interface WorkflowGraphProps {
18 workflow: WorkflowResource;
20 export class WorkflowGraph extends React.Component<WorkflowGraphProps, {}> {
21 private svgRoot: React.RefObject<SVGSVGElement> = React.createRef();
24 const graphs = yaml.safeLoad(this.props.workflow.definition, { json: true });
26 let workflowGraph = graphs;
28 workflowGraph = graphs.$graph.find((g: any) => g.class === 'Workflow');
31 const model = WorkflowFactory.from(workflowGraph);
33 const workflow = new Workflow({
35 svgRoot: this.svgRoot.current!,
37 new SVGArrangePlugin(),
38 new SVGEdgeHoverPlugin(),
39 new SVGNodeMovePlugin({
42 new SVGPortDragPlugin(),
43 new SelectionPlugin(),
54 componentDidUpdate() {
61 className="cwl-workflow"