2025-10-15 17:41:05 +02:00

49 lines
2.8 KiB
HTML

{% extends 'remotectl/base.html' %}
{% block title %}Logs | Remote Admin{% endblock %}
{% block content %}
<h1 class="text-2xl font-semibold mb-6">Logs</h1>
<div class="overflow-hidden rounded-lg shadow border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800">
<table class="w-full text-sm">
<thead class="bg-gray-50 dark:bg-gray-700/60 text-gray-600 dark:text-gray-300 uppercase text-xs tracking-wide">
<tr>
<th class="px-3 py-2 text-left">Started</th>
<th class="px-3 py-2 text-left">Host</th>
<th class="px-3 py-2 text-left">Type</th>
<th class="px-3 py-2 text-left">Command</th>
<th class="px-3 py-2 text-left">Status</th>
<th class="px-3 py-2 text-left">Exit</th>
<th class="px-3 py-2 text-left">Dur (s)</th>
<th class="px-3 py-2 text-left">User</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100 dark:divide-gray-700">
{% for log in logs %}
<tr class="hover:bg-blue-50 dark:hover:bg-gray-700/60">
<td class="px-3 py-2"><a class="text-blue-600 dark:text-blue-400 hover:underline"
href="/logs/{{ log.id }}/">{{ log.started_at|date:'Y-m-d H:i:s' }}</a></td>
<td class="px-3 py-2">{{ log.host.name }}</td>
<td class="px-3 py-2">{{ log.run_type }}</td>
<td class="px-3 py-2 truncate max-w-xs">{{ log.command|truncatechars:60 }}</td>
<td class="px-3 py-2">
{% with s=log.status %}
{% if s == 'ok' %}<span class="px-2 py-0.5 rounded bg-green-600 text-white text-xs">OK</span>
{% elif s == 'failed' %}<span class="px-2 py-0.5 rounded bg-red-600 text-white text-xs">FAILED{% if log.failed_step %}#{{ log.failed_step }}{% endif %}</span>
{% elif s == 'canceled' %}<span
class="px-2 py-0.5 rounded bg-yellow-500 text-white text-xs">CANCELED</span>
{% elif s == 'error' %}<span class="px-2 py-0.5 rounded bg-pink-600 text-white text-xs">ERROR{% if log.failed_step %}#{{ log.failed_step }}{% endif %}</span>
{% else %}<span class="px-2 py-0.5 rounded bg-blue-600 text-white text-xs">RUNNING</span>{% endif %}
{% endwith %}
</td>
<td class="px-3 py-2">{{ log.exit_code }}</td>
<td class="px-3 py-2">{% if log.finished_at %}{{ log.duration|floatformat:2 }}{% endif %}</td>
<td class="px-3 py-2">{{ log.created_by }}</td>
</tr>
{% empty %}
<tr>
<td colspan="8" class="px-3 py-6 text-center text-gray-500">No logs.</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}