{# T30a admin scans list. Extends the T28 admin layout. #} {# Filter bar (GET form, serializes to URL query params) + a card with a #} {# divide-y data table + pagination footer. #} {% extends "admin_layout.html" %} {% block page_title %}Scans{% endblock %} {% block breadcrumb %} Admin / Scans {% endblock %} {% macro status_chip(status) -%} {% if status == 'success' -%} success {%- elif status == 'errored' -%} errored {%- elif status == 'cancelled' -%} cancelled {%- elif status == 'soft_deleted' -%} soft-deleted {%- else -%} {{ status }} {%- endif %} {%- endmacro %} {# Builds a sort-toggle URL for a column header. Preserves every other #} {# filter param via ``filter_query`` so clicking a header doesn't reset #} {# the filter bar. #} {% macro sort_header(label, col, current_sort, current_order, filter_query) -%} {% set next_order = 'asc' if (current_sort == col and current_order == 'desc') else ('desc' if current_sort == col else 'desc') %} {% set indicator = '' %} {% if current_sort == col and current_order == 'asc' %}{% set indicator = ' ▲' %}{% endif %} {% if current_sort == col and current_order == 'desc' %}{% set indicator = ' ▼' %}{% endif %} {{ label }}{{ indicator }} {%- endmacro %} {% block content %}
{# ===================== Filter bar ===================== #}
Status
{% for s in ['success', 'errored', 'cancelled', 'soft_deleted'] %} {% endfor %}
Options
{# Preserve sort + order across form submission. #}
Reset
{# ===================== Data table ===================== #}
{% if not result.rows %}
No scans found.
{% else %}
{% for row in result.rows %} {% endfor %}
Scan ID {{ sort_header('Created', 'created_at', filt.sort_by, filt.sort_order, filter_query) }} Owner {{ sort_header('Domain', 'target_domain', filt.sort_by, filt.sort_order, filter_query) }} Template Status {{ sort_header('Cost', 'cost_usd', filt.sort_by, filt.sort_order, filter_query) }} Actions
{{ row.scan_id_short }} {{ row.created_at.strftime('%Y-%m-%d %H:%M') }} {{ row.owner_email or '(anonymous)' }} {{ row.target_domain or '-' }} {{ row.starter_template or '-' }} {{ status_chip(row.status) }} ${{ '%.4f'|format(row.cost_usd) }} View
{% endif %}
{# ===================== Pagination footer ===================== #} {% if result.rows %} {% set start = ((result.page - 1) * result.page_size) + 1 %} {% set end = start + result.rows|length - 1 %}
Showing {{ start }}{{ end }} of {{ result.total_count }}
{% if result.page > 1 %} ← Prev {% else %} ← Prev {% endif %} Page {{ result.page }} {% if result.has_more %} Next → {% else %} Next → {% endif %}
{% endif %}
{% endblock %}