From bc668706811ae961a85600de64a785742bc0b8c9 Mon Sep 17 00:00:00 2001 From: boban Date: Thu, 23 Apr 2026 02:06:14 +0200 Subject: [PATCH] =?UTF-8?q?Feature:=20Pagination=20f=C3=BCr=20Quarant?= =?UTF-8?q?=C3=A4ne=20und=20Mail-Queue=20(25=20pro=20Seite)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Quarantäne und Queue zeigen je 25 Einträge pro Seite - Pagination-Bar mit Seitenanzeige (X-Y von Z) und Blätter-Buttons - Seite wird bei Filter- oder Suchwechsel auf 1 zurückgesetzt - Quarantäne: rows-Select entfernt (API holt intern 500, UI paginiert) - CSS-Klassen mq-pagination, mq-pag-btn passend zum Dark-Design Co-Authored-By: Claude Sonnet 4.6 --- app/Livewire/Ui/Nx/Mail/QuarantineList.php | 22 +++++++++++++++--- app/Livewire/Ui/Nx/Mail/QueueList.php | 23 ++++++++++++++++--- resources/css/app.css | 9 ++++++++ .../ui/nx/mail/quarantine-list.blade.php | 23 ++++++++++++++----- .../livewire/ui/nx/mail/queue-list.blade.php | 16 +++++++++++++ 5 files changed, 81 insertions(+), 12 deletions(-) diff --git a/app/Livewire/Ui/Nx/Mail/QuarantineList.php b/app/Livewire/Ui/Nx/Mail/QuarantineList.php index 424ffec..7ce82f9 100644 --- a/app/Livewire/Ui/Nx/Mail/QuarantineList.php +++ b/app/Livewire/Ui/Nx/Mail/QuarantineList.php @@ -18,12 +18,18 @@ class QuarantineList extends Component #[Url(as: 'q', keep: true)] public string $search = ''; - #[Url(as: 'rows', keep: true)] - public int $rows = 200; + #[Url(as: 'page', keep: true)] + public int $page = 1; + + public int $perPage = 25; + public int $rows = 500; #[On('quarantine:updated')] public function refresh(): void {} + public function updatedFilter(): void { $this->page = 1; } + public function updatedSearch(): void { $this->page = 1; } + public function openMessage(string $msgId): void { $this->dispatch('openModal', @@ -61,7 +67,17 @@ class QuarantineList extends Component )); } - return view('livewire.ui.nx.mail.quarantine-list', compact('messages', 'counts')); + $total = count($messages); + $totalPages = max(1, (int) ceil($total / $this->perPage)); + $this->page = max(1, min($this->page, $totalPages)); + $paged = array_slice($messages, ($this->page - 1) * $this->perPage, $this->perPage); + + return view('livewire.ui.nx.mail.quarantine-list', [ + 'messages' => $paged, + 'counts' => $counts, + 'total' => $total, + 'totalPages' => $totalPages, + ]); } // ── helpers ────────────────────────────────────────────────────────────── diff --git a/app/Livewire/Ui/Nx/Mail/QueueList.php b/app/Livewire/Ui/Nx/Mail/QueueList.php index 3ec0714..f2281bd 100644 --- a/app/Livewire/Ui/Nx/Mail/QueueList.php +++ b/app/Livewire/Ui/Nx/Mail/QueueList.php @@ -18,12 +18,19 @@ class QueueList extends Component #[Url(as: 'q', keep: true)] public string $search = ''; - public array $selected = []; - public bool $selectAll = false; + #[Url(as: 'page', keep: true)] + public int $page = 1; + + public int $perPage = 25; + public array $selected = []; + public bool $selectAll = false; #[On('queue:updated')] public function refresh(): void {} + public function updatedFilter(): void { $this->page = 1; $this->selected = []; $this->selectAll = false; } + public function updatedSearch(): void { $this->page = 1; } + public function updatedSelectAll(bool $val): void { $messages = $this->fetchQueue(); @@ -89,7 +96,17 @@ class QueueList extends Component )); } - return view('livewire.ui.nx.mail.queue-list', compact('messages', 'counts')); + $total = count($messages); + $totalPages = max(1, (int) ceil($total / $this->perPage)); + $this->page = max(1, min($this->page, $totalPages)); + $paged = array_slice($messages, ($this->page - 1) * $this->perPage, $this->perPage); + + return view('livewire.ui.nx.mail.queue-list', [ + 'messages' => $paged, + 'counts' => $counts, + 'total' => $total, + 'totalPages' => $totalPages, + ]); } // ── helpers ────────────────────────────────────────────────────────────── diff --git a/resources/css/app.css b/resources/css/app.css index 1217ef4..20b1721 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -2168,3 +2168,12 @@ textarea.sec-input { height: auto; line-height: 1.55; padding: 8px 10px; resize: .audit-level.error { border-color: rgba(239,68,68,.3); background: rgba(239,68,68,.08); color: #fca5a5; } .audit-level.critical { border-color: rgba(239,68,68,.5); background: rgba(239,68,68,.15); color: #f87171; font-weight: 700; } .audit-msg { color: var(--mw-t2); min-width: 0; word-break: break-word; line-height: 1.55; font-family: ui-monospace,monospace; font-size: 11.5px; } + +/* ── Pagination (Queue / Quarantine) ────────────────────────────── */ +.mq-pagination { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--mw-b2); } +.mq-pag-info { font-size: 11.5px; color: var(--mw-t4); } +.mq-pag-btns { display: flex; align-items: center; gap: 4px; } +.mq-pag-btn { display: flex; align-items: center; justify-content: center; min-width: 28px; height: 26px; padding: 0 6px; border-radius: 5px; border: 1px solid var(--mw-b2); background: transparent; color: var(--mw-t3); font-size: 12px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; } +.mq-pag-btn:hover:not(:disabled) { background: var(--mw-bg3); color: var(--mw-t1); } +.mq-pag-btn.active { background: rgba(124,58,237,.2); border-color: rgba(124,58,237,.5); color: #c4b5fd; } +.mq-pag-btn:disabled { opacity: .35; cursor: default; } diff --git a/resources/views/livewire/ui/nx/mail/quarantine-list.blade.php b/resources/views/livewire/ui/nx/mail/quarantine-list.blade.php index 6cd8437..52df16c 100644 --- a/resources/views/livewire/ui/nx/mail/quarantine-list.blade.php +++ b/resources/views/livewire/ui/nx/mail/quarantine-list.blade.php @@ -8,18 +8,13 @@ Quarantäne {{ $counts['all'] }} - Rspamd · letzte {{ count($messages) }} Einträge + Rspamd · {{ $total }} Einträge
-
@@ -104,6 +99,22 @@ +@if($totalPages > 1) +
+ {{ ($page - 1) * $perPage + 1 }}–{{ min($page * $perPage, $total) }} von {{ $total }} +
+ + @for($i = max(1, $page - 2); $i <= min($totalPages, $page + 2); $i++) + + @endfor + +
+
+@endif @elseif($counts['all'] === 0)
diff --git a/resources/views/livewire/ui/nx/mail/queue-list.blade.php b/resources/views/livewire/ui/nx/mail/queue-list.blade.php index de218c2..58ad88e 100644 --- a/resources/views/livewire/ui/nx/mail/queue-list.blade.php +++ b/resources/views/livewire/ui/nx/mail/queue-list.blade.php @@ -92,6 +92,22 @@
+@if($totalPages > 1) +
+ {{ ($page - 1) * $perPage + 1 }}–{{ min($page * $perPage, $total) }} von {{ $total }} +
+ + @for($i = max(1, $page - 2); $i <= min($totalPages, $page + 2); $i++) + + @endfor + +
+
+@endif @else