AshWorkflow.Charts.Graph (AshWorkflow v0.10.0)

Copy Markdown View Source

The diagram model every AshWorkflow.Charts backend draws from.

A graph is a list of AshWorkflow.Charts.Graph.Node and a list of AshWorkflow.Charts.Graph.Edge, with every label already written out. A backend only maps each node kind and edge kind to its own syntax, so every format shows the same workflow in the same words. build/2 makes a graph.

Summary

Functions

Builds the diagram model for a resource that uses AshWorkflow.

Types

t()

@type t() :: %AshWorkflow.Charts.Graph{
  edges: [AshWorkflow.Charts.Graph.Edge.t()],
  nodes: [AshWorkflow.Charts.Graph.Node.t()],
  resource: Ash.Resource.t()
}

Functions

build(resource, opts \\ [])

@spec build(Ash.Resource.t(), keyword()) :: t()

Builds the diagram model for a resource that uses AshWorkflow.

It reads AshWorkflow.Info.workflow_graph/1 and AshWorkflow.Info.undoable_edges/1 once. Nodes are in step declaration order. Edges are grouped by the step they leave, in declaration order, and undo edges come last. Within one step the order is on_success routes, transitions, timeouts that move the record, then on_error.

Raises ArgumentError for a module that is not such a resource.

Options

  • :undo — include an edge for each move the generated undo action can rewind. Defaults to true. Has no effect on a workflow without an undo block.
  • :notes — include each step's notes. Defaults to true.