fix(#20232): load relations to get children of children and fix the display of OwnershipCard with aggregated relations.

Signed-off-by: vdizengremel <victor.dizengremel@octo.com>
This commit is contained in:
vdizengremel
2023-09-29 13:10:02 +02:00
parent b5b00b3af1
commit dc5b6b971b
3 changed files with 15 additions and 1 deletions
@@ -110,6 +110,14 @@ describe('useGetEntities', () => {
);
});
it('given group entity should retrieve child with their relations', async () => {
await whenHookIsCalledWith(givenParentGroupEntity);
expect(catalogApiMock.getEntitiesByRefs).toHaveBeenCalledWith({
entityRefs: [`group:default/${givenLeafGroup}`],
fields: ['kind', 'metadata.namespace', 'metadata.name', 'relations'],
});
});
it('given user entity should aggregate parent ownership and direct', async () => {
await whenHookIsCalledWith(givenUserEntity);
expect(catalogApiMock.getEntities).toHaveBeenCalledWith(
@@ -90,7 +90,7 @@ const getChildOwnershipEntityRefs = async (
if (hasChildGroups) {
const entityRefs = childGroups.map(r => stringifyEntityRef(r));
const childGroupResponse = await catalogApi.getEntitiesByRefs({
fields: ['kind', 'metadata.namespace', 'metadata.name'],
fields: ['kind', 'metadata.namespace', 'metadata.name', 'relations'],
entityRefs,
});
const childGroupEntities = childGroupResponse.items.filter(isEntity);