IcingaServiceTable: show apply rule preview
This commit is contained in:
parent
fd1bc38609
commit
cf67917542
|
@ -94,12 +94,23 @@ class IcingaServiceTable extends QuickTable
|
||||||
|
|
||||||
protected function appliedOnes($id)
|
protected function appliedOnes($id)
|
||||||
{
|
{
|
||||||
|
if ($this->connection()->isPgsql()) {
|
||||||
|
$nameCol = "s.object_name || COALESCE(': ' || ARRAY_TO_STRING(ARRAY_AGG("
|
||||||
|
. "a.assign_type || ' where ' || a.filter_string"
|
||||||
|
. " ORDER BY a.assign_type, a.filter_string), ', '), '')";
|
||||||
|
} else {
|
||||||
|
$nameCol = "s.object_name || COALESCE(': ' || GROUP_CONCAT("
|
||||||
|
. "a.assign_type || ' where ' || a.filter_string"
|
||||||
|
. " ORDER BY a.assign_type, a.filter_string SEPARATOR ', '"
|
||||||
|
. "), '')";
|
||||||
|
}
|
||||||
|
|
||||||
$db = $this->connection()->getConnection();
|
$db = $this->connection()->getConnection();
|
||||||
$query = $db->select()->from(
|
$query = $db->select()->from(
|
||||||
array('s' => 'icinga_service'),
|
array('s' => 'icinga_service'),
|
||||||
array(
|
array(
|
||||||
'id' => 's.id',
|
'id' => 's.id',
|
||||||
'objectname' => 's.object_name',
|
'objectname' => $nameCol,
|
||||||
)
|
)
|
||||||
)->join(
|
)->join(
|
||||||
array('i' => 'icinga_service_inheritance'),
|
array('i' => 'icinga_service_inheritance'),
|
||||||
|
@ -108,6 +119,12 @@ class IcingaServiceTable extends QuickTable
|
||||||
)->where('i.parent_service_id = ?', $id)
|
)->where('i.parent_service_id = ?', $id)
|
||||||
->where('s.object_type = ?', 'apply');
|
->where('s.object_type = ?', 'apply');
|
||||||
|
|
||||||
|
$query->joinLeft(
|
||||||
|
array('a' => 'icinga_service_assignment'),
|
||||||
|
'a.service_id = s.id',
|
||||||
|
array()
|
||||||
|
)->group('s.id');
|
||||||
|
|
||||||
return $db->fetchPairs($query);
|
return $db->fetchPairs($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue