diff --git a/application/tables/IcingaServiceTable.php b/application/tables/IcingaServiceTable.php index 222120d3..433dc12a 100644 --- a/application/tables/IcingaServiceTable.php +++ b/application/tables/IcingaServiceTable.php @@ -23,6 +23,11 @@ class IcingaServiceTable extends QuickTable ); } + protected function listTableClasses() + { + return array_merge(array('assignment-table'), parent::listTableClasses()); + } + protected function getActionUrl($row) { // TODO: Remove once we got a separate apply table @@ -33,7 +38,55 @@ class IcingaServiceTable extends QuickTable } - return $this->url('director/service/edit', $params); + return $this->url('director/service', $params); + } + + protected function renderRow($row) + { + $v = $this->view(); + $extra = $this->appliedOnes($row->id); + $htm = " getRowClassesString($row) . ">\n"; + $htm .= '' . $v->qlink($row->service, $this->getActionUrl($row)); + if (empty($extra)) { + if ($row->check_command_id) { + $htm .= ' ' . $v->qlink( + 'Create apply-rule', + 'director/service/add', + array('apply' => $row->service), + array('class' => 'icon-plus') + ); + } + + } else { + $htm .= '. Related apply rules: '; + foreach ($extra as $service) { + $href = $v->url('director/service', array('id' => $service->id)); + $htm .= ""; + + try { + $prettyFilter = AssignRenderer::forFilter( + Filter::fromQueryString($service->assign_filter) + )->renderAssign(); + } + catch (IcingaException $e) { + // ignore errors in filter rendering + $prettyFilter = 'Error in Filter rendering: ' . $e->getMessage(); + } + + $htm .= "'; + $htm .= ''; + $htm .= ''; + } + $htm .= '
" . $service->object_name . '' . $prettyFilter . '
'; + $htm .= $v->qlink( + 'Add more', + 'director/service/add', + array('apply' => $row->service), + array('class' => 'icon-plus') + ); + } + $htm .= ''; + return $htm . " \n"; } public function getTitles()