IcingaServiceTable: show hosts where available

This commit is contained in:
Thomas Gelf 2015-12-10 12:55:34 +01:00
parent 023e15d057
commit 28ca1b8229
1 changed files with 15 additions and 3 deletions

View File

@ -8,19 +8,26 @@ class IcingaServiceTable extends QuickTable
{ {
protected $searchColumns = array( protected $searchColumns = array(
'service', 'service',
'host'
); );
public function getColumns() public function getColumns()
{ {
return array( return array(
'id' => 's.id', 'id' => 's.id',
'service' => 's.object_name', 'host_id' => 's.host_id',
'host' => 'h.object_name',
'service' => 's.object_name',
); );
} }
protected function getActionUrl($row) protected function getActionUrl($row)
{ {
return $this->url('director/service', array('name' => $row->service)); $params = array('name' => $row->service);
if ($row->host !== null) {
$params['host'] = $row->host;
}
return $this->url('director/service', $params);
} }
public function getTitles() public function getTitles()
@ -28,6 +35,7 @@ class IcingaServiceTable extends QuickTable
$view = $this->view(); $view = $this->view();
return array( return array(
'service' => $view->translate('Servicename'), 'service' => $view->translate('Servicename'),
'host' => $view->translate('Host'),
); );
} }
@ -37,6 +45,10 @@ class IcingaServiceTable extends QuickTable
$query = $db->select()->from( $query = $db->select()->from(
array('s' => 'icinga_service'), array('s' => 'icinga_service'),
array() array()
)->joinLeft(
array('h' => 'icinga_host'),
'h.id = s.host_id',
array()
); );
return $query; return $query;