diff --git a/extensions/Servers/Proxmox/Livewire/Statistics.php b/extensions/Servers/Proxmox/Livewire/Statistics.php index 80e5d2706..9de9d690a 100644 --- a/extensions/Servers/Proxmox/Livewire/Statistics.php +++ b/extensions/Servers/Proxmox/Livewire/Statistics.php @@ -66,6 +66,10 @@ class Statistics extends Component public int $taskHistoryPerPage = 25; public int $taskHistoryCurrentPage = 1; + // Lifecycle Events Pagination + public int $lifecycleEventsPerPage = 25; + public int $lifecycleEventsCurrentPage = 1; + public array $networkAnalysis = [ 'connections' => [], 'topConnections' => [], @@ -704,6 +708,65 @@ class Statistics extends Component { $this->goToTaskHistoryPage($this->taskHistoryCurrentPage + 1); } + + // ========================================== + // Lifecycle Events Pagination Methods + // ========================================== + + /** + * Get paginated lifecycle events for display + */ + public function getPaginatedLifecycleEventsProperty(): array + { + $events = collect($this->chartEvents)->values()->all(); + if (empty($events)) { + return []; + } + $offset = ($this->lifecycleEventsCurrentPage - 1) * $this->lifecycleEventsPerPage; + + return array_slice($events, $offset, $this->lifecycleEventsPerPage); + } + + /** + * Get total pages for lifecycle events + */ + public function getLifecycleEventsTotalPagesProperty(): int + { + $total = count($this->chartEvents); + return max(1, (int) ceil($total / $this->lifecycleEventsPerPage)); + } + + /** + * Reset page to 1 when perPage changes for lifecycle events + */ + public function updatedLifecycleEventsPerPage(): void + { + $this->lifecycleEventsCurrentPage = 1; + } + + /** + * Navigate to a specific page for lifecycle events + */ + public function goToLifecycleEventsPage(int $page): void + { + $this->lifecycleEventsCurrentPage = max(1, min($page, $this->lifecycleEventsTotalPages)); + } + + /** + * Navigate to previous page for lifecycle events + */ + public function previousLifecycleEventsPage(): void + { + $this->goToLifecycleEventsPage($this->lifecycleEventsCurrentPage - 1); + } + + /** + * Navigate to next page for lifecycle events + */ + public function nextLifecycleEventsPage(): void + { + $this->goToLifecycleEventsPage($this->lifecycleEventsCurrentPage + 1); + } /** * Extract IP address from field (handles "IP[port]" and "IP:port" formats) diff --git a/extensions/Servers/Proxmox/views/statistics.blade.php b/extensions/Servers/Proxmox/views/statistics.blade.php index f046dc2fc..31088fc20 100644 --- a/extensions/Servers/Proxmox/views/statistics.blade.php +++ b/extensions/Servers/Proxmox/views/statistics.blade.php @@ -1628,7 +1628,7 @@
- @forelse(collect($this->chartEvents)->take(20) as $index => $event) + @forelse($this->paginatedLifecycleEvents as $index => $event) @php $startTime = isset($event['starttime']) ? \Carbon\Carbon::createFromTimestamp($event['starttime']) : null; $endTime = isset($event['endtime']) && $event['endtime'] > 0 ? \Carbon\Carbon::createFromTimestamp($event['endtime']) : null; @@ -1805,6 +1805,104 @@ @json($lifecycleEventsExportRows) + + @php + $lifecycleTotalCount = count($this->chartEvents); + @endphp + @if($lifecycleTotalCount > 0) +