Skip to content

Commit

Permalink
various: fix some display problems
Browse files Browse the repository at this point in the history
* Fixes aqcquisition receipt without identifier.
* Closes: rero/rero-ils#3732
* Displays authorized access point for places and topics.
* Closes: rero/rero-ils#3770
* Fixes RERO data without idendifiedBy.
* Closes: rero/rero-ils#3763

Co-Authored-by: Peter Weber <[email protected]>
  • Loading branch information
rerowep committed Dec 3, 2024
1 parent 0c6ae55 commit 10ffa43
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,19 @@ <h1 class="mb-0" *ngVar="icon($any(record).metadata.type) as icon">
}
}
<!-- IDENTIFIED BY -->
@if (identifiedByFilter($any(record).metadata[source].identifiedBy).length > 0) {
<dt translate>Identified by</dt>
<dd>
<ul>
@for (identifiedBy of identifiedByFilter($any(record).metadata[source].identifiedBy); track identifiedBy) {
<li>
<a href="{{ identifiedBy.value }}" title="{{ identifiedBy.value }}" target="_blank">{{ identifiedBy.source }}</a>
</li>
}
</ul>
</dd>
@if ($any(record).metadata[source].identifiedBy?.length) {
@if (identifiedByFilter($any(record).metadata[source].identifiedBy).length > 0) {
<dt translate>Identified by</dt>
<dd>
<ul>
@for (identifiedBy of identifiedByFilter($any(record).metadata[source].identifiedBy); track identifiedBy) {
<li>
<a class="rero-ils-external-link" href="{{ identifiedBy.value }}" title="{{ identifiedBy.value }}" target="_blank">{{ identifiedBy.source }}</a>
</li>
}
</ul>
</dd>
}
}
<dt translate>Id</dt>
<dd>{{ $any(record).metadata[source].pid }}</dd>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<!-- AUTHORIZED ACCESS POINT -->
@if (record.authorized_access_point) {
<dt translate>Authorized access point</dt>
<dd>{{ record.authorized_access_point }}</dd>
}

<!-- DATE OF ESTABLISHMENT -->
@if (record.date_of_establishment) {
<dt translate>Date of establishment</dt>
Expand Down Expand Up @@ -42,11 +48,6 @@
<dd>{{ 'country_' + record.country_associated | translate }}</dd>
}

<!-- AUTHORIZED ACCESS POINT -->
@if (record.authorized_access_point) {
<dt translate>Authorized access point</dt>
<dd>{{ record.authorized_access_point }}</dd>
}
<!-- VARIANT NAME -->
@if (record.variant_access_point) {
<dt translate>Variant name</dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<!-- AUTHORIZED ACCESS POINT -->
@if (record.authorized_access_point) {
<dt translate>Authorized access point</dt>
<dd>{{ record.authorized_access_point }}</dd>
}
<!-- DATE OF BIRTH -->
@if (record.date_of_birth) {
<dt translate>Birth date</dt>
Expand Down Expand Up @@ -62,8 +67,3 @@
</ul>
</dd>
}
<!-- AUTHORIZED ACCESS POINT -->
@if (record.authorized_access_point) {
<dt translate>Authorized access point</dt>
<dd>{{ record.authorized_access_point }}</dd>
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<!-- AUTHORIZED ACCESS POINT(S) -->
@if (record.authorized_access_point) {
<dt translate>Authorized access point</dt>
<dd>{{ record.authorized_access_point }}</dd>
}
<!-- BNF TYPE -->
@if (record.bnf_type) {
<dt translate>Type</dt>
Expand Down Expand Up @@ -86,29 +91,39 @@
</ul>
</dd>
}
<!-- EXACT MATCH -->
@if (record.exactMatch) {
<ng-container
[ngTemplateOutlet]="match"
[ngTemplateOutletContext]="{ item: {match: exactMatch, title: 'Exact match' | translate } }"
></ng-container>
}
<!-- CLOSE MATCH -->
@if (record.closeMatch) {
<dt translate>Close match</dt>
<dd>
<ul>
@for (closeMatch of record.closeMatch; track closeMatch) {
<li>
{{ closeMatch.source }}: {{ closeMatch.authorized_access_point }}
</li>
}
</ul>
</dd>
<ng-container
[ngTemplateOutlet]="match"
[ngTemplateOutletContext]="{ item: {match: closeMatch, title: 'Close match' | translate } }"
></ng-container>
}
<!-- EXACT MATCH -->
@if (record.exactMatch) {
<dt translate>Exact match</dt>

<ng-template #match let-item="item">
<dt translate>{{ item.title }}</dt>
<dd>
<ul>
@for (exactMatch of record.exactMatch; track exactMatch) {
<li>
{{ exactMatch.source }}: {{ exactMatch.authorized_access_point }}
</li>
@if (item.match) {
@for(match of item.match; track match) {
<li>
{{ match.source }}:
@if (match.uri) {
<a class="rero-ils-external-link" href="{{ match.uri }}" title="{{ match.uri }}" target="_blank">
{{ match.authorized_access_point }}
</a>
} @else {
{{ match.authorized_access_point }}
}
</li>
}
}
</ul>
</dd>
}
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,39 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

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;
});
}
}
2 changes: 1 addition & 1 deletion projects/shared/src/lib/pipe/identifiedby-label.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any> = types
const identifiers: Array<any> = (types && identifiedBy?.length)
? identifiedBy.filter(identifier => types.includes(identifier.type))
: identifiedBy;
return identifiers
Expand Down

0 comments on commit 10ffa43

Please sign in to comment.