setTitle($this->translate('Host Groups')); $compact = $this->view->compact; $db = $this->getDb(); $hostgroups = Hostgroupsummary::on($db); $limitControl = $this->createLimitControl(); $paginationControl = $this->createPaginationControl($hostgroups); $sortControl = $this->createSortControl( $hostgroups, [ 'display_name' => $this->translate('Name'), 'hosts_severity desc' => $this->translate('Severity'), 'hosts_total desc' => $this->translate('Total Hosts'), 'services_total desc' => $this->translate('Total Services') ] ); $filterControl = $this->createFilterControl($hostgroups); $this->filter($hostgroups); $hostgroups->peekAhead($compact); yield $this->export($hostgroups); $this->addControl($paginationControl); $this->addControl($sortControl); $this->addControl($limitControl); $this->addControl($filterControl); $results = $hostgroups->execute(); $this->addContent( (new HostgroupList($results))->setBaseFilter($this->getFilter()) ); if ($compact) { $this->addContent( (new ShowMore($results, Url::fromRequest()->without(['view', 'limit']))) ->setAttribute('data-base-target', '_next') ->setAttribute('title', sprintf( $this->translate('Show all %d hostgroups'), $hostgroups->count() )) ); } $this->setAutorefreshInterval(30); } }