View Source AshPyro.Extensions.Resource.Info (AshPyro v0.2.1)

Helpers to introspect the AshPyro.Extensions.Resource Ash extension. Intended for use in components that automatically build UI from resource configuration.

Summary

Functions

Returns the data table defined in the AshPyro.Extensions.Resource extension for the given action.

Returns the form fields defined in the AshPyro.Extensions.Resource extension for the given action.

Returns the page defined in the AshPyro.Extensions.Resource extension for the given page name.

Get a resource via a path from starting resource.

Functions

Link to this function

data_table_for(resource, action_name)

View Source
@spec data_table_for(Ash.Resource.t(), atom()) ::
  [AshPyro.Extensions.Resource.DataTable] | nil

Returns the data table defined in the AshPyro.Extensions.Resource extension for the given action.

Examples

iex> data_table_for(AshPyro.Extensions.Resource.InfoTest.User, :list) |> Map.get(:name)
:list
Link to this function

form_field(resource, action, field)

View Source
Link to this function

form_for(resource, action_name)

View Source
@spec form_for(Ash.Resource.t(), atom()) ::
  AshPyro.Extensions.Resource.Form.Action | nil

Returns the form fields defined in the AshPyro.Extensions.Resource extension for the given action.

Examples

iex> form_for(AshPyro.Extensions.Resource.InfoTest.User, :create) |> Map.get(:fields) |> Enum.map(& &1.name)
[:primary, :authorization, :friendships, :notes]
Link to this function

page_for(resource, page_name)

View Source
@spec page_for(Ash.Resource.t(), atom()) ::
  AshPyro.Extensions.Resource.LiveView.Page | nil

Returns the page defined in the AshPyro.Extensions.Resource extension for the given page name.

Examples

iex> page_for(AshPyro.Extensions.Resource.InfoTest.User, :companies) |> Map.get(:name)
:companies
Link to this function

resource_by_path(resource, list)

View Source
@spec resource_by_path(Ash.Resource.t(), [atom() | binary()]) :: Ash.Resource.t()

Get a resource via a path from starting resource.