setTitle($this->translate('Comment')); $name = $this->params->shiftRequired('name'); $query = Comment::on($this->getDb())->with([ 'host', 'host.state', 'service', 'service.state', 'service.host', 'service.host.state' ]); $query->getSelectBase() ->where(['comment.name = ?' => $name]); $this->applyMonitoringRestriction($query); $comment = $query->first(); if ($comment === null) { throw new NotFoundError($this->translate('Comment not found')); } $this->comment = $comment; } public function indexAction() { $this->addControl((new CommentList([$this->comment]))->setViewMode('minimal')->setCaptionDisabled()); $this->addContent(new CommentDetail($this->comment)); $this->setAutorefreshInterval(10); } protected function fetchCommandTargets() { return [$this->comment]; } protected function getCommandTargetsUrl() { return Links::comment($this->comment); } }