Visualizations
Workflows4s provides several visualization modes for representing workflows: BPMN, Mermaid Flowchart, and Debug Renderer. Each mode has its strengths and use cases. Most options are considered experimental, and they are subject to change.
Visualization Modes Overview
Mode | Description | Good For | Limitations |
---|---|---|---|
BPMN | Leverages the Business Process Model and Notation (BPMN) standard, widely recognized in workflow and process
modeling domains.
Requires the |
|
|
Mermaid Flowchart | Renders workflows as Mermaid flowcharts using built-in support in |
|
|
Debug Renderer | Renders workflows as a hierarchical text representation using built-in support
in |
|
|
Usage Examples
BPMN
"org.business4s" %% "workflows4s-bpmn" % "0.1.1"
val wio: WIO[?, ?, ?, ?] = PullRequestWorkflow.workflow
val bpmnModel = BpmnRenderer.renderWorkflow(wio.toProgress.toModel, "process")
val bpmnXml = Bpmn.convertToString(bpmnModel)
Mermaid Flowchart
Visualizing Workflow Definition
val wio: WIO[?, ?, ?, ?] = PullRequestWorkflow.workflow
val mermaidString = MermaidRenderer.renderWorkflow(wio.toProgress)
Visualizing Workflow Progress
You can also visualize the progress of a workflow instance:
val instance: WorkflowInstance[cats.Id, ?] = ???
val mermaidString = MermaidRenderer.renderWorkflow(instance.getProgress)
Debug Renderer
The Debug Renderer provides a hierarchical text representation of workflows, which is useful for debugging and understanding workflow state during development. It's optimized for brevity and hides non-critical details.
Visualizing Workflow Definition
val wio: WIO[?, ?, ?, ?] = PullRequestWorkflow.workflow
val debugString = DebugRenderer.getCurrentStateDescription(wio.toProgress)
[HandleError](no-name)
- base: [Sequence](no-name)
- step 0: [HandleSignal](Create PR) Signal: Create Request
- 3 more steps
Visualizing Workflow Progress
You can also visualize the progress of a workflow instance:
val instance: WorkflowInstance[cats.Id, ?] = ???
val debugString = DebugRenderer.getCurrentStateDescription(instance.getProgress)
[HandleError](no-name) Executed: Closed(Checked(some-sha,<Some tests results>),ReviewRejected)