-
Notifications
You must be signed in to change notification settings - Fork 229
feat(data-modeling): download diagram COMPASS-9545 #7116
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
Conversation
There was a problem hiding this 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 a download feature for data models in Compass, allowing users to save diagrams as .compass
files containing the diagram name and edit history. The implementation includes both the core functionality and comprehensive end-to-end testing.
- Adds a download button to the diagram editor toolbar that exports the current diagram state
- Implements file download functionality that saves diagrams with their edit history as JSON
- Enhances the download status notification system with better toast management
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
packages/compass/src/app/application.tsx | Improves download completion toast handling with proper cleanup |
packages/compass-data-modeling/src/store/diagram.ts | Adds downloadDiagram action to export current diagram edits |
packages/compass-data-modeling/src/services/export-diagram.tsx | Implements exportEdits function for downloading diagram data as JSON |
packages/compass-data-modeling/src/components/diagram-editor-toolbar.tsx | Adds download button to the editor toolbar |
packages/compass-data-modeling/src/components/diagram-editor-toolbar.spec.tsx | Adds unit tests for the new download button functionality |
packages/compass-data-modeling/src/store/export-diagram.ts | Refactors model selection to only execute when needed for JSON export |
packages/compass-e2e-tests/tests/data-modeling-tab.test.ts | Adds comprehensive e2e test for download functionality and refactors node movement logic |
packages/compass-e2e-tests/helpers/selectors.ts | Adds selector for the new download button |
packages/compass-e2e-tests/helpers/downloads.ts | Improves error messaging for file download timeouts |
@@ -63,12 +64,21 @@ describe('DiagramEditorToolbar', function () { | |||
}); | |||
}); | |||
|
|||
it('renders export buttona and calls onExportClick', function () { | |||
it('renders export button and calls onExportClick', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed typo in test description - changed 'export buttona' to 'export button'.
Copilot uses AI. Check for mistakes.
const json = { name: fileName, edits }; | ||
const blob = new Blob([JSON.stringify(json, null, 2)], { | ||
type: 'application/json', | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we discussed adding a version field here and maybe it's a good idea to completely obscure the content with something simple like base64-ing the the whole string? In the spirit of making it not easily parseable by users at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also maybe type: 'DataModel'
in case we want to use .compass extension for some other saved items in compass and would want to differentiate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch - yeah, will do that. i forgot adding fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in 1cfac05
Added an option to download a data-model. It saves file as
diagram-name.compass
Preview
Download.Diagram.mov
Description
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes