From a6d65bb37580025b4f5b61316aa3df162c24ee04 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 9 Oct 2019 00:09:18 +0200 Subject: [PATCH] Add limit control to host list --- application/controllers/HostsController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/application/controllers/HostsController.php b/application/controllers/HostsController.php index dfbf8886..45e72081 100644 --- a/application/controllers/HostsController.php +++ b/application/controllers/HostsController.php @@ -2,6 +2,7 @@ namespace Icinga\Module\Eagle\Controllers; +use GuzzleHttp\Psr7\ServerRequest; use Icinga\Module\Eagle\Model\Host; use Icinga\Module\Eagle\Web\Controller; use Icinga\Module\Eagle\Widget\HostList; @@ -15,15 +16,19 @@ class HostsController extends Controller $db = $this->getDb(); $hosts = Host::on($db)->with('state'); - $hosts->limit(25); + // @TODO(el): Looks a bit odd since createLimitControl() also shifts the limit + $hosts->limit($this->params->shift('limit')); $viewModeSwitcher = $this->createViewModeSwitcher(); + $limitControl = $this->createLimitControl(); + $limitControl->handleRequest(ServerRequest::fromGlobals()); $hostList = (new HostList($hosts)) ->setRedis($this->getRedis()) ->setViewMode($viewModeSwitcher->getViewMode()); $this->addControl($viewModeSwitcher); + $this->addControl($limitControl); $this->addContent($hostList); }