From 10ffa432d9c0e004501609b6deae88f43e12166c Mon Sep 17 00:00:00 2001 From: Peter Weber Date: Tue, 19 Nov 2024 14:52:37 +0100 Subject: [PATCH] various: fix some display problems * Fixes aqcquisition receipt without identifier. * Closes: https://github.com/rero/rero-ils/issues/3732 * Displays authorized access point for places and topics. * Closes: https://github.com/rero/rero-ils/issues/3770 * Fixes RERO data without idendifiedBy. * Closes: https://github.com/rero/rero-ils/issues/3763 Co-Authored-by: Peter Weber --- ...entities-remote-detail-view.component.html | 24 +++++---- ...es-organisation-detail-view.component.html | 11 ++-- ...entities-person-detail-view.component.html | 10 ++-- .../remote-topic-detail-view.component.html | 51 ++++++++++++------- .../remote-topic-detail-view.component.ts | 26 +++++++++- .../src/lib/pipe/identifiedby-label.pipe.ts | 2 +- 6 files changed, 82 insertions(+), 42 deletions(-) diff --git a/projects/admin/src/app/record/detail-view/entities-detail-view/remote/entities-remote-detail-view.component.html b/projects/admin/src/app/record/detail-view/entities-detail-view/remote/entities-remote-detail-view.component.html index 1cfe35649..4cb459dea 100644 --- a/projects/admin/src/app/record/detail-view/entities-detail-view/remote/entities-remote-detail-view.component.html +++ b/projects/admin/src/app/record/detail-view/entities-detail-view/remote/entities-remote-detail-view.component.html @@ -53,17 +53,19 @@

} } - @if (identifiedByFilter($any(record).metadata[source].identifiedBy).length > 0) { -
Identified by
-
-
    - @for (identifiedBy of identifiedByFilter($any(record).metadata[source].identifiedBy); track identifiedBy) { -
  • - {{ identifiedBy.source }} -
  • - } -
-
+ @if ($any(record).metadata[source].identifiedBy?.length) { + @if (identifiedByFilter($any(record).metadata[source].identifiedBy).length > 0) { +
Identified by
+
+
    + @for (identifiedBy of identifiedByFilter($any(record).metadata[source].identifiedBy); track identifiedBy) { +
  • + {{ identifiedBy.source }} +
  • + } +
+
+ } }
Id
{{ $any(record).metadata[source].pid }}
diff --git a/projects/admin/src/app/record/detail-view/entities-detail-view/remote/remote-organisation-detail-view/remote-entities-organisation-detail-view.component.html b/projects/admin/src/app/record/detail-view/entities-detail-view/remote/remote-organisation-detail-view/remote-entities-organisation-detail-view.component.html index 50d45850b..f10d16463 100644 --- a/projects/admin/src/app/record/detail-view/entities-detail-view/remote/remote-organisation-detail-view/remote-entities-organisation-detail-view.component.html +++ b/projects/admin/src/app/record/detail-view/entities-detail-view/remote/remote-organisation-detail-view/remote-entities-organisation-detail-view.component.html @@ -15,6 +15,12 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . --> + +@if (record.authorized_access_point) { +
Authorized access point
+
{{ record.authorized_access_point }}
+} + @if (record.date_of_establishment) {
Date of establishment
@@ -42,11 +48,6 @@
{{ 'country_' + record.country_associated | translate }}
} - -@if (record.authorized_access_point) { -
Authorized access point
-
{{ record.authorized_access_point }}
-} @if (record.variant_access_point) {
Variant name
diff --git a/projects/admin/src/app/record/detail-view/entities-detail-view/remote/remote-person-detail-view/remote-entities-person-detail-view.component.html b/projects/admin/src/app/record/detail-view/entities-detail-view/remote/remote-person-detail-view/remote-entities-person-detail-view.component.html index e1a6187dc..69328a0bc 100644 --- a/projects/admin/src/app/record/detail-view/entities-detail-view/remote/remote-person-detail-view/remote-entities-person-detail-view.component.html +++ b/projects/admin/src/app/record/detail-view/entities-detail-view/remote/remote-person-detail-view/remote-entities-person-detail-view.component.html @@ -15,6 +15,11 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . --> + +@if (record.authorized_access_point) { +
Authorized access point
+
{{ record.authorized_access_point }}
+} @if (record.date_of_birth) {
Birth date
@@ -62,8 +67,3 @@ } - -@if (record.authorized_access_point) { -
Authorized access point
-
{{ record.authorized_access_point }}
-} diff --git a/projects/admin/src/app/record/detail-view/entities-detail-view/remote/remote-topic-detail-view/remote-topic-detail-view.component.html b/projects/admin/src/app/record/detail-view/entities-detail-view/remote/remote-topic-detail-view/remote-topic-detail-view.component.html index b8f9603ea..c03beb4c2 100644 --- a/projects/admin/src/app/record/detail-view/entities-detail-view/remote/remote-topic-detail-view/remote-topic-detail-view.component.html +++ b/projects/admin/src/app/record/detail-view/entities-detail-view/remote/remote-topic-detail-view/remote-topic-detail-view.component.html @@ -15,6 +15,11 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . --> + +@if (record.authorized_access_point) { +
Authorized access point
+
{{ record.authorized_access_point }}
+} @if (record.bnf_type) {
Type
@@ -86,29 +91,39 @@ } + +@if (record.exactMatch) { + +} @if (record.closeMatch) { -
Close match
-
-
    - @for (closeMatch of record.closeMatch; track closeMatch) { -
  • - {{ closeMatch.source }}: {{ closeMatch.authorized_access_point }} -
  • - } -
-
+ } - -@if (record.exactMatch) { -
Exact match
+ + +
{{ item.title }}
    - @for (exactMatch of record.exactMatch; track exactMatch) { -
  • - {{ exactMatch.source }}: {{ exactMatch.authorized_access_point }} -
  • + @if (item.match) { + @for(match of item.match; track match) { +
  • + {{ match.source }}: + @if (match.uri) { + + {{ match.authorized_access_point }} + + } @else { + {{ match.authorized_access_point }} + } +
  • + } }
-} +
\ No newline at end of file diff --git a/projects/admin/src/app/record/detail-view/entities-detail-view/remote/remote-topic-detail-view/remote-topic-detail-view.component.ts b/projects/admin/src/app/record/detail-view/entities-detail-view/remote/remote-topic-detail-view/remote-topic-detail-view.component.ts index 81e890bd7..d748beeac 100644 --- a/projects/admin/src/app/record/detail-view/entities-detail-view/remote/remote-topic-detail-view/remote-topic-detail-view.component.ts +++ b/projects/admin/src/app/record/detail-view/entities-detail-view/remote/remote-topic-detail-view/remote-topic-detail-view.component.ts @@ -16,17 +16,39 @@ * along with this program. If not, see . */ -import { Component, Input } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; @Component({ selector: 'admin-remote-topic-detail-view', templateUrl: './remote-topic-detail-view.component.html' }) -export class RemoteTopicDetailViewComponent { +export class RemoteTopicDetailViewComponent implements OnInit{ /** Record metadata */ @Input() record: any; /** Record source */ @Input() source: string; + + exactMatch = []; + closeMatch = []; + + ngOnInit(): void { + this.exactMatch = this.identifiedByUriFilter(this.record.exactMatch); + this.closeMatch = this.identifiedByUriFilter(this.record.closeMatch); + } + identifiedByUriFilter(match: any[]): any[] { + return match?.map((m: any) => { + const element = { + authorized_access_point: m.authorized_access_point, + source: m.source + }; + const uris = m.identifiedBy?.filter((id: any) => id.type === 'uri') || []; + if (uris.length > 0) { + element['uri'] = uris.shift().value; + } + + return element; + }); + } } diff --git a/projects/shared/src/lib/pipe/identifiedby-label.pipe.ts b/projects/shared/src/lib/pipe/identifiedby-label.pipe.ts index 0da0930cc..036abf059 100644 --- a/projects/shared/src/lib/pipe/identifiedby-label.pipe.ts +++ b/projects/shared/src/lib/pipe/identifiedby-label.pipe.ts @@ -35,7 +35,7 @@ export class IdentifiedByLabelPipe implements PipeTransform { * @return the entity label */ transform(identifiedBy: any[], types: string[], separator: string = this._defaultSeparator): string | null { - const identifiers: Array = types + const identifiers: Array = (types && identifiedBy?.length) ? identifiedBy.filter(identifier => types.includes(identifier.type)) : identifiedBy; return identifiers