refactor: remove loading overlay and event handling for server statistics to streamline the loading process

This commit is contained in:
2025-12-01 08:22:29 -05:00
parent 555ccb8496
commit 06d5183e4b

View File

@@ -2,41 +2,7 @@
@once
<script src="https://cdn.jsdelivr.net/npm/apexcharts" onload="window.apexChartsLoaded = true"></script>
@endonce
<div
class="relative flex flex-col gap-6 overflow-hidden"
x-data="{ pageLoading: true }"
x-init="
(function () {
var timeoutId = setTimeout(function () {
pageLoading = false;
}, 8000);
function handleLoaded() {
try {
clearTimeout(timeoutId);
} catch (e) {}
pageLoading = false;
document.removeEventListener('proxmox:all-stats-loaded', handleLoaded);
}
document.addEventListener('proxmox:all-stats-loaded', handleLoaded);
})()
"
>
<!-- Full-page blur overlay while initial stats load -->
<div
x-show="pageLoading"
x-transition.opacity
class="absolute inset-0 z-40 flex items-center justify-center bg-background/80 backdrop-blur-sm"
>
<div class="flex flex-col items-center gap-3 text-base/70">
<svg class="animate-spin h-8 w-8 text-primary" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
<p class="text-sm font-semibold">Loading server statistics…</p>
</div>
</div>
<div class="flex flex-col gap-6">
<style>
.formRight select {
background-color: hsl(var(--color-background));
@@ -4334,9 +4300,6 @@
if (allExpectedChartsHaveData) {
console.log('All expected charts have received data – stopping stats retries.');
try {
document.dispatchEvent(new CustomEvent('proxmox:all-stats-loaded'));
} catch (e) {}
return;
}