Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cumulus 3184 : Dependency d3-dag code integration to d3 graph #1123

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.19.0
16.19.0
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Updated the dashboard to use alpha version `@cumulus/[email protected]` and
`@cumulus/[email protected]` to work with localstack v3.0.0

- **CUMULUS-3184**
- Replaced dagre-d3 with dagre-d3-es to address the d3-color vulnerability
- Upgraded d3 to v7.2.0 to be compatible with dagre-d3-es v7.0.10

## [v12.1.0] - 2023-10-27

### Breaking Changes
Expand Down
4 changes: 2 additions & 2 deletions app/src/js/components/Executions/execution-graph-utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import dagre from 'dagre-d3';
import * as dagreD3 from 'dagre-d3-es';

export const select = (arr, predOrProp) => {
let predicate = predOrProp;
Expand Down Expand Up @@ -28,7 +28,7 @@ export const setParent = (g, child, parent) => {
};

export const draw = (graph) => {
const g = new dagre.graphlib.Graph({ compound: true })
const g = new dagreD3.graphlib.Graph({ compound: true })
.setGraph({})
.setDefaultEdgeLabel(() => ({}));

Expand Down
7 changes: 4 additions & 3 deletions app/src/js/components/Executions/execution-status-graph.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import dagre from 'dagre-d3';
import * as d3 from 'd3';
import * as dagreD3 from 'dagre-d3-es';
import Modal from 'react-bootstrap/Modal';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faExpand, faCompress } from '@fortawesome/free-solid-svg-icons';
Expand All @@ -25,13 +25,14 @@ const ExecutionStatusGraph = ({ executionStatus }) => {
const workflow = JSON.parse(stateMachine.definition);
const events = getExecutionEvents(executionHistory);
const graph = workflowToGraph(workflow);
console.log('graph', graph);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be removed?

addEventsToGraph(events, graph);
g.current = draw(graph);
renderGraph('.visual', g);
}, [executionHistory, stateMachine.definition]);

function renderGraph (svgSelector) {
const render = new dagre.render();
function renderGraph(svgSelector) {
const render = new dagreD3.render();
const svg = d3.select(svgSelector);
render(svg, g.current);
const { height } = d3.select(`${svgSelector} g`).node().getBBox();
Expand Down
Loading