{% from "macros.html" import icon, bar_color, job_row with context %}
{% if state in ['failed', 'completed', 'delayed', 'wait'] and jobs %}
{# Bulk-action bar — shown by JS only when ≥1 row is selected (persists across pages). #}
0 selected
{% if state == 'failed' %}
{% endif %}
{# Table header — the select-all aligns with the row checkboxes. #}
idjobdata
{% endif %}
{% for j in jobs %}{{ job_row(name, j, state, page) }}
{% else %}
{{ icon('inbox', 'w-7 h-7') }}No {{ state }} jobs{% if state == 'failed' %} — all clear{% endif %}
{% endfor %}
{# Live-refresh the list (table + total count + pagination) on any job event, for every
state. Paused while a row is open by jobs-live.js (progressive: if that JS fails to
load, the refresh still fires — just without the pause). Morph + stable row ids keep
it flicker-free; throttle + drop rate-cap it. #}
{% if pages > 1 %}
{% macro pglink(p, label, disabled=false, active=false) -%}
{{ label }}
{%- endmacro %}
{{ total|comma }} {{ state }} · page {{ page }} of {{ pages }}