(Host)ServiceTable: always show blacklist details
It can affect also single services
This commit is contained in:
parent
bd5ad64f02
commit
7efeab674c
|
@ -104,7 +104,6 @@ class IcingaHostServiceTable extends ZfQueryBasedTable
|
|||
|
||||
/**
|
||||
* @return \Zend_Db_Select
|
||||
* @throws \Zend_Db_Select_Exception
|
||||
*/
|
||||
public function prepareQuery()
|
||||
{
|
||||
|
@ -118,32 +117,26 @@ class IcingaHostServiceTable extends ZfQueryBasedTable
|
|||
'host' => 'h.object_name',
|
||||
'service' => 's.object_name',
|
||||
'object_type' => 's.object_type',
|
||||
'blacklisted' => "CASE WHEN hsb.service_id IS NULL THEN 'n' ELSE 'y' END"
|
||||
]
|
||||
)->joinLeft(
|
||||
['h' => 'icinga_host'],
|
||||
'h.id = s.host_id',
|
||||
[]
|
||||
)->joinLeft(
|
||||
['hsb' => 'icinga_host_service_blacklist'],
|
||||
$db->quoteInto(
|
||||
's.id = hsb.service_id AND hsb.host_id = ?',
|
||||
$this->inheritedBy === null
|
||||
? $this->host->get('id')
|
||||
: $this->inheritedBy->get('id')
|
||||
),
|
||||
[]
|
||||
)->where(
|
||||
's.host_id = ?',
|
||||
$this->host->get('id')
|
||||
)->order('s.object_name');
|
||||
|
||||
if ($this->inheritedBy) {
|
||||
$query->joinLeft(
|
||||
['hsb' => 'icinga_host_service_blacklist'],
|
||||
$db->quoteInto(
|
||||
's.id = hsb.service_id AND hsb.host_id = ?',
|
||||
$this->inheritedBy->get('id')
|
||||
),
|
||||
[]
|
||||
);
|
||||
$query->columns([
|
||||
'blacklisted' => "CASE WHEN hsb.service_id IS NULL THEN 'n' ELSE 'y' END"
|
||||
]);
|
||||
} else {
|
||||
$query->columns(['blacklisted' => "('n')"]);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ class ObjectsTableService extends ObjectsTable
|
|||
'hots_object_type' => 'h.object_type',
|
||||
'host_disabled' => 'h.disabled',
|
||||
'id' => 'o.id',
|
||||
'blacklisted' => "CASE WHEN hsb.service_id IS NULL THEN 'n' ELSE 'y' END",
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -68,9 +69,14 @@ class ObjectsTableService extends ObjectsTable
|
|||
static::td($row->object_name)
|
||||
]);
|
||||
|
||||
$attributes = $tr->getAttributes();
|
||||
if ($row->host_disabled === 'y' || $row->disabled === 'y') {
|
||||
$tr->getAttributes()->add('class', 'disabled');
|
||||
$attributes->add('class', 'disabled');
|
||||
}
|
||||
if ($row->blacklisted === 'y') {
|
||||
$attributes->add('class', 'strike-links');
|
||||
}
|
||||
|
||||
return $tr;
|
||||
}
|
||||
|
||||
|
@ -80,6 +86,10 @@ class ObjectsTableService extends ObjectsTable
|
|||
['h' => 'icinga_host'],
|
||||
'o.host_id = h.id',
|
||||
[]
|
||||
)->joinLeft(
|
||||
['hsb' => 'icinga_host_service_blacklist'],
|
||||
'hsb.service_id = o.id AND hsb.host_id = o.host_id',
|
||||
[]
|
||||
)->where('o.service_set_id IS NULL')
|
||||
->order('o.object_name')->order('h.object_name');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue