39 lines
1.1 KiB
Plaintext
39 lines
1.1 KiB
Plaintext
@model Watcher.ViewModels.DashboardViewModel
|
|
@{
|
|
ViewData["Title"] = "Dashboard";
|
|
}
|
|
|
|
<head>
|
|
<link rel="stylesheet" href="~/css/site.css" />
|
|
</head>
|
|
<h1 class="mb-4">
|
|
<i class="bi bi-speedometer2 me-2"></i>Dashboard
|
|
</h1>
|
|
|
|
<div id="dashboard-stats">
|
|
@await Html.PartialAsync("_DashboardStats", Model)
|
|
</div>
|
|
|
|
@section Scripts {
|
|
<script>
|
|
async function loadDashboardStats() {
|
|
try {
|
|
const response = await fetch('/Home/DashboardStats');
|
|
if (response.ok) {
|
|
console.log("reload")
|
|
const html = await response.text();
|
|
document.getElementById('dashboard-stats').innerHTML = html;
|
|
} else {
|
|
console.error('Fehler beim Nachladen der Dashboard-Statistiken');
|
|
}
|
|
} catch (err) {
|
|
console.error('Netzwerkfehler beim Nachladen der Dashboard-Statistiken:', err);
|
|
}
|
|
}
|
|
|
|
// Initial laden und dann alle 30 Sekunden
|
|
loadDashboardStats();
|
|
setInterval(loadDashboardStats, 30000);
|
|
</script>
|
|
}
|