RulesteadAdmin.StatusTone (rulestead_admin v0.1.7)

Copy Markdown View Source

Single source of truth mapping domain entity states to the canonical tone vocabulary and a human label.

The admin expresses state in many places — flag lifecycle badges, rollout guardrails, the change-request queue, the schedule list. Before this module each screen kept its own state_tone/1, so the same semantic state could drift to different colors. Screens now call tone/2 (and optionally label/2) with a domain, so a given state renders one consistent way everywhere.

Canonical tones — each has a .rs-badge[data-tone=...] (and related) CSS rule: positive · warning · critical · neutral · muted · accent.

Summary

Functions

Canonical human label for a domain state. Falls back to a humanized state.

Canonical tone string for a domain state. Falls back to neutral.

Types

domain()

@type domain() ::
  :flag_lifecycle
  | :flag_readiness
  | :change_request
  | :schedule
  | :guardrail
  | :audience

tone()

@type tone() :: String.t()

Functions

label(domain, state)

@spec label(domain(), atom() | String.t()) :: String.t()

Canonical human label for a domain state. Falls back to a humanized state.

tone(domain, state)

@spec tone(domain(), atom() | String.t()) :: tone()

Canonical tone string for a domain state. Falls back to neutral.