1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
6 import { WorkflowResource } from "models/workflow";
7 import { WorkflowFactory } from "cwlts/models";
8 import * as yaml from 'js-yaml';
9 import "lib/cwl-svg/assets/styles/themes/rabix-dark/theme.css";
10 import "lib/cwl-svg/plugins/port-drag/theme.dark.css";
11 import "lib/cwl-svg/plugins/selection/theme.dark.css";
17 SVGPortDragPlugin, Workflow,
21 interface WorkflowGraphProps {
22 workflow: WorkflowResource;
24 export class WorkflowGraph extends React.Component<WorkflowGraphProps, {}> {
25 private svgRoot: React.RefObject<SVGSVGElement> = React.createRef();
28 const graphs = yaml.safeLoad(this.props.workflow.definition, { json: true });
30 let workflowGraph = graphs;
32 workflowGraph = graphs.$graph.find((g: any) => g.class === 'Workflow');
35 const model = WorkflowFactory.from(workflowGraph);
37 const workflow = new Workflow({
39 svgRoot: this.svgRoot.current!,
41 new SVGArrangePlugin(),
42 new SVGEdgeHoverPlugin(),
43 new SVGNodeMovePlugin({
46 new SVGPortDragPlugin(),
47 new SelectionPlugin(),
58 componentDidUpdate() {
65 className="cwl-workflow"