summaryrefslogtreecommitdiffstats
path: root/library/Director/Web/Table/IcingaServiceSetServiceTable.php
diff options
context:
space:
mode:
Diffstat (limited to 'library/Director/Web/Table/IcingaServiceSetServiceTable.php')
-rw-r--r--library/Director/Web/Table/IcingaServiceSetServiceTable.php31
1 files changed, 24 insertions, 7 deletions
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'),