Flow Execution Graph API
Import TngFlowExecutionGraphComponent from @tailng-ui/flow/execution. The graph is a controlled execution-aware facade over Flow Editor: pass a workflow definition and run snapshot, then persist emitted selection, viewport, and edit requests in application state.
Graph inputs
definition supplies the workflow topology and snapshot supplies runtime execution state. Selection, inspection, selected execution, and viewport are controlled inputs so dashboards can synchronize the graph with inspectors, history panels, and URL state.
| Name | Type | Default | Description |
|---|---|---|---|
definition | TngFlowDefinition<TNodeData, TConnectionData> | null | null | Workflow nodes, connections, ports, labels, positions, and routing metadata. |
snapshot | TngFlowRunExecutionSnapshot<TPayload> | null | null | Run, node, and connection executions used to derive graph status presentation. |
selection | TngFlowSelection | EMPTY_TNG_FLOW_SELECTION | Controlled node and connection selection. |
inspectedNodeId | string | null | null | Node id used by details panels and execution selection resolution. |
selectedExecutionId | string | null | null | Selected execution for the inspected node. |
viewport | TngFlowViewport | null | null | Optional externally supplied canvas position and scale. |
mode | 'edit' | 'inspect' | 'readonly' | 'inspect' | Controls graph editing, selection, and activation behavior. |
flowId | string | 'tng-flow-execution-graph' | Stable underlying flow instance id. Use a unique value for multiple graphs. |
ariaLabel | string | 'Workflow execution graph' | Accessible name for the graph surface. |
Controlled execution graph
<tng-flow-execution-graph
[definition]="definition()"
[snapshot]="snapshot()"
[selection]="selection()"
[inspectedNodeId]="inspectedNodeId()"
[selectedExecutionId]="selectedExecutionId()"
[viewport]="viewport()"
(selectionChange)="selection.set($event)"
(inspectedNodeIdChange)="inspectedNodeId.set($event)"
(selectedExecutionIdChange)="selectedExecutionId.set($event)"
(viewportChange)="viewport.set($event)"
(executionActivated)="lastActivation.set($event)"
/>Editor options
Execution Graph forwards editor configuration to the underlying Flow Editor. Use these inputs for authoring mode, minimap, command shortcuts, connection routing, keyboard movement, and smart guides without dropping down to the editor component directly.
| Group | Inputs | Purpose |
|---|---|---|
| Surface toggles | showControls, showConnectionTools, showBackground, showMinimap, showSelectionArea, fitOnInit, fitOnDefinitionChange | Shows or hides built-in canvas features and controls initial viewport fitting. |
| Connection behavior | attachmentLayout, connectionValidator, options, connectionOptions, connectionCreationPathType, connectionAriaLabel | Configures port strategy, validation, routing defaults, live preview path type, and accessible connection names. |
| Keyboard and commands | keyboardOptions, commandShortcuts, canUndo, canRedo | Configures keyboard movement, shortcut interception, and command toolbar state. |
| Layout assistance | smartGuides, snapToGrid, gridSize, minimapOptions | Controls alignment guides, snapped movement, grid scale, and minimap behavior. |
| Context menu | contextMenuEnabled | Replaces the native graph context menu with controlled context-menu events. |
Graph outputs
Outputs are proposals or synchronized state changes. The graph does not mutate definition, selection, or viewport internally.
| Group | Outputs | Use |
|---|---|---|
| Controlled state | selectionChange, inspectedNodeIdChange, selectedExecutionIdChange, viewportChange | Persist graph state and synchronize external inspectors or history views. |
| Execution activation | executionActivated | Emits the activated node and selected execution with source 'graph'. |
| Node editing | nodesMoved, nodePositionChange, nodeCreateRequested, nodesDeleteRequested | Apply node position, creation, and deletion requests to a new definition snapshot. |
| Connection editing | connectionCreateRequested, connectionReconnectRequested, connectionRoutingChangeRequested, connectionWaypointsChange, connectionsDeleteRequested, connectionRejected | Create, reconnect, restyle, adjust, delete, or report rejected connections. |
| Commands and menus | commandRequested, contextMenuRequested | Integrate graph shortcuts, toolbar actions, and custom context menus. |
Template hooks
Execution Graph projects ng-template[tngFlowNode], ng-template[tngFlowConnection], and ng-template[tngFlowConnectionLabel] into the underlying editor. The template context is the same as Flow Editor, with execution presentation already merged into the provided view state.
Execution-aware templates
<tng-flow-execution-graph [definition]="definition()" [snapshot]="snapshot()">
<ng-template tngFlowNode="task" let-node let-view="view">
<article class="task-node" [attr.data-phase]="view.status">
<strong>{{ node.name }}</strong>
<small>{{ view.status ?? 'pending' }}</small>
</article>
</ng-template>
<ng-template tngFlowConnection let-connection let-view="view">
<span class="connection-label">
{{ connection.label ?? view.status ?? 'edge' }}
</span>
</ng-template>
</tng-flow-execution-graph>Imperative helpers
Export the component as tngFlowExecutionGraph or query it with ViewChild when parent tools need to drive viewport or routing behavior from outside the graph.
| Method | Signature | Description |
|---|---|---|
refreshLayout | () => void | Recomputes editor geometry after external layout changes. |
fitToScreen | (animated?: boolean, padding?: number) => void | Fits graph content into the visible viewport. |
resetViewport | (animated?: boolean) => void | Restores the default viewport. |
centerNode | (nodeId: string, animated?: boolean) => boolean | Centers a node and reports whether the node was found. |
requestNodeCreate | (item: TngFlowPaletteItem<TNodeData>, position?: TngFlowPoint) => void | Starts the same controlled node-create flow used by palette interactions. |
requestConnectionRoutingChange | (type: TngFlowConnectionPathType) => boolean | Requests a routing style update for selected existing connections. |
Calling graph helpers
@ViewChild(TngFlowExecutionGraphComponent)
private readonly graph?: TngFlowExecutionGraphComponent;
protected focusFailedNode(nodeId: string): void {
this.graph?.centerNode(nodeId);
}
protected useOrthogonalRouting(): void {
this.graph?.requestConnectionRoutingChange('orthogonal');
}