functions

This commit is contained in:
Mateusz Gruszczyński
2025-02-24 10:57:05 +01:00
parent f2d2e56d0d
commit 1e6ca7eb06
5 changed files with 165 additions and 17 deletions

View File

@ -1,5 +1,8 @@
{% extends "base.html" %}
{% block title %}Logi - Aplikacja Updatera{% endblock %}
{% block extra_head %}
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.1/css/jquery.dataTables.min.css">
{% endblock %}
{% block content %}
<h2>Logi</h2>
<!-- Formularz kasowania logów starszych niż podana liczba dni -->
@ -14,7 +17,7 @@
</form>
</div>
<hr>
<table class="table table-striped">
<table class="table table-striped" id="logsTable">
<thead class="table-dark">
<tr>
<th>Data i czas</th>
@ -28,7 +31,9 @@
<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) }}">Urządzenie #{{ log.device_id }}</a>
<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 %}
@ -43,4 +48,17 @@
</tbody>
</table>
<!-- Dodanie bibliotek DataTables i inicjalizacja -->
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.13.1/js/jquery.dataTables.min.js"></script>
<script>
$(document).ready( function () {
$('#logsTable').DataTable({
"order": [[0, "desc"]],
"language": {
"url": "//cdn.datatables.net/plug-ins/1.13.1/i18n/Polish.json"
}
});
});
</script>
{% endblock %}