From 85e3e94b2736a3eee90d37b51aa26d54384ffc3d Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 12 Dec 2019 16:59:39 +0100 Subject: [PATCH] ServicesController: Don't show statussummary in compact view --- .../controllers/ServicesController.php | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/application/controllers/ServicesController.php b/application/controllers/ServicesController.php index 22dee0c2..e75b5acd 100644 --- a/application/controllers/ServicesController.php +++ b/application/controllers/ServicesController.php @@ -21,7 +21,11 @@ class ServicesController extends Controller 'host', 'host.state' ]); - $summary = ServicestateSummary::on($db)->with('state'); + + $summary = null; + if (! $this->view->compact) { + $summary = ServicestateSummary::on($db)->with('state'); + } $limitControl = $this->createLimitControl(); $paginationControl = $this->createPaginationControl($services); @@ -39,9 +43,12 @@ class ServicesController extends Controller $filterControl = $this->createFilterControl($services); $this->filter($services); - $this->filter($summary); - - yield $this->export($services, $summary); + if (isset($summary)) { + $this->filter($summary); + yield $this->export($services, $summary); + } else { + yield $this->export($services); + } $serviceList = (new ServiceList($services)) ->setViewMode($viewModeSwitcher->getViewMode()); @@ -54,9 +61,11 @@ class ServicesController extends Controller $this->addContent($serviceList); - $this->addFooter( - (new ServiceStatusBar($summary->first()))->setBaseFilter($this->getFilter()) - ); + if (isset($summary)) { + $this->addFooter( + (new ServiceStatusBar($summary->first()))->setBaseFilter($this->getFilter()) + ); + } $this->setAutorefreshInterval(10); }