Skip to content

Conversation

paula-stacho
Copy link
Collaborator

@paula-stacho paula-stacho commented Oct 14, 2025

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

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@github-actions github-actions bot added the feat label Oct 14, 2025
@paula-stacho paula-stacho added the feature flagged PRs labeled with this label will not be included in the release notes of the next release label Oct 14, 2025
@paula-stacho paula-stacho marked this pull request as ready for review October 16, 2025 15:57
@paula-stacho paula-stacho requested a review from a team as a code owner October 16, 2025 15:57
Copy link
Contributor

@Copilot Copilot AI left a 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.

@codeowners-service-app
Copy link

Assigned kmruiz for team compass-developers because gribnoysup is out of office.

Copy link
Collaborator

@gribnoysup gribnoysup left a comment

Choose a reason for hiding this comment

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

I guess it's more of a diagrammig package issue, but seems like input styles are not fully disabled and the outser focus ring is slightly visible still:

image

Otherwise LGTM

selected:
!!selectedField?.length &&
areFieldPathsEqual(fieldPath, selectedField),
editable: !isIdField(fieldPath),
Copy link
Collaborator

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

Copy link
Collaborator Author

@paula-stacho paula-stacho Oct 22, 2025

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 🤔 .

Copy link
Collaborator Author

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

@paula-stacho paula-stacho merged commit 0b14e93 into main Oct 23, 2025
104 of 108 checks passed
@paula-stacho paula-stacho deleted the COMPASS-9798 branch October 23, 2025 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat feature flagged PRs labeled with this label will not be included in the release notes of the next release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants