changed server load stats

This commit is contained in:
Janis Steiner
2024-10-14 13:12:21 +01:00
parent c7a644a8e4
commit 017c34e2d5
3 changed files with 119 additions and 39 deletions

View File

@@ -75,6 +75,9 @@ async function delete_input(input,action,id,row){
<a class="nav-link" href="debug.php?show=filament_settings" id="filament_settings_tab">Filamenteinstellungen</a>
</li>
<li class="nav-item">
<a class="nav-link" href="debug.php?show=srv_stats" id="srv_stats_tab">Serverstatistiken</a>
</li>
</ul>
<div id="printer_settings" style="display:none">
<h1>Druckerfreigabe erzwingen (falls beim freigeben Fehlermeldungen angezeigt werden)</h1>
@@ -295,9 +298,32 @@ async function delete_input(input,action,id,row){
}
echo("</tbody></table></div></div></div>");
echo("</div>");
?>
</div>
<div id="srv_stats" style="display:none">
<div class="container my-5">
<h1 class="text-center mb-4">Server Stats</h1>
<div id="stats" class="row text-center">
<!-- Stats will be dynamically loaded here via AJAX -->
</div>
</div>
<script>
function refreshStats() {
$.ajax({
url: "/api/server_stats.php", // Load from server_stats.php, which includes auth and stats
method: "GET",
success: function (data) {
$("#stats").html(data);
}
});
}
refreshStats();
setInterval(refreshStats, 1000);
</script>
</div>
<?php
test_queue($link);
?>