Skip to content

Conversation

Kelsey-Ethyca
Copy link
Contributor

@Kelsey-Ethyca Kelsey-Ethyca commented Jul 24, 2025

Closes ENG-159

Screen.Recording.2025-07-18.at.4.52.15.PM.mov

Description Of Changes

This PR completely refactors the datamap visualization from Cytoscape.js to ReactFlow + Dagre layout engine. This migration provides better React integration, improved performance, and more maintainable code architecture. The new implementation includes enhanced accessibility features, proper CSS modules, and a more responsive user interface.

Key architectural changes include replacing the imperative Cytoscape API with declarative ReactFlow components, implementing automatic layout using Dagre for connected components and grid layout for isolated nodes, and moving from inline styles to CSS modules with proper hover/focus states.

Code Changes

  • Core Migration:

    • Replaced CytoscapeGraph component with new DatamapGraph using ReactFlow
    • Added new dependencies: @dagrejs/dagre v1.1.4 and @types/dagre v0.7.52
    • Removed all Cytoscape.js related code and dependencies
  • New Components:

    • Added DatamapSystemNode.tsx - Custom ReactFlow node component for system visualization
    • Added DatamapGraph.tsx - Main graph visualization component with ReactFlow integration
    • Created useDatamapGraph custom hook for data transformation and layout logic
    • Added getLayoutedElements utility function for Dagre positioning
  • Context & State Management:

    • Removed DatamapGraphContext and related context providers
    • Removed DatamapGraphStore component wrapper
    • Simplified state management by leveraging ReactFlow's built-in capabilities
  • Import Path Updates:

    • Updated import paths across multiple components for consistency
    • Fixed relative imports in DataFlowAccordionForm.tsx, CustomFieldModal.tsx, and other affected files
    • Updated icon imports (e.g., TrashCanSolidIcon) to use correct paths
  • Testing Updates:

    • Updated Cypress tests to use "reactflow-graph" selector instead of "cytoscape-graph"
    • Updated test expectations in datamap.cy.ts and routes.cy.ts
  • UI/UX Improvements:

    • Removed system count display from SettingsBar component
    • Enhanced node styling with proper hover, focus, and selection states
    • Improved accessibility with keyboard navigation support

Steps to Confirm

  1. Basic Functionality:

    • Navigate to the Datamap page and verify the graph renders correctly
    • Confirm that system nodes are displayed with proper styling
    • Test node selection and highlighting functionality
  2. Layout & Interaction:

    • Verify that connected systems use Dagre layout and isolated systems use grid layout
    • Test graph panning, zooming, and viewport centering
    • Confirm that node connections (edges) are displayed correctly
  3. Accessibility:

    • Test keyboard navigation through system nodes
    • Verify focus indicators are visible and properly styled
    • Confirm hover states work as expected
  4. Performance:

    • Load datamap with various dataset sizes to ensure smooth rendering
    • Test interaction responsiveness compared to previous Cytoscape implementation
  5. Integration:

    • Verify that datamap drawer functionality still works correctly
    • Test system selection and related UI updates
    • Confirm no console errors or warnings appear

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Add a db-migration This indicates that a change includes a database migration label to the entry if your change includes a DB migration
    • Add a high-risk This issue suggests changes that have a high-probability of breaking existing code label to the entry if your change includes a high-risk change (i.e. potential for performance impact or unexpected regression) that should be flagged
    • Updates unreleased work already in Changelog, no new entry necessary
  • Followup issues:
    • Followup issues created
    • No followup issues
  • Database migrations:
    • Ensure that your downrev is up to date with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!
    • No migrations
  • Documentation:
    • Documentation complete, PR opened in fidesdocs
    • Documentation issue created in fidesdocs
    • If there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
    • No documentation updates required

Kelsey-Ethyca and others added 23 commits July 24, 2025 10:15
plus remove extra spacing
Co-authored-by: Jason Gill <jason.gill@ethyca.com>
Co-authored-by: Jason Gill <jason.gill@ethyca.com>
Co-authored-by: Jason Gill <jason.gill@ethyca.com>
Co-authored-by: Jason Gill <jason.gill@ethyca.com>
Co-authored-by: Jason Gill <jason.gill@ethyca.com>
Co-authored-by: Jason Gill <jason.gill@ethyca.com>
- Move useDatamapGraph hook to hooks/useDatamapGraph.ts
- Improve code organization and reusability
- Keep DatamapGraph.tsx focused on component logic
- Clean up unused imports
Copy link

vercel bot commented Jul 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fides-plus-nightly ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 30, 2025 0:34am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
fides-privacy-center ⬜️ Ignored (Inspect) Jul 30, 2025 0:34am

Copy link
Contributor

@gilluminate gilluminate left a comment

Choose a reason for hiding this comment

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

Looks great! Excited for this change. I'll help test in RC

@Kelsey-Ethyca Kelsey-Ethyca merged commit 70834d3 into main Jul 30, 2025
20 checks passed
@Kelsey-Ethyca Kelsey-Ethyca deleted the KT-DM-RF-clean branch July 30, 2025 00:52
Copy link

cypress bot commented Jul 30, 2025

fides    Run #13178

Run Properties:  status check passed Passed #13178  •  git commit 70834d3b28: Update datamap to use react flow (#6381)
Project fides
Branch Review main
Run status status check passed Passed #13178
Run duration 00m 53s
Commit git commit 70834d3b28: Update datamap to use react flow (#6381)
Committer Kelsey Thomas
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 5
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants