{# Status components — dots, stage strips and icons for job/run states. Colours come from `.dot` (tusk-app.css): green, amber, red, violet, neutral. Macros: status_dot, stage_dots, progress_stages, status_icon #} {% macro status_dot(status, size="sm", animate=true) %} {# success/ok/healthy → green · failed/error → red · running/active → amber (pulses) pending/queued → violet · cancelled/paused/skipped → neutral #} {% set s = status | lower %} {% if s in ["success", "ok", "healthy", "online", "passed", "connected"] %}{% set tone = "green" %} {% elif s in ["failed", "error", "unhealthy", "offline"] %}{% set tone = "red" %} {% elif s in ["running", "active", "warning"] %}{% set tone = "amber" %} {% elif s in ["pending", "waiting", "queued"] %}{% set tone = "violet" %} {% else %}{% set tone = "neutral" %}{% endif %} {% endmacro %} {% macro stage_dots(stages, size="xs") %} {# Row of tiny dots, one per stage (objects or dicts with a `status`). #} {% for s in stages %}{{ status_dot(s.status, size=size, animate=false) }}{% endfor %} {% endmacro %} {% macro progress_stages(stages) %} {# Segmented progress strip: one segment per stage (`stage_name`, `status`). #} {% if stages | length > 0 %}
{% for stage in stages %} {% set st = stage.status | lower %}
{% endfor %}
{{ stages[0].stage_name }} {% if stages | length > 1 %}{{ stages[-1].stage_name }}{% endif %}
{% endif %} {% endmacro %} {% macro status_icon(status, size="sm") %} {# Round icon badge for a stage state. size: sm (24px) | md (32px) #} {% set box = "w-8 h-8" if size == "md" else "w-6 h-6" %} {% set ico = "w-4 h-4" if size == "md" else "w-3.5 h-3.5" %} {% set s = status | lower %} {% if s == "success" %} {% elif s in ["failed", "error"] %} {% elif s == "running" %} {% elif s == "skipped" %} {% else %} {% endif %} {% endmacro %}