TermUI.Widgets.SupervisionTreeViewer (TermUI v0.2.0)
View SourceSupervisionTreeViewer widget for OTP supervision hierarchy visualization.
SupervisionTreeViewer displays the supervision tree with live status indicators, restart counts, and provides controls for process management and inspection.
Usage
SupervisionTreeViewer.new(
root: MyApp.Supervisor,
update_interval: 2000,
on_select: fn node -> handle_select(node) end
)Features
- Tree view of supervision hierarchy
- Live status indicators (running, restarting, terminated)
- Restart count and history display
- Supervisor strategy display
- Process state inspection
- Restart/terminate controls with confirmation
- Auto-refresh on supervision tree changes
Keyboard Controls
- Up/Down: Move selection
- Left: Collapse node or move to parent
- Right: Expand node or move to first child
- Enter: Toggle expand/collapse
- i: Show process info panel
- r: Restart selected process (with confirmation)
- k: Terminate selected process (with confirmation)
- R: Refresh tree
- /: Filter by name
- Escape: Clear filter/close panel
Summary
Functions
Collapses all nodes.
Expands all supervisor nodes.
Gets the process state for the selected node.
Gets the currently selected node.
Initializes the SupervisionTreeViewer state.
Creates new SupervisionTreeViewer widget props.
Forces a refresh of the supervision tree.
Sets the root supervisor.
Types
@type node_status() :: :running | :restarting | :terminated | :undefined
@type node_type() :: :supervisor | :worker
@type sup_node() :: %{ id: term(), pid: pid() | :restarting | :undefined, name: atom() | nil, type: node_type(), status: node_status(), child_spec: map() | nil, strategy: atom() | nil, restart_count: non_neg_integer(), max_restarts: non_neg_integer() | nil, max_seconds: non_neg_integer() | nil, children: [sup_node()] | nil, memory: non_neg_integer(), reductions: non_neg_integer(), message_queue_len: non_neg_integer(), depth: non_neg_integer(), parent_pid: pid() | nil }
Functions
Collapses all nodes.
Expands all supervisor nodes.
Gets the process state for the selected node.
Gets the currently selected node.
Initializes the SupervisionTreeViewer state.
Creates new SupervisionTreeViewer widget props.
Options
:root- Root supervisor (pid, registered name, or module) - required:update_interval- Refresh interval in ms (default: 2000):on_select- Callback when node is selected:fn node -> ... end:on_action- Callback when action is performed:fn {:restarted | :terminated, pid} -> ... end:show_workers- Show worker processes (default: true):auto_expand- Expand all nodes initially (default: true)
Forces a refresh of the supervision tree.
Sets the root supervisor.