Skip to content

v0.9.0

Choose a tag to compare

@github-actions github-actions released this 17 Oct 19:47
· 304 commits to main since this release
Immutable release. Only release title and notes can be modified.
5ac4d33

Upgrading from 0.8.x

  • ash_workflow now depends on jason ~> 1.4, for the :json chart backend.

Added

  • Workflow diagrams. AshWorkflow.Charts draws a workflow from its DSL. AshWorkflow.Charts.mermaid_state_diagram/2 returns a Mermaid stateDiagram-v2 that 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 its when expression. It notes a step's policy through the check's own describe/1, its retry, the timeouts that run an action and its every entries. It draws each undo move that AshWorkflow.Info.undoable_edges/1 allows, with the undo window when within is set (↶ undo within 1 hour). AshWorkflow.Charts.render/3 takes :mermaid, :json or any module that implements AshWorkflow.Charts.Backend. Every format draws from one AshWorkflow.Charts.Graph, so all formats show the same workflow. :json gives that graph as plain data, for a client that draws the workflow itself. mix ash_workflow.diagram prints a diagram, or with --output writes one file for each workflow resource in the project's domains. The Diagrams guide shows four small workflows from examples/basic with their charts, and both the definitions and the charts are generated from the code: bin/update-chart-examples rewrites them, and test/documentation_charts_test.exs fails when one is stale. (#16)
  • Graphviz DOT diagrams. AshWorkflow.Charts.render(resource, :dot) and mix ash_workflow.diagram --format dot give 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 from AshWorkflow.Charts.Palette.
    • svg: true, or --svg, runs dot from the PATH and returns the SVG. You install Graphviz. :path under config :ash_workflow, :dot selects another dot, for example in a release. Without a dot, svg: true raises an ArgumentError that 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_success is 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 as MyApp.Candidate-dark.svg, beside the light file.
    • classes: changes the colours and line styles of the step kinds, the terminal steps, and the on_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 as fillcolor or penwidth: 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: and theme: can also go under config :ash_workflow, :dot.
    • The chart puts a step's notes inside the step. direction: :right turns the chart on its side.