mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-27 15:54:03 +02:00
Tables: fix host/service blacklist queries
This commit is contained in:
parent
8073128d0e
commit
35f1f09b84
@ -74,6 +74,10 @@ class IcingaHostAppliedServicesTable extends SimpleQueryBasedTable
|
||||
], $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Icinga\Data\SimpleQuery
|
||||
* @throws \Icinga\Exception\IcingaException
|
||||
*/
|
||||
public function prepareQuery()
|
||||
{
|
||||
$services = [];
|
||||
@ -94,6 +98,10 @@ class IcingaHostAppliedServicesTable extends SimpleQueryBasedTable
|
||||
]);
|
||||
}
|
||||
|
||||
/***
|
||||
* @return array
|
||||
* @throws \Icinga\Exception\IcingaException
|
||||
*/
|
||||
protected function getAllApplyRules()
|
||||
{
|
||||
if ($this->allApplyRules === null) {
|
||||
@ -106,6 +114,10 @@ class IcingaHostAppliedServicesTable extends SimpleQueryBasedTable
|
||||
return $this->allApplyRules;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws \Icinga\Exception\IcingaException
|
||||
*/
|
||||
protected function fetchAllApplyRules()
|
||||
{
|
||||
$db = $this->db;
|
||||
@ -119,7 +131,7 @@ class IcingaHostAppliedServicesTable extends SimpleQueryBasedTable
|
||||
]
|
||||
)->joinLeft(
|
||||
['hsb' => 'icinga_host_service_blacklist'],
|
||||
's.id = hsb.service_id',
|
||||
$db->quoteInto('s.id = hsb.service_id AND hsb.host_id = ?', $this->host->get('id')),
|
||||
[]
|
||||
)->group('s.id')->where('object_type = ? AND assign_filter IS NOT NULL', 'apply');
|
||||
|
||||
|
@ -185,7 +185,8 @@ class IcingaServiceSetServiceTable extends ZfQueryBasedTable
|
||||
*/
|
||||
public function prepareQuery()
|
||||
{
|
||||
$query = $this->db()->select()->from(
|
||||
$db = $this->db();
|
||||
$query = $db->select()->from(
|
||||
['s' => 'icinga_service'],
|
||||
[
|
||||
'id' => 's.id',
|
||||
@ -208,7 +209,10 @@ class IcingaServiceSetServiceTable extends ZfQueryBasedTable
|
||||
if ($this->affectedHost) {
|
||||
$query->joinLeft(
|
||||
['hsb' => 'icinga_host_service_blacklist'],
|
||||
's.id = hsb.service_id',
|
||||
$db->quoteInto(
|
||||
's.id = hsb.service_id AND hsb.host_id = ?',
|
||||
$this->affectedHost->get('id')
|
||||
),
|
||||
[]
|
||||
)->group('s.id')->columns([
|
||||
'blacklisted' => "CASE WHEN hsb.service_id IS NULL THEN 'n' ELSE 'y' END",
|
||||
|
Loading…
x
Reference in New Issue
Block a user