Skip to content

Commit

Permalink
Fix: Show services added for existing service sets while on director …
Browse files Browse the repository at this point in the history
…branch
  • Loading branch information
raviks789 committed Dec 11, 2024
1 parent 4032d49 commit b766301
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions library/Director/Web/Table/ObjectsTableSetMembers.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,12 @@ protected function prepareQuery()
->where('bos.branch_uuid = ?', $conn->quoteBinary($this->branchUuid->getBytes()));
$query->group('COALESCE(os.uuid, bos.uuid)');
$right->group('COALESCE(os.uuid, bos.uuid)');
$middle = clone($query);
$middle->reset('columns');
if ($conn->isPgsql()) {
// This is ugly, might want to modify the query - even a subselect looks better
$query->group('bos.uuid')->group('os.uuid')->group('os.id')->group('bos.branch_uuid')->group('o.id');
$middle->group('bos.uuid')->group('os.uuid')->group('os.id')->group('bos.branch_uuid')->group('o.id');
$right->group('bos.uuid')->group('os.uuid')->group('os.id')->group('bos.branch_uuid')->group('o.id');
}
$right->joinLeft(
Expand All @@ -212,9 +215,16 @@ protected function prepareQuery()
"bo.{$type}_set = bos.object_name",
[]
)->group(['bo.object_name', 'o.object_name', 'bo.uuid']);
$columns['branch_uuid'] = 'bo.branch_uuid';
$middle->columns($columns)->joinLeft(
['bo' => "branched_icinga_{$type}"],
"bo.{$type}_set = os.object_name",
[]
)->group(['bo.object_name', 'o.object_name', 'bo.uuid', 'bo.imports']);

$query = $this->db()->select()->union([
'l' => new DbSelectParenthesis($query),
'm' => new DbSelectParenthesis($middle),
'r' => new DbSelectParenthesis($right),
]);
$query = $this->db()->select()->from(['u' => $query]);
Expand Down
2 changes: 1 addition & 1 deletion library/Director/Web/Table/ServiceTemplateUsageTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function getSummaryTables(string $templateType, Db $connection)
$templateType,
$connection,
$auth
)
)->setBranchUuid($this->branchUuid)
];
}
}

0 comments on commit b766301

Please sign in to comment.