Export diagram from model to mermaid code#174
Conversation
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
✅ Deploy Preview for swf-editor ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds Mermaid export capabilities to the diagram editor, exposing “copy” and “download” actions from the SidePanel and providing a core utility to generate Mermaid code.
Changes:
- Add
exportToMermaid+ clipboard/file download helpers insrc/core - Expose “Copy Mermaid Code” and “Download as Mermaid File” buttons in
SidePanel - Add i18n strings and tests for both core export and SidePanel rendering states
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/serverless-workflow-diagram-editor/tests/side-panel/SidePanel.test.tsx | Adds UI-state tests for Mermaid export buttons visibility. |
| packages/serverless-workflow-diagram-editor/tests/core/mermaidExport.test.ts | Adds a unit test for Mermaid conversion output shape. |
| packages/serverless-workflow-diagram-editor/src/side-panel/SidePanel.tsx | Adds export buttons + handlers wired to new Mermaid export helpers. |
| packages/serverless-workflow-diagram-editor/src/i18n/locales/en.ts | Adds English strings for Mermaid export UI. |
| packages/serverless-workflow-diagram-editor/src/core/mermaidExport.ts | Introduces Mermaid export, clipboard copy, and download helpers. |
| packages/serverless-workflow-diagram-editor/src/core/index.ts | Re-exports the new Mermaid export module. |
| .changeset/mermaid-export.md | Declares a minor release for the new functionality. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
fantonangeli
left a comment
There was a problem hiding this comment.
@cheryl7114 I only added one comment in addition to other's comments.
Can you please also add the issue link in the description?
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Hi @handreyrc these warnings are from component tests auto-generated by Storybook's test addon ( But I do acknowledge it makes the build look really cluttered. I could add a config to suppress warnings of this type if needed? |
I'd suggest investigating how to wrap it into act(...) as the warning suggests. IMO, suppressing warnings is always the last case scenario because It masks the actual issue even if it is not breaking anything at the moment. WDYT? |
@handreyrc The tests are auto-generated at runtime by @storybook/addon-vitest, so there's no actual test code we can modify. The options I found for this situation are:
export const AuthenticationOAuth2: Story = {
...createWorkflowStory(workflows.authenticationOAuth2),
play: async ({ canvasElement }) => {
await waitFor(() => {
// Wait for React Flow to finish rendering
expect(canvasElement.querySelector('.react-flow')).toBeInTheDocument();
});
},
}; // generated by Bob
parameters: {
test: {
// Disable act warnings for auto-generated tests
dangerouslyIgnoreUnhandledErrors: true,
},
}
Option 2 and 3 would be simpler, but I wouldn't mind implementing option 1 if its necessary. Please let me hear you opinions! :) |
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
|
@handreyrc I'll put in a separate PR for the storybook warning fixes after we conclude our discussion |
|
@ricardozanini this looks ready to merge. Thank you! |

Closes #150
Changes Made
Added two buttons to export diagram model (JSON/YAML) to Mermaid: