| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- {% extends "base.html" %}
- {% block title %}Historique — {{ job.name }}{% endblock %}
- {% block content %}
- <div class="mb-6 flex items-center gap-4">
- <a href="{{ url_for('jobs.index') }}" class="text-gray-400 hover:text-gray-600 text-sm">← Dashboard</a>
- <h1 class="text-xl font-bold text-gray-900">{{ job.name }}</h1>
- <span class="bg-gray-100 text-gray-600 text-xs px-2 py-0.5 rounded font-mono">{{ job.type }}</span>
- <span class="text-gray-400 text-sm font-mono">{{ job.cron_expr }}</span>
- </div>
- <div class="bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden">
- <div class="px-6 py-4 border-b border-gray-100">
- <h2 class="text-sm font-semibold text-gray-700">
- Historique des exécutions
- <span class="text-gray-400 font-normal">({{ runs | length }} entrées)</span>
- </h2>
- </div>
- {% if not runs %}
- <div class="px-6 py-10 text-center text-gray-400 text-sm">
- Aucune exécution enregistrée pour ce job.
- </div>
- {% else %}
- <div class="overflow-x-auto">
- <table class="w-full text-sm">
- <thead>
- <tr class="text-xs text-gray-500 uppercase tracking-wide bg-gray-50">
- <th class="px-6 py-3 text-left font-medium">Début</th>
- <th class="px-6 py-3 text-left font-medium">Fin</th>
- <th class="px-6 py-3 text-left font-medium">Durée</th>
- <th class="px-6 py-3 text-left font-medium">Statut</th>
- <th class="px-6 py-3 text-left font-medium">Archive</th>
- <th class="px-6 py-3 text-left font-medium">Taille</th>
- <th class="px-6 py-3 text-left font-medium">Log</th>
- <th class="px-6 py-3 text-left font-medium">Action</th>
- </tr>
- </thead>
- <tbody class="divide-y divide-gray-100">
- {% for run in runs %}
- <tr class="hover:bg-gray-50">
- <td class="px-6 py-3 text-xs text-gray-700 whitespace-nowrap">
- {{ run.started_at.strftime('%d/%m/%Y %H:%M:%S') if run.started_at else '—' }}
- </td>
- <td class="px-6 py-3 text-xs text-gray-500 whitespace-nowrap">
- {{ run.finished_at.strftime('%H:%M:%S') if run.finished_at else '—' }}
- </td>
- <td class="px-6 py-3 text-xs text-gray-500">
- {% if run.duration_seconds is not none %}
- {% if run.duration_seconds >= 60 %}
- {{ (run.duration_seconds // 60) }}min {{ run.duration_seconds % 60 }}s
- {% else %}
- {{ run.duration_seconds }}s
- {% endif %}
- {% else %}
- —
- {% endif %}
- </td>
- <td class="px-6 py-3">
- {% if run.status == 'success' %}
- <span class="bg-green-100 text-green-700 text-xs font-medium px-2 py-0.5 rounded-full">✓ succès</span>
- {% elif run.status == 'error' %}
- <span class="bg-red-100 text-red-700 text-xs font-medium px-2 py-0.5 rounded-full">✗ erreur</span>
- {% elif run.status == 'running' %}
- <span class="bg-blue-100 text-blue-700 text-xs font-medium px-2 py-0.5 rounded-full animate-pulse">⟳ en cours</span>
- {% else %}
- <span class="text-gray-400 text-xs">{{ run.status or '—' }}</span>
- {% endif %}
- </td>
- <td class="px-6 py-3 text-xs font-mono text-gray-600">
- {{ run.archive_name or '—' }}
- </td>
- <td class="px-6 py-3 text-xs text-gray-500">
- {{ run.size_human if run.size_bytes else '—' }}
- </td>
- <td class="px-6 py-3">
- {% if run.log_text %}
- <details>
- <summary class="cursor-pointer text-xs text-blue-600 hover:underline">Voir</summary>
- <pre class="mt-2 text-xs bg-gray-900 text-gray-100 p-3 rounded-lg overflow-x-auto max-w-xl whitespace-pre-wrap">{{ run.log_text }}</pre>
- </details>
- {% else %}
- <span class="text-gray-300 text-xs">—</span>
- {% endif %}
- </td>
- <td class="px-6 py-3">
- {% if run.status == 'success' and run.archive_name %}
- <div class="flex flex-col gap-1">
- <a href="{{ url_for('jobs.archive_restore', archive_name=run.archive_name) }}"
- class="text-xs text-orange-600 hover:text-orange-800 hover:underline whitespace-nowrap">
- ↩ Restaurer
- </a>
- {% set destinations = job.destination_id and [job.destination] or [] %}
- {% if destinations %}
- <form method="post" action="{{ url_for('dest.archive_transfer', archive_name=run.archive_name) }}">
- <input type="hidden" name="destination_id" value="{{ job.destination_id }}">
- <button type="submit" class="text-xs text-blue-600 hover:text-blue-800 hover:underline whitespace-nowrap text-left">
- ↑ Transférer
- </button>
- </form>
- {% endif %}
- </div>
- {% else %}
- <span class="text-gray-300 text-xs">—</span>
- {% endif %}
- </td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- </div>
- {% endif %}
- </div>
- {% endblock %}
|