Use subquery filters for services if appropriate
refs #2934 Signed-off-by: Eric Lippmann <eric.lippmann@icinga.com>
This commit is contained in:
parent
824fa870a2
commit
186ef5a5a7
|
@ -23,6 +23,11 @@ class ServicestatusQuery extends IdoQuery
|
|||
*/
|
||||
protected $groupOrigin = array('hostgroups', 'servicegroups');
|
||||
|
||||
protected $subQueryTargets = array(
|
||||
'hostgroups' => 'hostgroup',
|
||||
'servicegroups' => 'servicegroup'
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -412,4 +417,19 @@ class ServicestatusQuery extends IdoQuery
|
|||
parent::registerGroupColumns($alias, $table, $groupedColumns, $groupedTables);
|
||||
}
|
||||
}
|
||||
|
||||
protected function joinSubQuery(IdoQuery $query, $name)
|
||||
{
|
||||
if ($name === 'hostgroup') {
|
||||
$query->joinVirtualTable('members');
|
||||
|
||||
return ['hgm.host_object_id', 's.host_object_id'];
|
||||
} elseif ($name === 'servicegroup') {
|
||||
$query->joinVirtualTable('members');
|
||||
|
||||
return ['sgm.service_object_id', 'so.object_id'];
|
||||
}
|
||||
|
||||
return parent::joinSubQuery($query, $name);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue