queue.html 103 lignes · 4861 octets
{% extends "base.html" %}

{% block title %}{{ page_title }}{% endblock %}

{% block navbar %}
{% include "components/navbar.html" %}
{% endblock %}

{% block content %}
<div class="container mx-auto px-4 py-8">

    <nav class="text-sm breadcrumbs mb-6" aria-label="breadcrumb">
        <ul>
            <li><a href="/">{{ breadcrumb_home }}</a></li>
            <li><a href="/admin">{{ breadcrumb_admin }}</a></li>
            <li><a href="/admin/fediverse">{{ breadcrumb_federation }}</a></li>
            <li aria-current="page">{{ breadcrumb_self }}</li>
        </ul>
    </nav>

    {% include "components/admin_tabs.html" %}

    <header class="mb-8">
        <h1 class="text-3xl font-bold mb-2">{{ heading }}</h1>
        <p class="text-base-content/70">{{ subtitle }}</p>
    </header>

    {# Stats grid (Plan UI §3 P4 — empty states inclusive) #}
    <section class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-8" aria-label="stats">
        <div class="stat bg-base-100 shadow rounded-lg">
            <div class="stat-title">{{ stats_pending }}</div>
            <div class="stat-value text-warning">{{ count_pending }}</div>
        </div>
        <div class="stat bg-base-100 shadow rounded-lg">
            <div class="stat-title">{{ stats_delivered }}</div>
            <div class="stat-value text-success">{{ count_delivered }}</div>
        </div>
        <div class="stat bg-base-100 shadow rounded-lg">
            <div class="stat-title">{{ stats_failed }}</div>
            <div class="stat-value text-error">{{ count_failed }}</div>
        </div>
        <div class="stat bg-base-100 shadow rounded-lg">
            <div class="stat-title">{{ stats_dead }}</div>
            <div class="stat-value">{{ count_dead }}</div>
        </div>
    </section>

    {% if has_rows %}
    <section class="card bg-base-100 shadow-xl">
        <div class="card-body">
            <div class="overflow-x-auto">
                <table class="table table-zebra table-sm">
                    <thead>
                        <tr>
                            <th>{{ table_activity }}</th>
                            <th>{{ table_target }}</th>
                            <th>{{ table_status }}</th>
                            <th>{{ table_attempts }}</th>
                            <th>{{ table_last_error }}</th>
                            <th>{{ table_next_retry }}</th>
                            <th>{{ table_created_at }}</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for row in rows %}
                        <tr>
                            <td class="font-mono text-xs">{{ row.activity_id }}</td>
                            <td class="font-mono text-xs">{{ row.target_inbox }}</td>
                            <td>
                                {% if row.status == "pending" %}
                                <span class="badge badge-warning">{{ row.status }}</span>
                                {% else if row.status == "delivered" %}
                                <span class="badge badge-success">{{ row.status }}</span>
                                {% else if row.status == "failed" %}
                                <span class="badge badge-error">{{ row.status }}</span>
                                {% else %}
                                <span class="badge">{{ row.status }}</span>
                                {% endif %}
                            </td>
                            <td>{{ row.attempts }}/{{ row.max_attempts }}</td>
                            <td class="text-xs max-w-xs truncate">
                                {% if row.has_last_error %}{{ row.last_error }}{% else %}—{% endif %}
                            </td>
                            <td class="text-xs text-base-content/70">{{ row.next_retry_at }}</td>
                            <td class="text-xs text-base-content/70">{{ row.created_at }}</td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </section>
    {% else %}
    <section class="card bg-base-200 shadow-inner" aria-label="empty-state">
        <div class="card-body items-center text-center py-16">
            <svg xmlns="http://www.w3.org/2000/svg" class="h-16 w-16 text-base-content/30 mb-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" /></svg>
            <h3 class="text-lg font-semibold">{{ empty_title }}</h3>
            <p class="text-base-content/70 max-w-md">{{ empty_body }}</p>
        </div>
    </section>
    {% endif %}
</div>
{% endblock %}