RulesteadAdmin.Components.ConfirmComponents (rulestead_admin v0.1.7)

Copy Markdown View Source

The shared mutation-confirm contract.

Every governed mutation in the admin (audience edit/archive/delete, flag cleanup, kill switch, rollout advance/hold/rollback, change-request execution) follows one preview → confirm → audit shape. mutation_confirm/1 is the confirm step's canonical affordance: an optional scope line, slots for evidence (blast radius, diffs) and extra fields (typed confirmation), a required reason, and a primary-or-danger submit paired with a back link.

Standardizing this one component is the highest-leverage consistency win — every confirm screen reads and behaves identically instead of hand-rolling its own form markup.

Summary

Functions

Renders the canonical confirm form: scope → evidence → extra fields → reason → actions.

Functions

mutation_confirm(assigns)

Renders the canonical confirm form: scope → evidence → extra fields → reason → actions.

Drop governance evidence (blast radius, callouts) into the :evidence slot and any pre-reason inputs (e.g. a production typed-key confirmation) into the :extra_fields slot. The reason textarea and the submit/back actions are always rendered so confirm screens stay visually and behaviourally uniform.

Attributes

  • submit_event (:string) (required) - phx-submit event name.
  • submit_label (:string) (required)
  • reason_value (:string) - Defaults to "".
  • reason_label (:string) - Defaults to "Reason (required)".
  • reason_required (:boolean) - Defaults to true.
  • back_href (:string) - Defaults to nil.
  • back_label (:string) - Defaults to "Back".
  • danger? (:boolean) - Defaults to false.
  • aria_label (:string) - Defaults to "Confirm action".
  • scope (:map) - optional %{environment:, tenant:, fingerprint:} context line. Defaults to nil.

Slots

  • evidence - blast radius / diff / callouts shown above the reason.
  • extra_fields - inputs shown above the reason, e.g. typed confirmation.