From 505912135dd8ae728e0d6b8147beb6e423e97a12 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 16 Jul 2018 09:19:53 +0200 Subject: [PATCH] HostServices: mark disabled services fixes #1548 --- .../Web/Table/IcingaHostAppliedServicesTable.php | 12 +++++++++--- .../Director/Web/Table/IcingaHostServiceTable.php | 11 ++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/library/Director/Web/Table/IcingaHostAppliedServicesTable.php b/library/Director/Web/Table/IcingaHostAppliedServicesTable.php index 850bce4c..b5ae54f3 100644 --- a/library/Director/Web/Table/IcingaHostAppliedServicesTable.php +++ b/library/Director/Web/Table/IcingaHostAppliedServicesTable.php @@ -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( diff --git a/library/Director/Web/Table/IcingaHostServiceTable.php b/library/Director/Web/Table/IcingaHostServiceTable.php index b489d881..3631a74e 100644 --- a/library/Director/Web/Table/IcingaHostServiceTable.php +++ b/library/Director/Web/Table/IcingaHostServiceTable.php @@ -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" ]