HostServices: mark disabled services

fixes #1548
This commit is contained in:
Thomas Gelf 2018-07-16 09:19:53 +02:00
parent c7a94f2c39
commit 505912135d
2 changed files with 17 additions and 6 deletions

View File

@ -52,11 +52,15 @@ class IcingaHostAppliedServicesTable extends SimpleQueryBasedTable
public function renderRow($row)
{
$classes = [];
if ($row->blacklisted === 'y') {
$attributes = ['class' => 'strike-links'];
} else {
$attributes = null;
$classes[] = 'strike-links';
}
if ($row->disabled === 'y') {
$classes[] = 'disabled';
}
$attributes = empty($classes) ? null : ['class' => $classes];
return $this::row([
Link::create(
@ -92,6 +96,7 @@ class IcingaHostAppliedServicesTable extends SimpleQueryBasedTable
'id' => 'id',
'name' => 'name',
'filter' => 'filter',
'disabled' => 'disabled',
'blacklisted' => 'blacklisted',
'assign_filter' => 'assign_filter',
]);
@ -124,6 +129,7 @@ class IcingaHostAppliedServicesTable extends SimpleQueryBasedTable
'id' => 's.id',
'name' => 's.object_name',
'assign_filter' => 's.assign_filter',
'disabled' => 's.disabled',
'blacklisted' => "CASE WHEN hsb.service_id IS NULL THEN 'n' ELSE 'y' END",
]
)->joinLeft(

View File

@ -52,11 +52,15 @@ class IcingaHostServiceTable extends ZfQueryBasedTable
public function renderRow($row)
{
$classes = [];
if ($row->blacklisted === 'y') {
$attributes = ['class' => 'strike-links'];
} else {
$attributes = null;
$classes[] = 'strike-links';
}
if ($row->disabled === 'y') {
$classes[] = 'disabled';
}
$attributes = empty($classes) ? null : ['class' => $classes];
return $this::row([
$this->getServiceLink($row)
@ -116,6 +120,7 @@ class IcingaHostServiceTable extends ZfQueryBasedTable
'host_id' => 's.host_id',
'host' => 'h.object_name',
'service' => 's.object_name',
'disabled' => 's.disabled',
'object_type' => 's.object_type',
'blacklisted' => "CASE WHEN hsb.service_id IS NULL THEN 'n' ELSE 'y' END"
]