128 lines
4.9 KiB
HTML
128 lines
4.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="uk">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Монітор температури Raspberry Pi</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
<meta http-equiv="refresh" content="10">
|
|
<style>
|
|
.sparkline {
|
|
width: 100px;
|
|
height: 30px;
|
|
display: inline-block;
|
|
}
|
|
.status-ok {
|
|
color: #198754;
|
|
}
|
|
.status-error {
|
|
color: #dc3545;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body class="bg-light">
|
|
<div class="container py-4">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h2 class="mb-0">Температура системи</h2>
|
|
<a href="/graphs" class="btn btn-primary">Переглянути детальні графіки →</a>
|
|
</div>
|
|
|
|
<div class="card mb-4">
|
|
<div class="card-body">
|
|
<div class="text-muted small mb-3 text-end">
|
|
Оновлено: {{ current_time }}
|
|
(автоматичне оновлення кожні 10 секунд)
|
|
</div>
|
|
|
|
<div class="table-responsive">
|
|
<table class="table table-hover">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>IP-адреса</th>
|
|
<th>Hostname</th>
|
|
<th>Температура GPU</th>
|
|
<th>Температура CPU</th>
|
|
<th>Графік GPU</th>
|
|
<th>Графік CPU</th>
|
|
<th>Статус</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for temp in temperatures %}
|
|
<tr>
|
|
<td>{{ temp.name }}</td>
|
|
<td>{{ temp.hostname }}</td>
|
|
<td>{% if temp.value is string %}{{ temp.value }}{% else %}{{ temp.value }}°C{% endif %}</td>
|
|
<td>{% if temp.cpu is string %}{{ temp.cpu }}{% else %}{{ temp.cpu }}°C{% endif %}</td>
|
|
<td><canvas class="sparkline" id="gpu-{{ loop.index }}"></canvas></td>
|
|
<td><canvas class="sparkline" id="cpu-{{ loop.index }}"></canvas></td>
|
|
<td class="{% if temp.status == 'OK' %}status-ok{% else %}status-error{% endif %}">
|
|
{{ temp.status }}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script>
|
|
function createSparkline(elementId, data, labels, color) {
|
|
const ctx = document.getElementById(elementId).getContext('2d');
|
|
new Chart(ctx, {
|
|
type: 'line',
|
|
data: {
|
|
labels: labels,
|
|
datasets: [{
|
|
data: data,
|
|
borderColor: color,
|
|
borderWidth: 1,
|
|
fill: false,
|
|
pointRadius: 0
|
|
}]
|
|
},
|
|
options: {
|
|
responsive: true,
|
|
maintainAspectRatio: false,
|
|
plugins: {
|
|
legend: {
|
|
display: false
|
|
}
|
|
},
|
|
scales: {
|
|
x: {
|
|
display: false
|
|
},
|
|
y: {
|
|
display: false
|
|
}
|
|
},
|
|
animation: false
|
|
}
|
|
});
|
|
}
|
|
|
|
{% for temp in temperatures %}
|
|
{% if temp.history is defined %}
|
|
createSparkline(
|
|
'gpu-{{ loop.index }}',
|
|
{{ temp.history.gpu | tojson }},
|
|
{{ temp.history.timestamps | tojson }},
|
|
'#FF6B6B'
|
|
);
|
|
createSparkline(
|
|
'cpu-{{ loop.index }}',
|
|
{{ temp.history.cpu | tojson }},
|
|
{{ temp.history.timestamps | tojson }},
|
|
'#4ECDC4'
|
|
);
|
|
{% endif %}
|
|
{% endfor %}
|
|
</script>
|
|
</body>
|
|
</html>
|