job_history.html 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. {% extends "base.html" %}
  2. {% block title %}Historique — {{ job.name }}{% endblock %}
  3. {% block content %}
  4. <div class="mb-6 flex items-center gap-4">
  5. <a href="{{ url_for('index') }}" class="text-gray-400 hover:text-gray-600 text-sm">← Dashboard</a>
  6. <h1 class="text-xl font-bold text-gray-900">{{ job.name }}</h1>
  7. <span class="bg-gray-100 text-gray-600 text-xs px-2 py-0.5 rounded font-mono">{{ job.type }}</span>
  8. <span class="text-gray-400 text-sm font-mono">{{ job.cron_expr }}</span>
  9. </div>
  10. <div class="bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden">
  11. <div class="px-6 py-4 border-b border-gray-100">
  12. <h2 class="text-sm font-semibold text-gray-700">
  13. Historique des exécutions
  14. <span class="text-gray-400 font-normal">({{ runs | length }} entrées)</span>
  15. </h2>
  16. </div>
  17. {% if not runs %}
  18. <div class="px-6 py-10 text-center text-gray-400 text-sm">
  19. Aucune exécution enregistrée pour ce job.
  20. </div>
  21. {% else %}
  22. <div class="overflow-x-auto">
  23. <table class="w-full text-sm">
  24. <thead>
  25. <tr class="text-xs text-gray-500 uppercase tracking-wide bg-gray-50">
  26. <th class="px-6 py-3 text-left font-medium">Début</th>
  27. <th class="px-6 py-3 text-left font-medium">Fin</th>
  28. <th class="px-6 py-3 text-left font-medium">Durée</th>
  29. <th class="px-6 py-3 text-left font-medium">Statut</th>
  30. <th class="px-6 py-3 text-left font-medium">Archive</th>
  31. <th class="px-6 py-3 text-left font-medium">Taille</th>
  32. <th class="px-6 py-3 text-left font-medium">Log</th>
  33. </tr>
  34. </thead>
  35. <tbody class="divide-y divide-gray-100">
  36. {% for run in runs %}
  37. <tr class="hover:bg-gray-50">
  38. <td class="px-6 py-3 text-xs text-gray-700 whitespace-nowrap">
  39. {{ run.started_at.strftime('%d/%m/%Y %H:%M:%S') if run.started_at else '—' }}
  40. </td>
  41. <td class="px-6 py-3 text-xs text-gray-500 whitespace-nowrap">
  42. {{ run.finished_at.strftime('%H:%M:%S') if run.finished_at else '—' }}
  43. </td>
  44. <td class="px-6 py-3 text-xs text-gray-500">
  45. {% if run.duration_seconds is not none %}
  46. {% if run.duration_seconds >= 60 %}
  47. {{ (run.duration_seconds // 60) }}min {{ run.duration_seconds % 60 }}s
  48. {% else %}
  49. {{ run.duration_seconds }}s
  50. {% endif %}
  51. {% else %}
  52. {% endif %}
  53. </td>
  54. <td class="px-6 py-3">
  55. {% if run.status == 'success' %}
  56. <span class="bg-green-100 text-green-700 text-xs font-medium px-2 py-0.5 rounded-full">✓ succès</span>
  57. {% elif run.status == 'error' %}
  58. <span class="bg-red-100 text-red-700 text-xs font-medium px-2 py-0.5 rounded-full">✗ erreur</span>
  59. {% elif run.status == 'running' %}
  60. <span class="bg-blue-100 text-blue-700 text-xs font-medium px-2 py-0.5 rounded-full animate-pulse">⟳ en cours</span>
  61. {% else %}
  62. <span class="text-gray-400 text-xs">{{ run.status or '—' }}</span>
  63. {% endif %}
  64. </td>
  65. <td class="px-6 py-3 text-xs font-mono text-gray-600">
  66. {{ run.archive_name or '—' }}
  67. </td>
  68. <td class="px-6 py-3 text-xs text-gray-500">
  69. {{ run.size_human if run.size_bytes else '—' }}
  70. </td>
  71. <td class="px-6 py-3">
  72. {% if run.log_text %}
  73. <details>
  74. <summary class="cursor-pointer text-xs text-blue-600 hover:underline">Voir</summary>
  75. <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>
  76. </details>
  77. {% else %}
  78. <span class="text-gray-300 text-xs">—</span>
  79. {% endif %}
  80. </td>
  81. </tr>
  82. {% endfor %}
  83. </tbody>
  84. </table>
  85. </div>
  86. {% endif %}
  87. </div>
  88. {% endblock %}