let's support also entities without spec.type
Signed-off-by: Jan Vilimek <jan.vilimek@oriflame.com>
This commit is contained in:
@@ -162,17 +162,15 @@ export const OwnershipCard = ({
|
||||
|
||||
const counts = ownedEntitiesList.reduce(
|
||||
(acc: EntityTypeProps[], ownedEntity) => {
|
||||
if (typeof ownedEntity.spec?.type !== 'string') return acc;
|
||||
|
||||
const match = acc.find(
|
||||
x => x.kind === ownedEntity.kind && x.type === ownedEntity.spec?.type,
|
||||
x => x.kind === ownedEntity.kind && x.type === (ownedEntity.spec?.type ?? ownedEntity.kind),
|
||||
);
|
||||
if (match) {
|
||||
match.count += 1;
|
||||
} else {
|
||||
acc.push({
|
||||
kind: ownedEntity.kind,
|
||||
type: ownedEntity.spec?.type,
|
||||
type: ownedEntity.spec?.type?.toString() ?? ownedEntity.kind,
|
||||
count: 1,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user