diff --git a/src/app/+item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.html b/src/app/+item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.html
index 7a4461b03b..5583de5fd5 100644
--- a/src/app/+item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.html
+++ b/src/app/+item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.html
@@ -22,5 +22,5 @@
{{"item.edit.relationships.no-relationships" | translate}}
-
+
diff --git a/src/app/+item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts b/src/app/+item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts
index 59b4730018..4fb8cd0539 100644
--- a/src/app/+item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts
+++ b/src/app/+item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts
@@ -94,10 +94,18 @@ export class EditRelationshipListComponent implements OnInit {
*/
public getRelationshipMessageKey(): Observable {
- return this.getLabel().pipe(
- map((label) => {
- if (hasValue(label) && label.indexOf('Of') > -1) {
- return `relationships.${label.substring(0, label.indexOf('Of') + 2)}`
+ return observableCombineLatest(
+ this.getLabel(),
+ this.relatedEntityType$,
+ ).pipe(
+ map(([label, relatedEntityType]) => {
+ if (hasValue(label) && label.indexOf('is') > -1 && label.indexOf('Of') > -1) {
+ const relationshipLabel = `${label.substring(2, label.indexOf('Of'))}`;
+ if (relationshipLabel !== relatedEntityType.label) {
+ return `relationships.is${relationshipLabel}Of.${relatedEntityType.label}`
+ } else {
+ return `relationships.is${relationshipLabel}Of`
+ }
} else {
return label;
}
@@ -192,18 +200,21 @@ export class EditRelationshipListComponent implements OnInit {
this.selectableListService.deselectAll(this.listId);
this.updates$.pipe(
- switchMap((updates) => observableCombineLatest(
- Object.values(updates)
- .filter((update) => update.changeType !== FieldChangeType.REMOVE)
- .map((update) => {
- const field = update.field as RelationshipIdentifiable;
- if (field.relationship) {
- return this.getRelatedItem(field.relationship);
- } else {
- return of(field.relatedItem);
- }
- })
- )),
+ switchMap((updates) =>
+ Object.values(updates).length > 0 ?
+ observableCombineLatest(
+ Object.values(updates)
+ .filter((update) => update.changeType !== FieldChangeType.REMOVE)
+ .map((update) => {
+ const field = update.field as RelationshipIdentifiable;
+ if (field.relationship) {
+ return this.getRelatedItem(field.relationship);
+ } else {
+ return of(field.relatedItem);
+ }
+ })
+ ) : of([])
+ ),
take(1),
map((items) => items.map((item) => {
const searchResult = new ItemSearchResult();
@@ -254,7 +265,6 @@ export class EditRelationshipListComponent implements OnInit {
}
ngOnInit(): void {
- this.listId = 'edit-relationship-' + this.itemType.id;
this.relatedEntityType$ =
observableCombineLatest([
@@ -267,6 +277,12 @@ export class EditRelationshipListComponent implements OnInit {
map((relatedTypes) => relatedTypes.find((relatedType) => relatedType.uuid !== this.itemType.uuid)),
);
+ this.relatedEntityType$.pipe(
+ take(1)
+ ).subscribe(
+ (relatedEntityType) => this.listId = `edit-relationship-${this.itemType.id}-${relatedEntityType.id}`
+ );
+
this.updates$ = this.getItemRelationships().pipe(
switchMap((relationships) =>
observableCombineLatest(
@@ -274,15 +290,15 @@ export class EditRelationshipListComponent implements OnInit {
).pipe(
defaultIfEmpty([]),
map((isLeftItemArray) => isLeftItemArray.map((isLeftItem, index) => {
- const relationship = relationships[index];
- const nameVariant = isLeftItem ? relationship.rightwardValue : relationship.leftwardValue;
- return {
- uuid: relationship.id,
- type: this.relationshipType,
- relationship,
- nameVariant,
- } as RelationshipIdentifiable
- })),
+ const relationship = relationships[index];
+ const nameVariant = isLeftItem ? relationship.rightwardValue : relationship.leftwardValue;
+ return {
+ uuid: relationship.id,
+ type: this.relationshipType,
+ relationship,
+ nameVariant,
+ } as RelationshipIdentifiable
+ })),
)),
switchMap((initialFields) => this.objectUpdatesService.getFieldUpdates(this.url, initialFields).pipe(
map((fieldUpdates) => {
diff --git a/src/app/core/data/object-updates/object-updates.service.ts b/src/app/core/data/object-updates/object-updates.service.ts
index 8bd32e54e2..9370e4f610 100644
--- a/src/app/core/data/object-updates/object-updates.service.ts
+++ b/src/app/core/data/object-updates/object-updates.service.ts
@@ -129,7 +129,7 @@ export class ObjectUpdatesService {
*/
getFieldUpdatesExclusive(url: string, initialFields: Identifiable[]): Observable {
const objectUpdates = this.getObjectEntry(url);
- return objectUpdates.pipe(isNotEmptyOperator(), map((objectEntry) => {
+ return objectUpdates.pipe(map((objectEntry) => {
const fieldUpdates: FieldUpdates = {};
for (const object of initialFields) {
let fieldUpdate = objectEntry.fieldUpdates[object.uuid];
diff --git a/src/app/shared/object-collection/shared/listable-object/listable-object-component-loader.component.ts b/src/app/shared/object-collection/shared/listable-object/listable-object-component-loader.component.ts
index 694a3477f9..4525c9d5e0 100644
--- a/src/app/shared/object-collection/shared/listable-object/listable-object-component-loader.component.ts
+++ b/src/app/shared/object-collection/shared/listable-object/listable-object-component-loader.component.ts
@@ -51,6 +51,9 @@ export class ListableObjectComponentLoaderComponent implements OnInit {
*/
@Input() showLabel = true;
+ /**
+ * The value to display for this element
+ */
@Input() value: string;
/**
diff --git a/src/app/shared/object-collection/shared/object-collection-element/abstract-listable-element.component.ts b/src/app/shared/object-collection/shared/object-collection-element/abstract-listable-element.component.ts
index c8bd02e096..2c944b92ce 100644
--- a/src/app/shared/object-collection/shared/object-collection-element/abstract-listable-element.component.ts
+++ b/src/app/shared/object-collection/shared/object-collection-element/abstract-listable-element.component.ts
@@ -24,6 +24,9 @@ export class AbstractListableElementComponent {
*/
@Input() listID: string;
+ /**
+ * The value to display for this element
+ */
@Input() value: string;
/**
diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5
index 701c14c115..59d1e8afb0 100644
--- a/src/assets/i18n/en.json5
+++ b/src/assets/i18n/en.json5
@@ -2537,6 +2537,10 @@
"relationships.isAuthorOf": "Authors",
+ "relationships.isAuthorOf.Person": "Authors (persons)",
+
+ "relationships.isAuthorOf.OrgUnit": "Authors (organizational units)",
+
"relationships.isIssueOf": "Journal Issues",
"relationships.isJournalIssueOf": "Journal Issue",