Skip to content

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Sep 9, 2025

COMPASS-9742

Adds some field editing e2e testing as well. Left two comments/questions for reviewers.

Screenshot 2025-09-11 at 9 28 40 AM
add.field.to.object.mp4

@github-actions github-actions bot added the feat label Sep 9, 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 Sep 9, 2025
alignItems: 'center',
});

const iconButtonHoverStyles = css({
Copy link
Member Author

Choose a reason for hiding this comment

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

Should we add a use-icon-button-hover-ring hook in compass-components?

export const getBaseFieldsFromSchema = ({
jsonSchema,
}: {
jsonSchema: MongoDBJSONSchema;
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't love two functions that do pretty much the same thing, but it seemed better than doing something like:

export const getFieldsFromSchema = ({
  jsonSchema,
  renderOptions,
}: {
  jsonSchema: MongoDBJSONSchema;
  renderOptions?: {
    highlightedFields: FieldPath[];
    selectedField?: FieldPath;
    onClickAddNestedField: (parentFieldPath: string[]) => void;
  };
}): NodeProps['fields'] => {

@Anemy Anemy marked this pull request as ready for review September 11, 2025 13:29
@Anemy Anemy requested a review from a team as a code owner September 11, 2025 13:29
@Anemy Anemy requested review from nbbeeken and Copilot September 11, 2025 13:29
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 functionality to allow users to add fields to object types directly from the diagram view in the data modeling feature. The implementation includes both the UI components to display "add field" buttons on object fields and the corresponding E2E tests to validate the new functionality.

Key changes:

  • Added "add field" button to object field types in the diagram
  • Created new E2E test helper functions for diagram interaction
  • Extended field editing functionality to support nested field creation

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/compass-e2e-tests/tests/data-modeling-tab.test.ts Added comprehensive E2E test for field editing and new drag helper function
packages/compass-e2e-tests/helpers/selectors.ts Added selectors for new add field buttons and field type combobox
packages/compass-e2e-tests/helpers/commands/set-multi-combo-box-value.ts New helper command for setting multiple combobox values
packages/compass-data-modeling/src/utils/schema.ts Enhanced field name generation to support nested object paths
packages/compass-data-modeling/src/utils/nodes-and-edges.tsx Added object field type component and nested field functionality
packages/compass-data-modeling/src/components/diagram/object-field-type.tsx New component rendering object type with add field button
packages/compass-data-modeling/src/store/diagram.ts Added action handler for creating nested fields
packages/compass-data-modeling/src/components/diagram-editor.tsx Connected nested field creation to the diagram editor

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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.

1 participant