# alternera_resource_ui v0.9.0 - API Reference

## Modules

- [Alternera.Resource.UI](Alternera.Resource.UI.md): The contract of a resource package's own UI: components a package ships
for its resources, which the proxy draws in its generated Resources page,
in place of it, at a page of the package's own, or as a Workbench tab.
`docs/WRITING_RESOURCE_PLUGINS.md` ("Your own UI") is the guide; the
declarations are the `ui` section of `alternera_resource` and the
`alternera_ui` section of the domain (`Alternera.Resource.Info.ui/1`).
- [Alternera.Resource.UI.ActionHandler](Alternera.Resource.UI.ActionHandler.md): An action declared with `handler:` (`action :id, "Label" do handler M
… end`), for work that is not one Ash action of the resource: call a
service, then write many records. An action that is one Ash action
declares `run:` instead and needs no code.
- [Alternera.Resource.UI.ActionRunner](Alternera.Resource.UI.ActionRunner.md): Runs a resource's declared actions for the host: asks for the action's
input and confirmation in a dialog, runs it in the background with the
viewer's context, and shows the outcome, its message or its error, in
that dialog. An action with no input and no confirmation opens the
dialog as it starts, to show it running and then its outcome. An
action with input stays open for another run (a second conversion);
Close ends it. The runner sends no notification of its own: a handler
that wants one calls `Alternera.Resource.UI.notify/3`. Only an
outcome whose dialog is gone (closed while it ran, or the host moved
on) is said in a notification, as nothing else would show it. An
outcome that opens something (`open:`) closes the dialog. The host mounts
one per mounted surface and one on the generated page, with `id`, `ctx`
(whose `resource` is the resource the actions belong to) and nothing
else.
- [Alternera.Resource.UI.Actions](Alternera.Resource.UI.Actions.md): The declared actions of a resource (`action :id, "Label"` in its `ui`):
who may run one, what it asks for, and running it. The host's buttons,
its dialog (`Alternera.Resource.UI.ActionRunner`) and the contract
kit's harness all run actions through here, so an action behaves the same
wherever it is drawn.
- [Alternera.Resource.UI.Check](Alternera.Resource.UI.Check.md): Whether a package's declared UI modules are what their declarations
say: each one compiled, `use Alternera.Resource.UI` with the kind its
place needs, at a contract version the proxy speaks; each handler exports
`handle_action/4`, each `visible` function exists. The SDK's verifier
cannot see this (a module named in a declaration compiles later), so the
proxy checks it at boot and the contract kit in a package's tests.

- [Alternera.Resource.UI.Components](Alternera.Resource.UI.Components.md): The building blocks a package's components draw with, beside the
proxy's look in `Alternera.UIKit`: buttons, cards, a table of
records, a resource's actions and a field's value as the generated page
shows it. `use Alternera.Resource.UI` imports them.
- [Alternera.Resource.UI.Context](Alternera.Resource.UI.Context.md): What every component of a resource package's UI is given, as its `ctx`
assign: who is looking, in which tenant, at what, and where.
- [Alternera.Resource.UI.Host](Alternera.Resource.UI.Host.md): What a resource package's UI needs from the proxy at run time, as a
behaviour: the page's own way of reading and writing records
(`Alternera.Resource.UI.Records` calls it), and messages between a
package's components.
- [Alternera.Resource.UI.Records](Alternera.Resource.UI.Records.md): The records a component shows, read and written the way the Resources
page does: through the host (`Alternera.Resource.UI.Host`), with the
context's tenant and actor, so the resource's policies decide, the
history records the change, a cached resource drops its key, and every
error is logged.
- [Alternera.Resource.UI.Surface](Alternera.Resource.UI.Surface.md): The optional callbacks of a surface (`use Alternera.Resource.UI,
:surface`), for one offered as a Workbench item: the Workbench calls them
as it calls its own item types.
- [Alternera.Resource.UI.Test](Alternera.Resource.UI.Test.md): The test kit for a package's own UI, run with no proxy around.
- [Alternera.Resource.UI.Test.Endpoint](Alternera.Resource.UI.Test.Endpoint.md): The endpoint a package's UI tests mount components under, with no proxy
around. `Alternera.Resource.UI.Test.start!/0` configures and starts
it.

- [Alternera.Resource.UI.Test.Harness](Alternera.Resource.UI.Test.Harness.md): The LiveView that plays the host in a package's UI tests: it mounts the
component under test (`id` `"subject"`) and an action runner, does what
the component asks the host (`put_params`, `notify`, `subscribe`, …) and
tells the test process each request as `{:resource_ui, request}`.
Mounted by `Alternera.Resource.UI.Test.live_ui/3`.
- [Alternera.Resource.UI.Test.Host](Alternera.Resource.UI.Test.Host.md): The host a package's own UI tests run against: records through Ash
directly, with the context's tenant and actor, and messages between
components within the test node. It is the default of
`config :alternera_resource_ui, :host`, so a package needs no setting.
Searching, sorting and paging happen in memory: a test's data is small.

