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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user