Open tiagobento opened 1 year ago
The current Documentation relies on an old version (3.0.1) of mustache.js
Basically, the DMN Diagram and this HTML template are passed to the mustache.js engine, which will generate the HTML code based on the template and filled with the DMN Data.
We can rely on the same library and the same template for the react component too. PROS:
CONS:
As an alternative, we can evaluate different libraries, even on different approaches (eg. PDF templating)
A key point of the component is the included screenshots of the Canvas and the BEE in the HTML report.
Stunner - Lienzo offers natively this capability. We need to find an efficient way to create a PNG snapshot of those components in React.
Canvas snapshot management:: The canvas screenshot can be created in the GWT layer only, at this time. This is simply because the new DMN Documentation is totally decoupled from the Canvas: it can't generate the graph from DMN Diagram.
BEE snapshot management:: In this case, we can rely on the new BEE react component. That could be used in two ways:
At this moment, I don't have an idea if and how the two above solutions are achievable.
Libraries
@yesamer I'm +1 for rewriting everything in React. As for rendering the Boxed Expressions directly, I think we should use a different approach. We need to render them in a hidden div, take a screenshot of said div, and use it as an image on the template of the Documentation PDF. WDYT?
Integration with the current Documentation Tab and new BEE has some issue https://issues.redhat.com/browse/KOGITO-9115
Good bye old friend (code...) :wave: :smiling_face_with_tear:
@yesamer are blocked on this? Asking because of https://github.com/kiegroup/kie-issues/issues/388 that should be taken into account during #171 I think,
Alright, so I'm going to repurpose this issue. Having a "documentation tab" baked inside the DMN Editor is not enough for big projects with multiple files. Instead, we should start with a project-scoped DMN documentation, where users can generate the documentation of a specific set of files, thus avoiding duplications when it comes to files that are included in multiple models.
Example:
graph TD;
MyDataTypes-->Decision_1;
MyCommonBKMs-->Decision_1;
MyDataTypes-->Decision_2
MyCommonBKMs-->Decision_2;
If we were to generate documentation for Decision_1
and Decision_2
separately, both would have duplicate information about MyDataTypes
and MyCommonBKMs
, which would make it not optimal for complex proejcts with many decision models.
I think we could add a new capability to KIE Sandbox, which would then expand to a "DMN CLI" or something like that, where users could select a portion of DMNs they want to include in the documentation. The same could be expanded to the KIE DMN VS Code Extended in the future, as VS Code would have similar needs to a potential DMN CLI itself.
The new DMN Editor will therefore most likely not have a "Documentation" tab.
cc @porcelli
~Continuing with the DMN Editor modernization effort, the Documentation tab needs to be rewritten in React. Part of this task is to also remove the old code of the GWT-based Boxed Expression Editor, as the Documentation tab is the last place depending on it.~
NEW DESCRIPTION
This issue was repurposed from simply rewriting the exsiting DMN Editor's Documentation tab in React to a new feature that will allow users to select which DMN files on their project should go on the generated PDF/HTML Documentation.