Skip to content

Conversation

@mabaasit
Copy link
Collaborator

In this PR added telemetry for importing diagram and aligned export diagram and toolbar design.

Preview

Toolbar

image

Modal

image

Description

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)

Copilot AI review requested due to automatic review settings July 24, 2025 09:58
@mabaasit mabaasit requested a review from a team as a code owner July 24, 2025 09:58
@github-actions github-actions bot added the feat label Jul 24, 2025
@mabaasit mabaasit added feature flagged PRs labeled with this label will not be included in the release notes of the next release no release notes Fix or feature not for release notes labels Jul 24, 2025
Copy link
Contributor

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 telemetry tracking for diagram imports and redesigns the export modal and toolbar in the data modeling feature. The changes consolidate the previous separate download and export functionality into a unified export flow with multiple format options.

  • Adds telemetry event tracking when users import diagrams from files
  • Redesigns the export modal to include three format options (Diagram File, PNG, JSON) with descriptions
  • Updates the toolbar design with improved styling and removes the separate download button

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/compass-telemetry/src/telemetry-events.ts Adds new telemetry event type for diagram imports and extends export format options
packages/compass-data-modeling/src/store/diagram.ts Integrates telemetry tracking in the file import workflow
packages/compass-data-modeling/src/store/export-diagram.ts Adds support for 'diagram' export format and removes duplicate download logic
packages/compass-data-modeling/src/components/export-diagram-modal.tsx Redesigns modal UI with three export options and descriptive text
packages/compass-data-modeling/src/components/diagram-editor-toolbar.tsx Redesigns toolbar with new styling and removes download button
packages/compass-components/src/components/icons/png-icon.tsx Adds new PNG icon component with dark mode support
packages/compass-e2e-tests/tests/data-modeling-tab.test.ts Updates test to use new export modal workflow
packages/compass-e2e-tests/helpers/selectors.ts Updates selectors to reflect UI changes
Comments suppressed due to low confidence (2)

packages/compass-data-modeling/src/components/diagram-editor-toolbar.tsx:22

  • The function name 'getColorWithOpactity' contains a spelling error and should be renamed to 'getColorWithOpacity' for clarity and correctness.
function getColorWithOpactity(color: string, opacity: number) {

packages/compass-data-modeling/src/store/export-diagram.ts:136

  • [nitpick] The error message could be more helpful by listing the supported formats: 'Unsupported export format: ${exportFormat}. Supported formats are: png, json, diagram'.
        throw new Error(`Unsupported export format: ${exportFormat}`);

Comment on lines 17 to 30
/**
* @param color 6-digit hex color code
* @param opacity a number between 0 and 1 representing the opacity
* @returns 8-digit hex color code with the last two digits representing the opacity
*/
function getColorWithOpacity(color: string, opacity: number) {
if (opacity < 0 || opacity > 1) {
throw new Error('Opacity must be between 0 and 1');
}
const alpha = Math.round(opacity * 255)
.toString(16)
.padStart(2, '0');
return `#${color.replace('#', '')}${alpha}`;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We have polished in compass components that has methods for that, just for consistency probably better to re-export needed methods from the package?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added in 5b64696. polished seems nice lib!

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.

One comment for using library that we already depend on, but otherwise looks nice!

aria-label="Diagram File"
onClick={() => onSelectFormat('diagram')}
size="small"
description="Importable into Compass so teammates can collaborate."
Copy link
Collaborator

Choose a reason for hiding this comment

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

That's a leafygreen thing, but this description not being clickable is such a weird design decision 😬

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

agreed, i was thinking of keeping it outside of the radio component for this purposes, but to keep things cleaner, choose this way :)

@mabaasit mabaasit merged commit 6860c4c into main Jul 24, 2025
58 checks passed
@mabaasit mabaasit deleted the open-save-cleanup branch July 24, 2025 15:25
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 no release notes Fix or feature not for release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants