assertRouteAccess('hostgroups'); $this->setTitle(t('Host Group')); $name = $this->params->getRequired('name'); $query = Hostgroupsummary::on($this->getDb()); foreach ($query->getUnions() as $unionPart) { $unionPart->filter(Filter::equal('hostgroup.name', $name)); } $this->applyRestrictions($query); $hostgroup = $query->first(); if ($hostgroup === null) { throw new NotFoundError(t('Host group not found')); } $this->hostgroup = $hostgroup; } public function indexAction() { $db = $this->getDb(); $hosts = Host::on($db)->with(['state', 'state.last_comment', 'icon_image'])->utilize('hostgroup'); $hosts->getSelectBase()->where(['host_hostgroup.id = ?' => $this->hostgroup->id]); $this->applyRestrictions($hosts); $limitControl = $this->createLimitControl(); $paginationControl = $this->createPaginationControl($hosts); $viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl); $hostList = (new HostList($hosts)) ->setViewMode($viewModeSwitcher->getViewMode()); yield $this->export($hosts); $this->addControl((new HostgroupList([$this->hostgroup])) ->setViewMode('minimal') ->setDetailActionsDisabled() ->setNoSubjectLink()); $this->addControl($paginationControl); $this->addControl($viewModeSwitcher); $this->addControl($limitControl); $this->addContent($hostList); $this->setAutorefreshInterval(10); } }