Skip to content

feat(data-modeling): add rename collection to side panel COMPASS-9658 #7174

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Aug 7, 2025

COMPASS-9658

Adding e2e tests for this in the next pr for this ticket that has remove collection.

rename.collection.mp4

Note that the vid has the old, revert on onfocus when there's an invalid value. Now we don't revert the text input value. https://docs.google.com/document/d/15Dn5FB3POEj9sYQrYIUajZySqFzlPfpcgjkPhzFqSFg/edit?disco=AAABnqG-O7o

@github-actions github-actions bot added the feat label Aug 7, 2025
@Anemy Anemy added the feature flagged PRs labeled with this label will not be included in the release notes of the next release label Aug 7, 2025
@Anemy Anemy marked this pull request as ready for review August 8, 2025 17:40
@Copilot Copilot AI review requested due to automatic review settings August 8, 2025 17:40
@Anemy Anemy requested a review from a team as a code owner August 8, 2025 17:40
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

This PR adds the ability to rename collections directly from the side panel in the data modeling workspace. The implementation includes validation to prevent empty names and duplicate collection names, along with proper state management to update selections and relationships when a collection is renamed.

Key changes:

  • Added RenameCollection edit type with validation and state handling
  • Implemented collection name editing UI with real-time validation in the side panel
  • Updated relationship references when collections are renamed

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/compass-data-modeling/src/store/diagram.ts Adds RenameCollection action, reducer logic, and selection state management
packages/compass-data-modeling/src/services/data-model-storage.ts Defines RenameCollection schema validation
packages/compass-data-modeling/src/components/drawer/diagram-editor-side-panel.spec.tsx Updates existing tests and adds new test coverage for rename functionality
packages/compass-data-modeling/src/components/drawer/collection-drawer-content.tsx Implements editable collection name input with validation


const isDuplicate = namespacesWithoutCurrent.some(
(ns) =>
ns === `${toNS(namespace).database}.${collectionName}` ||
Copy link
Preview

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

The duplicate check logic is redundant - checking both trimmed and untrimmed versions when the second condition will always include the first. Consider simplifying to only check the trimmed version.

Suggested change
ns === `${toNS(namespace).database}.${collectionName}` ||

Copilot uses AI. Check for mistakes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean, obviously Copilot's suggestion behaves differently from the current logic, but I think you could actually condense this into a single condition if you want to, e.g.

      ns.trim() === `${toNS(namespace).database}.${collectionName.trim()}`.trim()


const isDuplicate = namespacesWithoutCurrent.some(
(ns) =>
ns === `${toNS(namespace).database}.${collectionName}` ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean, obviously Copilot's suggestion behaves differently from the current logic, but I think you could actually condense this into a single condition if you want to, e.g.

      ns.trim() === `${toNS(namespace).database}.${collectionName.trim()}`.trim()

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