IcingaServiceTable: remove host-related services

This commit is contained in:
Thomas Gelf 2016-03-18 13:02:45 +01:00
parent dae5fe621e
commit 89ac089677
1 changed files with 8 additions and 12 deletions

View File

@ -4,19 +4,17 @@ namespace Icinga\Module\Director\Tables;
use Icinga\Module\Director\Web\Table\IcingaObjectTable; use Icinga\Module\Director\Web\Table\IcingaObjectTable;
// TODO: quickform once apply has been moved elsewhere
class IcingaServiceTable extends IcingaObjectTable class IcingaServiceTable extends IcingaObjectTable
{ {
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',
'host_id' => 's.host_id',
'host' => 'h.object_name',
'service' => 's.object_name', 'service' => 's.object_name',
'object_type' => 's.object_type', 'object_type' => 's.object_type',
); );
@ -24,13 +22,12 @@ class IcingaServiceTable extends IcingaObjectTable
protected function getActionUrl($row) protected function getActionUrl($row)
{ {
// TODO: Remove once we got a separate apply table
if ($row->object_type === 'apply') { if ($row->object_type === 'apply') {
$params['id'] = $row->id; $params['id'] = $row->id;
} else { } else {
$params = array('name' => $row->service); $params = array('name' => $row->service);
if ($row->host !== null) {
$params['host'] = $row->host;
}
} }
return $this->url('director/service', $params); return $this->url('director/service', $params);
@ -41,7 +38,6 @@ class IcingaServiceTable extends IcingaObjectTable
$view = $this->view(); $view = $this->view();
return array( return array(
'service' => $view->translate('Servicename'), 'service' => $view->translate('Servicename'),
'host' => $view->translate('Host'),
); );
} }
@ -51,10 +47,6 @@ class IcingaServiceTable extends IcingaObjectTable
$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;
@ -62,6 +54,10 @@ class IcingaServiceTable extends IcingaObjectTable
public function getBaseQuery() public function getBaseQuery()
{ {
return $this->getUnfilteredQuery(); // TODO: remove apply
return $this->getUnfilteredQuery()->where(
's.object_type IN (?)',
array('template', 'apply')
);
} }
} }