Repository navigation
v0.9.0
·
304 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
Upgrading from 0.8.x
ash_workflownow depends onjason ~> 1.4, for the:jsonchart backend.
Added
- Workflow diagrams.
AshWorkflow.Chartsdraws a workflow from its DSL.AshWorkflow.Charts.mermaid_state_diagram/2returns a MermaidstateDiagram-v2that marks each step as automatic, manual, wait state or terminal. It labels a timeout with its name and its deadline (⏱ auto_escalate after 4 hours,⏱ go_live at publish_at) and gives each conditional route itswhenexpression. It notes a step's policy through the check's owndescribe/1, itsretry, the timeouts that run an action and itseveryentries. It draws each undo move thatAshWorkflow.Info.undoable_edges/1allows, with the undo window whenwithinis set (↶ undo within 1 hour).AshWorkflow.Charts.render/3takes:mermaid,:jsonor any module that implementsAshWorkflow.Charts.Backend. Every format draws from oneAshWorkflow.Charts.Graph, so all formats show the same workflow.:jsongives that graph as plain data, for a client that draws the workflow itself.mix ash_workflow.diagramprints a diagram, or with--outputwrites one file for each workflow resource in the project's domains. The Diagrams guide shows four small workflows fromexamples/basicwith their charts, and both the definitions and the charts are generated from the code:bin/update-chart-examplesrewrites them, andtest/documentation_charts_test.exsfails when one is stale. (#16) - Graphviz DOT diagrams.
AshWorkflow.Charts.render(resource, :dot)andmix ash_workflow.diagram --format dotgive a Graphviz DOT chart of a workflow. It shows the same steps, edges and labels as the Mermaid chart, with colour and line styles. It takes its colours fromAshWorkflow.Charts.Palette.svg: true, or--svg, runsdotfrom thePATHand returns the SVG. You install Graphviz.:pathunderconfig :ash_workflow, :dotselects anotherdot, for example in a release. Without adot,svg: trueraises anArgumentErrorthat says to install Graphviz.- Colour follows the graph: blue automatic steps, amber manual steps and lavender wait states. A terminal step is green, red, amber or grey by the kinds of edges that reach it.
on_successis a thick line, a timeout is dashed, and undo is dotted with a hollow arrowhead. theme: :dark, or--theme dark, gives a dark chart. With--output, a dark chart goes to a file such asMyApp.Candidate-dark.svg, beside the light file.classes:changes the colours and line styles of the step kinds, the terminal steps, and theon_success,on_error, timeout and undo edges. Transitions, the start circle and the background have no class. A key is a Graphviz attribute name, such asfillcolororpenwidth: a node attribute for a step class, and an edge attribute for an edge class.classes: [light: [...], dark: [...]]gives each theme its own colours.classes:andtheme:can also go underconfig :ash_workflow, :dot.- The chart puts a step's notes inside the step.
direction: :rightturns the chart on its side.