Virtual metadata on item delete - filter relationship types without relationships

This commit is contained in:
Samuel
2020-01-28 15:35:55 +01:00
parent cff3a6f010
commit b352690cca

View File

@@ -107,13 +107,20 @@ export class ItemDeleteComponent
getSucceededRemoteData(), getSucceededRemoteData(),
getRemoteDataPayload(), getRemoteDataPayload(),
map((relationshipTypes) => relationshipTypes.page), map((relationshipTypes) => relationshipTypes.page),
map((types) => types.reduce<RelationshipType[]>((includedTypes, type) => { switchMap((types) =>
if (!includedTypes.some((includedType) => includedType.id === type.id)) { combineLatest(types.map((type) => this.getRelationships(type))).pipe(
return [...includedTypes, type]; map((relationships) =>
} else { types.reduce<RelationshipType[]>((includedTypes, type, index) => {
return includedTypes; if (!includedTypes.some((includedType) => includedType.id === type.id)
} && !(relationships[index].length === 0)) {
}, [])), return [...includedTypes, type];
} else {
return includedTypes;
}
}, [])
),
)
),
); );
this.types$.pipe( this.types$.pipe(