Relationships tab view: table showing resource relationships.
Relationships are navigable — pressing Enter on a relationship jumps to the destination resource.
Pure function — takes state and rect, returns [{widget, rect}].
Summary
Functions
Renders the relationships table for the current resource.
Functions
@spec render(AshTui.State.t(), ExRatatui.Layout.Rect.t()) :: [ {struct(), ExRatatui.Layout.Rect.t()} ]
Renders the relationships table for the current resource.
Returns a list of {widget, rect} tuples containing the relationships table
(and optionally a scrollbar when content overflows). Relationships are
navigable — pressing Enter on a row jumps to the destination resource.
Examples
iex> domains = AshTui.Introspection.from_data([
...> %{
...> name: MyApp.Accounts,
...> resources: [
...> %{
...> name: MyApp.Accounts.User,
...> attributes: [%{name: :id, type: :uuid, primary_key?: true}],
...> actions: [],
...> relationships: [%{name: :posts, type: :has_many, destination: MyApp.Blog.Post}]
...> }
...> ]
...> }
...> ])
iex> state = AshTui.State.new(domains) |> Map.put(:current_tab, :relationships)
iex> rect = %ExRatatui.Layout.Rect{x: 0, y: 0, width: 60, height: 20}
iex> [{%ExRatatui.Widgets.Table{}, ^rect}] =
...> AshTui.Views.RelationshipsTab.render(state, rect)