diff --git a/extensions/Servers/Proxmox/Livewire/Statistics.php b/extensions/Servers/Proxmox/Livewire/Statistics.php index 9de9d690a..7842e2e52 100644 --- a/extensions/Servers/Proxmox/Livewire/Statistics.php +++ b/extensions/Servers/Proxmox/Livewire/Statistics.php @@ -152,23 +152,25 @@ class Statistics extends Component { parent::mount($server); $this->server->loadMissing('ipAddresses'); - // Network Analysis is loaded lazily via JavaScript to improve page load speed - // Initialize error state if not configured to prevent infinite loading - if (!$this->coreRouterEnabled()) { - $this->networkAnalysis['error'] = 'Core Router API is not configured.'; - $this->networkAnalysis['connections'] = []; - $this->networkAnalysis['topConnections'] = []; - $this->networkAnalysis['topPorts'] = []; - $this->networkAnalysis['security'] = []; - } - // Preload graph data on mount to speed up initial display - // Dispatch individual chart events for more reliable parallel loading - // Each chart loads independently so a failure in one doesn't block others - $this->dispatch('proxmox:stats:cpu'); - $this->dispatch('proxmox:stats:memory'); - $this->dispatch('proxmox:stats:network'); - $this->dispatch('proxmox:stats:disk'); + // Data loading is deferred to loadInitialData() which is triggered via wire:init + // This ensures JavaScript charts are fully initialized before data events are dispatched + } + + /** + * Load all initial data for the statistics page. + * Called via wire:init to ensure JavaScript is ready to receive the data. + */ + public function loadInitialData(): void + { + // Fetch graph data - each dispatch includes the actual data for JavaScript charts + $this->fetchGraphData('cpu', $this->cpuTimeRange, $this->cpuAggregation); + $this->fetchGraphData('memory', $this->memoryTimeRange, $this->memoryAggregation); + $this->fetchGraphData('network', $this->networkTimeRange, $this->networkAggregation); + $this->fetchGraphData('disk', $this->diskTimeRange, $this->diskAggregation); + + // Load Network Analysis + $this->loadNetworkAnalysis(); } #[On('proxmox:stats')] diff --git a/extensions/Servers/Proxmox/views/overview.blade.php b/extensions/Servers/Proxmox/views/overview.blade.php index 93cc48a74..1731a8a00 100644 --- a/extensions/Servers/Proxmox/views/overview.blade.php +++ b/extensions/Servers/Proxmox/views/overview.blade.php @@ -86,7 +86,7 @@ -
-
@@ -1026,7 +1026,7 @@