MonitoraggioTenant/templates/index.html
2025-07-01 18:05:03 +02:00

141 lines
2.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Tenant Disk Usage Dashboard</title>
<style>
:root {
--bg-color: #f5f5f5;
--text-color: #222;
--card-color: white;
}
.dark-mode {
--bg-color: #121212;
--text-color: #eee;
--card-color: #1e1e1e;
}
body {
font-family: Arial, sans-serif;
margin: 2em;
background: var(--bg-color);
color: var(--text-color);
transition: background 0.3s, color 0.3s;
}
h2 {
color: var(--text-color);
}
table {
border-collapse: collapse;
width: 100%;
background: var(--card-color);
}
th, td {
padding: 12px 15px;
border: 1px solid #888;
text-align: left;
}
th {
background-color: #0077cc;
color: white;
}
tr:nth-child(even) {
background-color: rgba(0, 0, 0, 0.05);
}
.ok {
color: limegreen;
font-weight: bold;
}
.exceeded {
color: red;
font-weight: bold;
}
.bar {
height: 16px;
}
.bar-container {
background-color: #ddd;
width: 100%;
height: 16px;
}
.top-controls {
text-align: right;
margin-bottom: 1em;
}
button {
padding: 6px 10px;
font-size: 0.9em;
cursor: pointer;
}
footer {
margin-top: 2em;
font-size: 0.9em;
color: #777;
}
</style>
</head>
<body>
<div class="top-controls">
<button onclick="toggleDarkMode()">🌙 Toggle Dark Mode</button>
</div>
<h2>📊 Tenant Folder Disk Usage</h2>
<table>
<thead>
<tr>
<th>Tenant</th>
<th>Used (GB)</th>
<th>Limit (GB)</th>
<th>Usage %</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for folder, data in results.items() %}
{% set percent = (100 * data.used_gb / data.limit_gb) | round(1) %}
<tr>
<td>{{ folder }}</td>
<td>{{ "%.2f"|format(data.used_gb) }}</td>
<td>{{ "%.2f"|format(data.limit_gb) }}</td>
<td>
<div class="bar-container">
<div class="bar" style="
width: {{ percent if percent < 100 else 100 }}%;
background-color: {{ 'red' if percent > 100 else '#0077cc' }};
"></div>
</div>
{{ percent }}%
</td>
<td class="{{ 'exceeded' if data.exceeded else 'ok' }}">
{{ 'Exceeded' if data.exceeded else 'OK' }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<footer>
Last updated: {{ now }}
</footer>
<script>
function toggleDarkMode() {
document.body.classList.toggle('dark-mode');
}
</script>
</body>
</html>