View Source AshPyro.Extensions.Resource.Info (AshPyro v0.1.0)
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.
Same as &data_table_for2
, but raises if not found.
Returns the form fields defined in the AshPyro.Extensions.Resource
extension for the given action.
Same as &form_for2
, but raises if not found.
Returns the page defined in the AshPyro.Extensions.Resource
extension for the given page name.
Same as &page_for2
, but raises if not found.
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 data_table_for!(Ash.Resource.t(), atom()) :: [ AshPyro.Extensions.Resource.DataTable ]
Same as &data_table_for2
, but raises if not found.
@spec form_for(Ash.Resource.t(), atom()) :: [ AshPyro.Extensions.Resource.Form.Field.t() | AshPyro.Extensions.Resource.Form.FieldGroup.t() ] | 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 form_for!(Ash.Resource.t(), atom()) :: [ AshPyro.Extensions.Resource.Form.Field.t() | AshPyro.Extensions.Resource.Form.FieldGroup.t() ]
Same as &form_for2
, but raises if not found.
@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 page_for!(Ash.Resource.t(), atom()) :: AshPyro.Extensions.Resource.LiveView.Page
Same as &page_for2
, but raises if not found.