Change port pagination default to 32 (#16131)

* Change port pagination default to 32
that way this includes all ports for most switches.
Most port counts are base 2, so change pagination options to match

* ignore upstream missing closure type

* Fix style again

* more
This commit is contained in:
Tony Murray
2024-06-17 09:09:33 -05:00
committed by GitHub
parent 097d4a3f94
commit 592ea1c263
3 changed files with 60 additions and 5 deletions

View File

@@ -41,7 +41,7 @@ use LibreNMS\Interfaces\UI\DeviceTab;
class PortsController implements DeviceTab
{
private bool $detail = false;
private int|string $perPage = 15;
private int|string $perPage = 32;
private string $sortOrder = 'asc';
private string $sortColumn = 'default';
@@ -116,7 +116,7 @@ class PortsController implements DeviceTab
/** @var Collection<Port>|LengthAwarePaginator<Port> $ports */
$ports = $this->getFilteredPortsQuery($device, $request, $relationships)
->paginate(fn ($total) => $this->perPage == 'all' ? $total : (int) $this->perPage)
->paginate(fn ($total) => $this->perPage == 'all' ? $total : (int) $this->perPage) // @phpstan-ignore-line missing closure type
->appends('perPage', $this->perPage);
$data = [
@@ -332,7 +332,7 @@ class PortsController implements DeviceTab
private function getFilteredPortsQuery(Device $device, Request $request, array $relationships = []): Builder
{
$this->perPage = $request->input('perPage', 15);
$this->perPage = $request->input('perPage', 32);
$this->sortOrder = $request->input('order', 'asc');
$this->sortColumn = $request->input('sort', 'default');