Skip to content

feat(data-modeling): export diagram to json COMPASS-9448 #7046

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 15 commits into
base: main
Choose a base branch
from

Conversation

mabaasit
Copy link
Contributor

@mabaasit mabaasit commented Jun 20, 2025

Preview
Export.to.JSON.mov

Changes in toast

Before After
image 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)

@github-actions github-actions bot added the feat label Jun 20, 2025
@mabaasit mabaasit added the no release notes Fix or feature not for release notes label Jun 20, 2025
@mabaasit mabaasit marked this pull request as ready for review June 20, 2025 10:56
@mabaasit mabaasit requested a review from a team as a code owner June 20, 2025 10:56

it('renders nothing if step is not EDITING', function () {
renderDiagramEditorToolbar({ step: 'ANALYSIS_CANCELED' });
expect(() => screen.getByTestId('diagram-editor-toolbar')).to.throw;
Copy link
Collaborator

Choose a reason for hiding this comment

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

throw needs to be called to assert

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in b65f4c8

Comment on lines 102 to 106
<Radio value="json" aria-label="JSON">
<Icon glyph="CurlyBraces" />
{nbsp}
JSON
</Radio>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't match the designs where the icon is outside of the radio item, not sure if that's a deliberate choice not to follow the designs here. Also the alignments of items inside the label is slightly off, but catches the eye, in the designs everything is middle aligned, not baseline

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I missed it as I was reusing some of the code from poc. I aligned it with the design in 6c41226

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is how it looks now

image

Comment on lines 61 to 63
// TODO: Confirm all collections are selected by default (COMPASS-9309)
// Note: We'll need to change the UI, right now the labels are disconnected from the checkboxes
await browser.clickVisible(Selectors.CreateDataModelConfirmButton);
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can count the checkboxes or check the <number> total collections selected text instead of waiting for this refactor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added in adc19a1

@paula-stacho
Copy link
Contributor

Small detail - the label isn't vertically aligned with the checkbox
Screenshot 2025-06-23 at 13 29 20

if (!exportFormat || !model) {
return;
}
exportToJson(diagramLabel, model);
Copy link
Member

@Anemy Anemy Jun 23, 2025

Choose a reason for hiding this comment

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

Should we try/catch this and show the error to the user? I'm wondering what happens if a user tries to save in a place where they might not have permissions or another error with file system saving that could happen like no space left.

link.click();
setTimeout(() => {
window.URL.revokeObjectURL(url);
link.remove();
Copy link
Member

Choose a reason for hiding this comment

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

Should we be showing a toast here? Or is that something that's planned in future work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat no release notes Fix or feature not for release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants