Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Show services added for existing service sets in usage table while on director branch #2943

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 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,20 @@ protected function prepareQuery()
"bo.{$type}_set = bos.object_name",
[]
)->group(['bo.object_name', 'o.object_name', 'bo.uuid']);
$columns['branch_uuid'] = 'bo.branch_uuid';
$columns['id'] = '(NULL)' ;
$middle->columns($columns)->joinLeft(
['bo' => "branched_icinga_{$type}"],
$this->db()->quoteInto(
"bo.{$type}_set = os.object_name AND bo.branch_uuid = ?",
$conn->quoteBinary($this->branchUuid->getBytes())
),
[]
)->group(['bo.object_name', 'o.object_name', 'bo.uuid', 'bo.branch_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)
];
}
}
Loading