# `Alternera.Resource.UI.ActionRunner`
[🔗](https://github.com/10e-ab/alternera-sdk/blob/v0.9.0/alternera_resource_ui/lib/alternera/resource/ui/action_runner.ex#L1)

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.

Two ways in:

  * a button anywhere on the page (`Alternera.Resource.UI.Components.action_button/1`)
    sends `"run"` to it with `action` and, for a record action, `record`
    (the record's id);
  * the host sends `send_update(ActionRunner, id: …, run: {action_id, target})`
    with the target already loaded: `:resource`, `{:record, record}` or
    `{:selection, records}` (the checked rows, or every record a search
    matches).

After a run that changed something it tells the host its records are
stale (`Alternera.Resource.UI.records_changed/1`).

# `dom_id`

```elixir
@spec dom_id(Alternera.Resource.UI.Context.t()) :: String.t()
```

The DOM id of the runner mounted for `ctx`: a button targets it.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
