-
Notifications
You must be signed in to change notification settings - Fork 246
feat(data-modeling): show warning for invalid relationships COMPASS-9847 #7520
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
Conversation
4063ce3 to
9c9124d
Compare
9c9124d to
1f793de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds validation warnings for invalid relationships in the data modeling feature. When relationships are missing required foreign collections or fields, warning indicators are now displayed both on the diagram nodes and in the relationships section of the drawer.
Key changes:
- Added utility functions to validate relationships and filter relationships by namespace
- Updated diagram nodes and relationship list items to show warning icons for invalid relationships
- Upgraded the
@mongodb-js/diagrammingpackage to version 2.2.1 to support the warning variant
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/compass-data-modeling/src/utils/utils.ts | Added getNamespaceRelationships and isRelationshipInvalid utility functions |
| packages/compass-data-modeling/src/utils/utils.spec.tsx | Added comprehensive tests for the isRelationshipInvalid function |
| packages/compass-data-modeling/src/utils/nodes-and-edges.ts | Modified collectionToDiagramNode to accept relationships and set warning variant for invalid relationships |
| packages/compass-data-modeling/src/components/drawer/relationships-section.tsx | Added warning icon with tooltip for invalid relationships in the drawer |
| packages/compass-data-modeling/src/components/drawer/collection-drawer-content.tsx | Refactored to use getNamespaceRelationships utility function |
| packages/compass-data-modeling/src/components/diagram-editor.tsx | Updated to pass relationships to collectionToDiagramNode |
| packages/compass-components/package.json | Upgraded @mongodb-js/diagramming to version 2.2.1 |
| .github/PULL_REQUEST_TEMPLATE.md | Formatting changes adding blank lines between sections |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/compass-data-modeling/src/components/drawer/relationships-section.tsx
Outdated
Show resolved
Hide resolved
803baf6 to
257a609
Compare
257a609 to
9626bdf
Compare
| <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> | ||
| - [ ] *Backport Needed* | ||
|
|
||
| - [ ] _Backport Needed_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes started to show up when I merged the main in my branch. I think these are due to precommit hook, where prettier reformatted the file.
Anemy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, left one non blocking suggestion
Show warnings if relations are not valid - missing foreign collection/fields.
Preview
Description
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes