|
|
{% extends "admin/base.html" %} |
|
|
|
|
|
{% block title %}Logs des Tâches{% endblock %} |
|
|
{% block page_title %}Logs des Tâches{% endblock %} |
|
|
|
|
|
{% block content %} |
|
|
<div class="space-y-6"> |
|
|
|
|
|
<div class="flex justify-between items-center"> |
|
|
<h3 class="text-lg font-semibold text-white">Historique des Exécutions</h3> |
|
|
<a href="{{ url_for('admin_tasks.list_tasks') }}" class="px-4 py-2 bg-gray-700 hover:bg-gray-600 text-white rounded-lg text-sm"> |
|
|
<i class="fas fa-arrow-left mr-2"></i>Retour aux Tâches |
|
|
</a> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="bg-gray-800 rounded-lg border border-gray-700"> |
|
|
<div class="overflow-x-auto"> |
|
|
<table class="w-full text-left"> |
|
|
<thead class="bg-gray-700/50"> |
|
|
<tr> |
|
|
<th class="px-6 py-3 text-sm font-medium text-gray-300">Date</th> |
|
|
<th class="px-6 py-3 text-sm font-medium text-gray-300">Tâche</th> |
|
|
<th class="px-6 py-3 text-sm font-medium text-gray-300">Statut</th> |
|
|
<th class="px-6 py-3 text-sm font-medium text-gray-300">Durée</th> |
|
|
<th class="px-6 py-3 text-sm font-medium text-gray-300">Serveur</th> |
|
|
<th class="px-6 py-3 text-sm font-medium text-gray-300">Détails</th> |
|
|
</tr> |
|
|
</thead> |
|
|
<tbody class="divide-y divide-gray-700"> |
|
|
{% for log in logs.items %} |
|
|
<tr class="hover:bg-gray-700/30"> |
|
|
<td class="px-6 py-4 text-sm text-gray-300"> |
|
|
{{ log.started_at.strftime('%d/%m/%Y %H:%M:%S') }} |
|
|
</td> |
|
|
<td class="px-6 py-4 text-sm font-medium text-white"> |
|
|
{{ log.task_name }} |
|
|
</td> |
|
|
<td class="px-6 py-4"> |
|
|
{% if log.status == 'success' %} |
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-500/20 text-green-400"> |
|
|
<i class="fas fa-check mr-1"></i> Succès |
|
|
</span> |
|
|
{% elif log.status == 'failed' %} |
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-500/20 text-red-400"> |
|
|
<i class="fas fa-times mr-1"></i> Échec |
|
|
</span> |
|
|
{% else %} |
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-500/20 text-blue-400"> |
|
|
<i class="fas fa-spinner fa-spin mr-1"></i> En cours |
|
|
</span> |
|
|
{% endif %} |
|
|
</td> |
|
|
<td class="px-6 py-4 text-sm text-gray-300"> |
|
|
{% if log.completed_at %} |
|
|
{% set duration = (log.completed_at - log.started_at).total_seconds() // 60 %} |
|
|
{% if duration > 0 %} |
|
|
{{ duration|int }} min |
|
|
{% else %} |
|
|
{{ ((log.completed_at - log.started_at).total_seconds())|int }} s |
|
|
{% endif %} |
|
|
{% else %} |
|
|
- |
|
|
{% endif %} |
|
|
</td> |
|
|
<td class="px-6 py-4 text-sm text-gray-400"> |
|
|
{{ log.server_hostname or 'N/A' }} |
|
|
<br><span class="text-xs">PID: {{ log.process_id or 'N/A' }}</span> |
|
|
</td> |
|
|
<td class="px-6 py-4 text-sm text-gray-300"> |
|
|
{% if log.error_message %} |
|
|
<div class="max-w-xs"> |
|
|
<p class="text-red-400 text-xs truncate">{{ log.error_message[:100] }}</p> |
|
|
</div> |
|
|
{% elif log.output_log %} |
|
|
<div class="max-w-xs"> |
|
|
<p class="text-xs text-gray-400 truncate">{{ log.output_log[:100] }}</p> |
|
|
</div> |
|
|
{% else %} |
|
|
<span class="text-gray-500">-</span> |
|
|
{% endif %} |
|
|
</td> |
|
|
</tr> |
|
|
{% if log.error_message or log.output_log %} |
|
|
<tr class="bg-gray-700/20"> |
|
|
<td colspan="6" class="px-6 py-3"> |
|
|
{% if log.error_message %} |
|
|
<div class="mb-2"> |
|
|
<p class="text-xs font-semibold text-red-400 mb-1">Erreur:</p> |
|
|
<pre class="text-xs text-red-300 bg-red-900/20 p-2 rounded overflow-x-auto">{{ log.error_message }}</pre> |
|
|
</div> |
|
|
{% endif %} |
|
|
{% if log.output_log %} |
|
|
<div> |
|
|
<p class="text-xs font-semibold text-gray-400 mb-1">Sortie:</p> |
|
|
<pre class="text-xs text-gray-300 bg-gray-700/50 p-2 rounded overflow-x-auto max-h-40 overflow-y-auto">{{ log.output_log }}</pre> |
|
|
</div> |
|
|
{% endif %} |
|
|
</td> |
|
|
</tr> |
|
|
{% endif %} |
|
|
{% endfor %} |
|
|
</tbody> |
|
|
</table> |
|
|
</div> |
|
|
|
|
|
|
|
|
{% if logs.pages > 1 %} |
|
|
<div class="px-6 py-4 border-t border-gray-700 flex justify-between items-center"> |
|
|
<p class="text-sm text-gray-400"> |
|
|
Page {{ logs.page }} sur {{ logs.pages }} |
|
|
</p> |
|
|
<div class="flex space-x-2"> |
|
|
{% if logs.has_prev %} |
|
|
<a href="{{ url_for('admin_tasks.view_logs', page=logs.prev_num) }}" class="px-3 py-1 bg-gray-700 hover:bg-gray-600 text-white rounded text-sm"> |
|
|
<i class="fas fa-chevron-left"></i> Précédent |
|
|
</a> |
|
|
{% endif %} |
|
|
{% if logs.has_next %} |
|
|
<a href="{{ url_for('admin_tasks.view_logs', page=logs.next_num) }}" class="px-3 py-1 bg-gray-700 hover:bg-gray-600 text-white rounded text-sm"> |
|
|
Suivant <i class="fas fa-chevron-right"></i> |
|
|
</a> |
|
|
{% endif %} |
|
|
</div> |
|
|
</div> |
|
|
{% endif %} |
|
|
</div> |
|
|
</div> |
|
|
{% endblock %} |
|
|
|