-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add a merge option to copy layouts from an existing workspace #142
Conversation
…ce file to use to copy layouts from
What's your use case for this? |
I am generating a view using autoLayout in the DSL via the CLI. I load the output json into the ui and allow edits. When I update the dsl file I want to retain the modifications to the layout made in the ui |
You don't say which UI you're using, but Structurizr Lite does this for you automatically ... as does the |
Sorry, using the structurizr ui directly in a custom web page |
No problem. I think this deserves a separate command, to avoid confusion ... I've lost count of the number of people who have complained that their PlantUML diagrams are not respecting the layout created by the Structurizr UI! 😂 I've added a
Let me know if this works for your use case. |
I feel your pain 😄 Merge command sounds great - I've built and run the code, it works ok until I put In the PR, I had to nullify the autolayout applied to the view so this following condition would pass and copy over layouts: public void copyLayoutInformationFrom(ViewSet source) {
for (CustomView view : customViews) {
if (view.getAutomaticLayout() == null && view.getMergeFromRemote() == true) { |
Yes, the assumption is that if automatic layout is configured for the view, the diagram viewer should initiate automatic layout when the view is rendered. If you're trying to use a different workflow, I'd probably recommend building your own command line app with this custom logic. You might also look into integrating the structurizr-graphviz library, which will provide a way to trigger automatic layout before saving to a JSON file. |
Ah ok - I am using groozy in the DSL to apply graphviz layout: graphviz = new com.structurizr.graphviz.GraphvizAutomaticLayout();
graphviz.setRankSeparation(300);
graphviz.setNodeSeparation(300);
graphviz.setMargin(400);
graphviz.apply(view) I might have mis-understood, can I drop the |
Yes - |
Ok thanks. If using autoLayout, does the structurizr ui require a call back to the server to run graphviz to get the layout, or does it calculate the layout in the browser? I am running solely client/browser code and it seems I do need to create the layout via the CLI to feed the UI to enable auto layout. If so, it does sound like a different workflow and command line app as you suggest. |
It depends on the value of the implementation property ( |
Got it. Thank you. I'll try out the Dagre layout to see if that suits. |
This worked by setting the following on the view in the DSL file: !script groovy {
view.enableAutomaticLayout();
} If I just added I could then run the following command to auto layout in the browser: structurizr.diagram.runDagre(...) So seems I have options of either using Graphviz and CLI to layout before loading to the UI, or set layout to Dagre and run the layout command once loaded into the UI. The original use case still remains therefore to apply user edits to the layout post auto layout. Thanks for you help |
No description provided.