66 lines
2.3 KiB
HTML
66 lines
2.3 KiB
HTML
{% extends "base.html" %}
|
||
{% block title %}Logi - Aplikacja Updatera{% endblock %}
|
||
{% block extra_head %}
|
||
<!-- Dołącz styl CSS biblioteki Vanilla‑DataTables -->
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vanilla-datatables@latest/dist/vanilla-dataTables.min.css">
|
||
{% endblock %}
|
||
{% block content %}
|
||
<h2>Logi</h2>
|
||
<!-- Formularz kasowania logów starszych niż podana liczba dni -->
|
||
<div class="mt-4">
|
||
<h4>Usuń logi starsze niż podana liczba dni</h4>
|
||
<form method="POST" action="{{ url_for('clean_logs') }}">
|
||
<div class="mb-3">
|
||
<label for="days" class="form-label">Liczba dni</label>
|
||
<input type="number" class="form-control" name="days" id="days" placeholder="Podaj liczbę dni">
|
||
</div>
|
||
<button type="submit" class="btn btn-danger">Usuń logi</button>
|
||
</form>
|
||
</div>
|
||
<hr>
|
||
<table class="table table-striped" id="logsTable">
|
||
<thead class="table-dark">
|
||
<tr>
|
||
<th>Data i czas</th>
|
||
<th>Urządzenie</th>
|
||
<th>Wiadomość</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for log in logs %}
|
||
<tr>
|
||
<td>{{ log.timestamp.strftime('%Y-%m-%d %H:%M:%S') }}</td>
|
||
<td>
|
||
{% if log.device_id %}
|
||
<a href="{{ url_for('device_detail', device_id=log.device.id) }}">
|
||
{{ log.device.name if log.device.name else "Urządzenie #" ~ log.device.id }}
|
||
</a>
|
||
{% else %}
|
||
Ogólne
|
||
{% endif %}
|
||
</td>
|
||
<td><pre style="white-space: pre-wrap;">{{ log.message }}</pre></td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
{% endblock %}
|
||
{% block extra_scripts %}
|
||
<!-- Dołącz skrypt biblioteki Vanilla‑DataTables -->
|
||
<script src="https://cdn.jsdelivr.net/npm/vanilla-datatables@latest/dist/vanilla-dataTables.min.js"></script>
|
||
<script>
|
||
// Inicjalizacja Vanilla‑DataTables dla tabeli logów
|
||
const dataTable = new DataTable("#logsTable", {
|
||
searchable: true,
|
||
sortable: true,
|
||
perPage: 10,
|
||
labels: {
|
||
placeholder: "Szukaj...", // placeholder dla pola wyszukiwania
|
||
perPage: "{select} wpisów na stronę", // etykieta przy wyborze liczby wierszy
|
||
noRows: "Brak logów.", // komunikat, gdy tabela jest pusta
|
||
info: "Wyświetlono {start} - {end} z {rows} logów" // tekst z informacją o paginacji
|
||
}
|
||
});
|
||
</script>
|
||
{% endblock %}
|