forked from hazza/dspace-angular
115284: Add repeatable based on relationship max cardinality
This commit is contained in:
@@ -232,6 +232,22 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
return update && update.field ? update.field.uuid : undefined;
|
return update && update.field ? update.field.uuid : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether the current entity can have multiple relationships of this type
|
||||||
|
* This is based on the max cardinality of the relationship
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private isRepeatable(): boolean {
|
||||||
|
const isLeft = this.currentItemIsLeftItem$.getValue();
|
||||||
|
if (isLeft) {
|
||||||
|
const leftMaxCardinality = this.relationshipType.leftMaxCardinality;
|
||||||
|
return hasNoValue(leftMaxCardinality) || leftMaxCardinality > 1;
|
||||||
|
} else {
|
||||||
|
const rightMaxCardinality = this.relationshipType.rightMaxCardinality;
|
||||||
|
return hasNoValue(rightMaxCardinality) || rightMaxCardinality > 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the dynamic lookup modal to search for items to add as relationships
|
* Open the dynamic lookup modal to search for items to add as relationships
|
||||||
*/
|
*/
|
||||||
@@ -249,6 +265,7 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
modalComp.toAdd = [];
|
modalComp.toAdd = [];
|
||||||
modalComp.toRemove = [];
|
modalComp.toRemove = [];
|
||||||
modalComp.isPending = false;
|
modalComp.isPending = false;
|
||||||
|
modalComp.repeatable = this.isRepeatable();
|
||||||
modalComp.hiddenQuery = '-search.resourceid:' + this.item.uuid;
|
modalComp.hiddenQuery = '-search.resourceid:' + this.item.uuid;
|
||||||
|
|
||||||
this.item.owningCollection.pipe(
|
this.item.owningCollection.pipe(
|
||||||
|
Reference in New Issue
Block a user