bpmn-io / dmn-migrate

Migrate your DMN diagrams to the latest DMN version
https://www.npmjs.com/package/@bpmn-io/dmn-migrate
MIT License
4 stars 2 forks source link

Add option to auto-generate DI #39

Open barmac opened 2 months ago

barmac commented 2 months ago

Is your feature request related to a problem? Please describe.

When I migrate a DMN file with this tool, I still cannot use it effectively in the Modeler as no DI is added. The DiGenerator in dmn-js handles decisions only, and it is not run outside of the DRD editor.

Describe the solution you'd like

Add an option to generate DI in this tool to ensure smooth migration of the pre-DMN 1.2 diagrams.

Describe alternatives you've considered

Have a separate tool for DI generation. The main argument for this is that dmn-migrate will stay focussed as no-DI diagrams are still valid.

Additional context

Related to https://github.com/camunda/web-modeler/issues/1108

barmac commented 1 month ago

I am now researching how the auto-layout could be done. In the process, I've found a blog post by a KIE developer about their layout implementation. It uses Sugiyama algorithm which I think is a promising solution for us too: https://blog.kie.org/2020/02/automatic-layout.html Other sources:

barmac commented 1 month ago

I think the autolayout could be implemented as a library separate from dmn-migrate. We could potentially use that in dmn-js too.

barmac commented 1 month ago

I searched for existing solutions, and while elkjs looks powerful, its API seems to be complex enough that an in-house project may serve us better. Note that we need to implement breaking the cycles (either by order reversal or connection removal), and this needs to be reflected in DMN.

barmac commented 1 month ago

Given the knowledge I gathered, I think autolayout is outside of the scope of this issue. The generated DI does not need to look perfect as the user can easily relocate the elements after the initial import.

For a good layout, we'd need to remove the cycles, but that means we alternate the semantic part. However, diagrams with cycles cannot be evaluated on the engine anyway. So I wouldn't worry that much about this for an autolayout tool. Still, good autolayout is not a requirement of this issue.

TLDR: Autolayout is outside of scope.