-import * as React from 'react';
-import { WorkflowResource } from "~/models/workflow";
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import React from 'react';
+import { WorkflowResource } from "models/workflow";
import { WorkflowFactory } from "cwlts/models";
import * as yaml from 'js-yaml';
-import "~/lib/cwl-svg/assets/styles/themes/rabix-dark/theme.css";
-import "~/lib/cwl-svg/plugins/port-drag/theme.dark.css";
-import "~/lib/cwl-svg/plugins/selection/theme.dark.css";
+import "lib/cwl-svg/assets/styles/themes/rabix-dark/theme.css";
+import "lib/cwl-svg/plugins/port-drag/theme.dark.css";
+import "lib/cwl-svg/plugins/selection/theme.dark.css";
import {
SelectionPlugin,
SVGArrangePlugin,
SVGNodeMovePlugin,
SVGPortDragPlugin, Workflow,
ZoomPlugin
-} from "~/lib/cwl-svg";
+} from "lib/cwl-svg";
interface WorkflowGraphProps {
workflow: WorkflowResource;
export class WorkflowGraph extends React.Component<WorkflowGraphProps, {}> {
private svgRoot: React.RefObject<SVGSVGElement> = React.createRef();
- componentDidMount(): void {
+ setGraph() {
const graphs = yaml.safeLoad(this.props.workflow.definition, { json: true });
let workflowGraph = graphs;
new SVGArrangePlugin(),
new SVGEdgeHoverPlugin(),
new SVGNodeMovePlugin({
- movementSpeed: 10
+ movementSpeed: 2
}),
new SVGPortDragPlugin(),
new SelectionPlugin(),
workflow.draw();
}
+ componentDidMount() {
+ this.setGraph();
+ }
+
+ componentDidUpdate() {
+ this.setGraph();
+ }
+
render() {
return <svg
ref={this.svgRoot}