{# ---- Heroicons (outline, MIT) as inline SVG — no build step needed ---- #} {% macro icon(name, cls="w-4 h-4") -%} {%- if name == 'pause' -%} {%- elif name == 'play' -%} {%- elif name == 'retry' -%} {%- elif name == 'trash' -%} {%- elif name == 'promote' -%} {%- elif name == 'bolt' -%} {%- elif name == 'sun' -%} {%- elif name == 'moon' -%} {%- elif name == 'db' -%} {%- elif name == 'users' -%} {%- elif name == 'pulse' -%} {%- elif name == 'key' -%} {%- elif name == 'clock' -%} {%- elif name == 'warn' -%} {%- elif name == 'chevron' -%} {%- elif name == 'search' -%} {%- elif name == 'inbox' -%} {%- elif name == 'server' -%} {%- elif name == 'queue' -%} {%- endif -%} {%- endmacro %} {# One job as a native accordion row. `state` keys the per-row actions (use the job's own state for search results that span states). #} {% macro job_row(name, j, state, page=1) -%} {{ icon('chevron', 'w-4 h-4') }} #{{ j.id }} {{ j.name }} {{ j.data|tojson }} {% if j.progress is number %} {{ j.progress }}% {% endif %} {{ j.attempts_made }}× {% if state == 'delayed' %} {{ icon('promote', 'w-3.5 h-3.5') }} {% endif %} {% if state == 'failed' %} {{ icon('retry', 'w-3.5 h-3.5') }} {% endif %} {{ icon('trash', 'w-3.5 h-3.5') }} {%- endmacro %} {# state -> semantic status token (one token per state; see styles/input.css) #} {% macro state_token(s) -%} {%- if s == 'active' -%}info {%- elif s == 'completed' -%}success {%- elif s == 'failed' -%}danger {%- elif s == 'delayed' -%}warning {%- else -%}muted {%- endif -%} {%- endmacro %} {# state -> solid progress-bar color #} {% macro bar_color(s) -%}bg-{{ state_token(s) }}{%- endmacro %} {# state -> pill colors (one token, three fixed intensities; both themes) #} {% macro state_color(s) -%} {%- set c = state_token(s) -%}text-{{ c }} bg-{{ c }}/10 ring-{{ c }}/30 {%- endmacro %} {# A clickable job-id chip → the standalone job page. Import `with context` (url_for). #} {% macro job_chip(queue, jid) -%} {% set href = url_for('job_page', name=queue, job_id=jid).path %} #{{ jid }} {%- endmacro %}