functions
This commit is contained in:
27
templates/anomalies.html
Normal file
27
templates/anomalies.html
Normal file
@ -0,0 +1,27 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Wykryte anomalie{% endblock %}
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<h2 class="mb-4">Wykryte anomalie</h2>
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Data</th>
|
||||
<th>Urządzenie</th>
|
||||
<th>Opis</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for anomaly in anomalies %}
|
||||
<tr>
|
||||
<td>{{ anomaly.timestamp.strftime('%Y-%m-%d %H:%M:%S') }}</td>
|
||||
<td>{{ anomaly.device.name or anomaly.device.ip if anomaly.device }}</td>
|
||||
<td>{{ anomaly.description }}</td>
|
||||
<td>{{ 'Rozwiązana' if anomaly.resolved else 'Otwarta' }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
@ -6,6 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
{% block extra_head %}{% endblock %}
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
@ -24,17 +25,19 @@
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('devices') }}'">Urządzenia</button>
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('logs') }}'">Logi</button>
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('settings') }}'">Ustawienia</button>
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('reset_password') }}'">Reset hasła</button>
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('update_history') }}'">Historia aktualizacji</button>
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('anomalies') }}'">Anomalie</button>
|
||||
</div>
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('reset_password') }}'">Reset hasła</button>
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('logout') }}'">Wyloguj</button>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="btn-group me-2" role="group">
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('login') }}'">Logowanie</button>
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('register') }}'">Rejestracja</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div class="btn-group me-2" role="group">
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('login') }}'">Logowanie</button>
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('register') }}'">Rejestracja</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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 %}
|
||||
|
27
templates/update_history.html
Normal file
27
templates/update_history.html
Normal file
@ -0,0 +1,27 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Historia aktualizacji{% endblock %}
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<h2 class="mb-4">Historia aktualizacji</h2>
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Data</th>
|
||||
<th>Urządzenie</th>
|
||||
<th>Typ aktualizacji</th>
|
||||
<th>Szczegóły</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for history in histories %}
|
||||
<tr>
|
||||
<td>{{ history.timestamp.strftime('%Y-%m-%d %H:%M:%S') }}</td>
|
||||
<td>{{ history.device.name or history.device.ip }}</td>
|
||||
<td>{{ history.update_type }}</td>
|
||||
<td>{{ history.details }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user