setTitle($this->translate('Service Group')); $name = $this->params->shiftRequired('name'); $query = ServicegroupSummary::on($this->getDb()); FilterProcessor::apply( new FilterExpression('servicegroup.name', '=', $name), $query ); $this->applyMonitoringRestriction($query); $servicegroup = $query->first(); if ($servicegroup === null) { throw new NotFoundError($this->translate('Service group not found')); } $this->servicegroup = $servicegroup; } public function indexAction() { $this->addControl((new ServicegroupList([$this->servicegroup]))); $db = $this->getDb(); $services = Service::on($db)->with([ 'state', 'host', 'host.state' ]); FilterProcessor::apply( new FilterExpression('servicegroup.id', '=', $this->servicegroup->id), $services ); $this->applyMonitoringRestriction($services); $limitControl = $this->createLimitControl(); $paginationControl = $this->createPaginationControl($services); $viewModeSwitcher = $this->createViewModeSwitcher(); $serviceList = (new ServiceList($services)) ->setViewMode($viewModeSwitcher->getViewMode()); yield $this->export($services); $this->addControl($paginationControl); $this->addControl($viewModeSwitcher); $this->addControl($limitControl); $this->addContent($serviceList); $this->setAutorefreshInterval(10); } }