-
Notifications
You must be signed in to change notification settings - Fork 238
feat: DM inline field name edit COMPASS-9798 #7454
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
5252f4b
to
66ba6cf
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
Implements inline field name editing in the data modeling diagram along with supporting selectors, store wiring, and tests.
- Adds editable flag to schema-derived fields and prevents _id from being renamed
- Wires renameField action through diagram editor components
- Adds new e2e test and selectors for selecting, adding, and renaming fields
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
packages/compass-e2e-tests/tests/data-modeling-tab.test.ts | Adds e2e test for field selection, addition, and inline rename; refactors drawer close logic. |
packages/compass-e2e-tests/helpers/selectors.ts | Introduces new selectors for field name input, add field button, field node, and inline edit input. |
packages/compass-data-modeling/src/utils/nodes-and-edges.ts | Adds editable property to field objects based on isIdField logic. |
packages/compass-data-modeling/src/utils/nodes-and-edges.spec.ts | Updates unit tests to assert editable flag, including non-editable _id. |
packages/compass-data-modeling/src/components/diagram-editor.tsx | Wires renameField handler into diagram content and passes it to node creation logic. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Assigned |
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.
selected: | ||
!!selectedField?.length && | ||
areFieldPathsEqual(fieldPath, selectedField), | ||
editable: !isIdField(fieldPath), |
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.
Are we sure we want to exclude _id
from edits? We obviously can't do that for individual documents, but as a data modeling operation, it kind of seems fine/like something that one would actually want to do
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.
I'm not sure.. would we then need to go into validating the collection and highlighting if it's missing _id because it was renamed? I'd rather wait if we get requests for this. On the other hand, changing the type might be a valid use-case, especially because we create this field automatically for a new collection 🤔 .
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.
At the moment this is in line with the sidebar behaviour (_id
is readonly there too), but I'll bring this to the channel and let's discuss
8cedfde
to
4388560
Compare
Description
Adding inline edit for fields.
https://github.com/user-attachments/assets/f9f12d7d-28be-402d-849c-257b6fe210b7
Also adding e2e for selecting, adding and editing field.
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes