Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidMount() {
/* After rendering, draw the graph */
const workflow = this.props.workflow;
const renderer = new dagreD3.render();
const graph = new Graph().setGraph({});
workflow.tasks.forEach(function (task) {
// Add nodes: rx ry is border radius
graph.setNode(task.name, {label: task.name, rx: 5, ry: 5});
// Add lines between nodes
task.upstream.forEach(function (upstreamTask) {
graph.setEdge(upstreamTask, task.name, {})
})
});
const svg = d3.select("svg");
const g = svg.append("g");
renderer(g, graph);
svg.attr('height', graph.graph().height);
svg.attr('width', graph.graph().width);