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
@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
@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]
@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
@spec resource_by_path(Ash.Resource.t(), [atom() | binary()]) :: Ash.Resource.t()
Get a resource via a path from starting resource.