assertRouteAccess('servicegroups'); $this->addTitleTab(t('Service Group')); $name = $this->params->getRequired('name'); $query = ServicegroupSummary::on($this->getDb()); foreach ($query->getUnions() as $unionPart) { $unionPart->filter(Filter::equal('servicegroup.name', $name)); } $this->applyRestrictions($query); $servicegroup = $query->first(); if ($servicegroup === null) { throw new NotFoundError(t('Service group not found')); } $this->servicegroup = $servicegroup; $this->setTitle($servicegroup->display_name); } public function indexAction() { $db = $this->getDb(); $services = Service::on($db)->with([ 'state', 'state.last_comment', 'icon_image', 'host', 'host.state' ]); $services ->setResultSetClass(VolatileStateResults::class) ->filter(Filter::equal('servicegroup.id', $this->servicegroup->id)); $this->applyRestrictions($services); $limitControl = $this->createLimitControl(); $paginationControl = $this->createPaginationControl($services); $viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl); $serviceList = (new ServiceList($services->execute())) ->setViewMode($viewModeSwitcher->getViewMode()); yield $this->export($services); // ICINGAWEB_EXPORT_FORMAT is not set yet and $this->format is inaccessible, yeah... if ($this->getRequest()->getParam('format') === 'pdf') { $this->addContent(new ServicegroupTableRow($this->servicegroup)); $this->addContent(Html::tag('h2', null, t('Services'))); } else { $this->addControl(new ServicegroupTableRow($this->servicegroup)); } $this->addControl($paginationControl); $this->addControl($viewModeSwitcher); $this->addControl($limitControl); $this->addContent($serviceList); $this->setAutorefreshInterval(10); } }