AshTui.Views.ActionsTab (AshTui v0.3.1)

Copy Markdown View Source

Actions tab view: table showing resource actions.

Pure function — takes state and rect, returns [{widget, rect}].

Summary

Functions

Renders the actions table for the current resource.

Functions

render(state, rect)

Renders the actions table for the current resource.

Returns a list of {widget, rect} tuples containing the actions table (and optionally a scrollbar when content overflows).

Examples

iex> domains = AshTui.Introspection.from_data([
...>   %{
...>     name: MyApp.Accounts,
...>     resources: [
...>       %{
...>         name: MyApp.Accounts.User,
...>         attributes: [%{name: :id, type: :uuid, primary_key?: true}],
...>         actions: [%{name: :read, type: :read, primary?: true}],
...>         relationships: []
...>       }
...>     ]
...>   }
...> ])
iex> state = AshTui.State.new(domains) |> Map.put(:current_tab, :actions)
iex> rect = %ExRatatui.Layout.Rect{x: 0, y: 0, width: 60, height: 20}
iex> [{%ExRatatui.Widgets.Table{}, ^rect}] =
...>   AshTui.Views.ActionsTab.render(state, rect)