Skip to content

Commit

Permalink
IcingaServiceSetServiceTable: Change table alias for director branches
Browse files Browse the repository at this point in the history
  • Loading branch information
raviks789 committed Sep 22, 2023
1 parent ca855c6 commit 76509bb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/Director/Web/Table/IcingaServiceSetServiceTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,13 @@ public function prepareQuery()
assert($connection instanceof Db);
$builder = new ServiceSetQueryBuilder($connection, $this->branchUuid);
$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('o.id = hsb.service_id AND hsb.host_id = ?', $hostId),
$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"
Expand Down

0 comments on commit 76509bb

Please sign in to comment.