83 lines
3.4 KiB
Twig
83 lines
3.4 KiB
Twig
{% extends 'base.html.twig' %}
|
|
{% block title %}Logs - ServerControl{% endblock %}
|
|
|
|
{% block body %}
|
|
<h1 class="h3 mb-4">Action Logs</h1>
|
|
|
|
<div class="card mb-4">
|
|
<div class="card-body">
|
|
<form method="get" class="row g-3">
|
|
<div class="col-md-3">
|
|
<select class="form-select" name="server">
|
|
<option value="">All servers</option>
|
|
{% for server in servers %}
|
|
<option value="{{ server.id }}" {% if filters.serverId == server.id %}selected{% endif %}>
|
|
{{ server.name }}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
{% if is_granted('ROLE_ADMIN') %}
|
|
<div class="col-md-3">
|
|
<select class="form-select" name="user">
|
|
<option value="">All users</option>
|
|
{% for user in users %}
|
|
<option value="{{ user.id }}" {% if filters.userId == user.id %}selected{% endif %}>
|
|
{{ user.pseudo }}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
{% endif %}
|
|
<div class="col-md-2">
|
|
<input type="date" class="form-control" name="date_from" value="{{ filters.dateFrom ?? '' }}" placeholder="From">
|
|
</div>
|
|
<div class="col-md-2">
|
|
<input type="date" class="form-control" name="date_to" value="{{ filters.dateTo ?? '' }}" placeholder="To">
|
|
</div>
|
|
<div class="col-md-2">
|
|
<button class="btn btn-outline-secondary w-100">Filter</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-body p-0">
|
|
{% if logs|length == 0 %}
|
|
<p class="text-muted p-3">No logs found.</p>
|
|
{% else %}
|
|
<table class="table table-hover mb-0">
|
|
<thead class="table-dark">
|
|
<tr><th>Date</th><th>Server</th><th>Action</th><th>Status</th><th>User</th><th>Output</th></tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for log in logs %}
|
|
<tr>
|
|
<td>{{ log.executedAt|date('d/m/Y H:i:s') }}</td>
|
|
<td>{{ log.server.name }}</td>
|
|
<td><code>{{ log.actionType }}</code></td>
|
|
<td>
|
|
<span class="badge bg-{{ log.status == 'success' ? 'success' : 'danger' }}">{{ log.status }}</span>
|
|
</td>
|
|
<td>{{ log.user ? log.user.pseudo : '<em>deleted</em>'|raw }}</td>
|
|
<td>
|
|
{% if log.output %}
|
|
<button class="btn btn-sm btn-link p-0" data-bs-toggle="collapse"
|
|
data-bs-target="#output-{{ log.id }}">View</button>
|
|
<div class="collapse" id="output-{{ log.id }}">
|
|
<pre class="bg-dark text-white p-2 mt-1 rounded small">{{ log.output }}</pre>
|
|
</div>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
<div class="p-3 d-flex justify-content-center">
|
|
{{ knp_pagination_render(logs) }}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|