From e6d4dfc040bbe3cb80a2ce65b82493b557f751fc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 15:17:48 +0200 Subject: Merging upstream version 1.11.1. Signed-off-by: Daniel Baumann --- .../Web/Table/IcingaServiceSetServiceTable.php | 31 +++++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'library/Director/Web/Table/IcingaServiceSetServiceTable.php') diff --git a/library/Director/Web/Table/IcingaServiceSetServiceTable.php b/library/Director/Web/Table/IcingaServiceSetServiceTable.php index c205e66..2c3dbc4 100644 --- a/library/Director/Web/Table/IcingaServiceSetServiceTable.php +++ b/library/Director/Web/Table/IcingaServiceSetServiceTable.php @@ -12,6 +12,7 @@ use Icinga\Module\Director\Objects\IcingaServiceSet; use gipfl\IcingaWeb2\Link; use gipfl\IcingaWeb2\Table\ZfQueryBasedTable; use gipfl\IcingaWeb2\Url; +use Ramsey\Uuid\Uuid; class IcingaServiceSetServiceTable extends ZfQueryBasedTable { @@ -122,9 +123,12 @@ class IcingaServiceSetServiceTable extends ZfQueryBasedTable ]; $url = 'director/host/servicesetservice'; } else { + if (is_resource($row->uuid)) { + $row->uuid =stream_get_contents($row->uuid); + } + $params = [ - 'name' => $row->service, - 'set' => $row->service_set + 'uuid' => Uuid::fromBytes($row->uuid)->toString(), ]; $url = 'director/service'; } @@ -194,14 +198,28 @@ class IcingaServiceSetServiceTable extends ZfQueryBasedTable $connection = $this->connection(); assert($connection instanceof Db); $builder = new ServiceSetQueryBuilder($connection, $this->branchUuid); - return $builder->selectServicesForSet($this->set)->limit(100); + $query = $builder->selectServicesForSet($this->set); + $alias = $this->branchUuid ? 'u' : 'o'; + + if ($this->affectedHost) { + if ($hostId = $this->affectedHost->get('id')) { + $query->joinLeft( + ['hsb' => 'icinga_host_service_blacklist'], + $this->db()->quoteInto("$alias.id = hsb.service_id AND hsb.host_id = ?", $hostId), + [] + )->columns([ + 'blacklisted' => "CASE WHEN hsb.service_id IS NULL THEN 'n' ELSE 'y' END" + ]); + } + } + + return $query->limit(100); } protected function createFakeRemoveLinkForReadonlyView() { return Html::tag('span', [ - 'class' => 'icon-paste', - 'style' => 'float: right; font-weight: normal', + 'class' => ['icon-paste', 'seviceset-obj-link'], ], $this->host->getObjectName()); } @@ -209,8 +227,7 @@ class IcingaServiceSetServiceTable extends ZfQueryBasedTable { $hostname = $host->getObjectName(); return Link::create($hostname, 'director/host/services', ['name' => $hostname], [ - 'class' => 'icon-paste', - 'style' => 'float: right; font-weight: normal', + 'class' => ['icon-paste', 'seviceset-obj-link'], 'data-base-target' => '_next', 'title' => sprintf( $this->translate('This set has been inherited from %s'), -- cgit v1.2.3