Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(entity): add identifiedBy on all ressources #1196

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,59 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
@if (record$ | async; as record) {
<h1 class="mb-0" *ngVar="icon($any(record).metadata.type) as icon">
<i class="fa {{ icon.class }}" title="{{ icon.title }}" aria-hidden="true"></i>
{{ $any(record).metadata | extractSourceField : 'authorized_access_point' }}</h1>
<small>
{{ 'MEF ID' | translate }}: {{ $any(record).metadata.pid }}
</small>
<span class="badge badge-warning" translate>Remote</span>
<h1 class="mb-0" *ngVar="icon($any(record).metadata.type) as icon">
<i class="fa {{ icon.class }}" title="{{ icon.title }}" aria-hidden="true"></i>
{{ $any(record).metadata | extractSourceField : 'authorized_access_point' }}</h1>
<small>
{{ 'MEF ID' | translate }}: {{ $any(record).metadata.pid }}
</small>
<span class="badge badge-warning" translate>Remote</span>

<!-- SOURCES -->
@for (source of $any(record).metadata.sources.sort(); track source) {
<article class="card my-2">
<header class="card-header">
<b class="card-title mb-0">
{{ source | translate | uppercase }}
</b>
</header>
<article id="contribution-{{ source }}" class="card-body collapse show">
<!-- SOURCES -->
@for (source of $any(record).metadata.sources.sort(); track source) {
<article class="card my-2">
<header class="card-header">
<b class="card-title mb-0">{{ source | translate | uppercase }}</b>
</header>
<article id="contribution-{{ source }}" class="card-body collapse show">
<dl class="entity-fields">
@switch ($any(record).metadata.type) {
@case (entityType.PERSON) {
<admin-remote-entities-person-detail-view [record]="$any(record).metadata[source]" [source]="source"></admin-remote-entities-person-detail-view>
<admin-remote-entities-person-detail-view [record]="$any(record).metadata[source]" [source]="source" />
}
@case (entityType.ORGANISATION) {
<admin-remote-entities-organisation-detail-view [record]="$any(record).metadata[source]" [source]="source"></admin-remote-entities-organisation-detail-view>
<admin-remote-entities-organisation-detail-view [record]="$any(record).metadata[source]" [source]="source" />
}
@case (entityType.TOPIC) {
<admin-remote-topic-detail-view [record]="$any(record).metadata[source]" [source]="source"></admin-remote-topic-detail-view>
<admin-remote-topic-detail-view [record]="$any(record).metadata[source]" [source]="source" />
}
@case (entityType.PLACE) {
<admin-remote-topic-detail-view [record]="$any(record).metadata[source]" [source]="source"></admin-remote-topic-detail-view>
<admin-remote-topic-detail-view [record]="$any(record).metadata[source]" [source]="source" />
}
@case (entityType.TEMPORAL) {
<admin-remote-topic-detail-view [record]="$any(record).metadata[source]" [source]="source"></admin-remote-topic-detail-view>
<admin-remote-topic-detail-view [record]="$any(record).metadata[source]" [source]="source" />
}
@default {
{{ 'Missing template for this entity type:' | translate }} {{ $any(record).metadata.type }}
}
}
</article>
<!-- 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>
}
<dt translate>Id</dt>
<dd>{{ $any(record).metadata[source].pid }}</dd>
</dl>
</article>
}
</article>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,8 @@ export class RemoteEntitiesDetailViewComponent implements DetailRecord {
};
}
}

identifiedByFilter(identifiedBy: any[]): any[] {
return identifiedBy.filter((el: any) => el.source !== 'RERO' && el.type === 'uri');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,59 +15,46 @@
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/>.
-->
<dl class="entity-fields">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove the <dl></dl>?

<!-- DATE OF ESTABLISHMENT -->
@if (record.date_of_establishment) {
<dt translate>Date of establishment</dt>
<dd>{{ record.date_of_establishment }}</dd>
}
<!-- DATE OF TERMINATION -->
@if (record.date_of_termination) {
<dt translate>Date of termination</dt>
<dd>{{ record.date_of_termination }}</dd>
}
<!-- LANGUAGE -->
@if (record.language) {
<dt translate>Language</dt>
<dd>
<ul>
@for (language of record.language; track language) {
<li>{{ ('lang_' + language) | translate }}</li>
}
</ul>
</dd>
}
<!-- COUNTRY ASSOCIATED -->
@if (record.country_associated) {
<dt translate>Country associated</dt>
<dd>{{ 'country_' + record.country_associated | translate }}</dd>
}
<!-- DATE OF ESTABLISHMENT -->
@if (record.date_of_establishment) {
<dt translate>Date of establishment</dt>
<dd>{{ record.date_of_establishment }}</dd>
}
<!-- DATE OF TERMINATION -->
@if (record.date_of_termination) {
<dt translate>Date of termination</dt>
<dd>{{ record.date_of_termination }}</dd>
}
<!-- LANGUAGE -->
@if (record.language) {
<dt translate>Language</dt>
<dd>
<ul>
@for (language of record.language; track language) {
<li>{{ ('lang_' + language) | translate }}</li>
}
</ul>
</dd>
}
<!-- COUNTRY ASSOCIATED -->
@if (record.country_associated) {
<dt translate>Country associated</dt>
<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>
<dd>
<ul>
@for (variant_name of record.variant_access_point; track variant_name) {
<li>{{ variant_name }}</li>
}
</ul>
</dd>
}
<!-- ID -->
@if (record.identifier) {
<dt translate>Id</dt>
<dd>
@if (disabledLink(source)) {
<a [href]="record.identifier | safeUrl">{{ record.pid }}</a>
} @else {
{{ record.pid }}
<!-- 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>
<dd>
<ul>
@for (variant_name of record.variant_access_point; track variant_name) {
<li>{{ variant_name }}</li>
}
</dd>
}
</dl>
</ul>
</dd>
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,68 +15,55 @@
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/>.
-->
<dl class="entity-fields">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as previous

<!-- DATE OF BIRTH -->
@if (record.date_of_birth) {
<dt translate>Birth date</dt>
<dd>{{ record.date_of_birth }}</dd>
}
<!-- DATE OF DEATH -->
@if (record.date_of_death) {
<dt translate>Death date</dt>
<dd>{{ record.date_of_death }}</dd>
}
<!-- LANGUAGE -->
@if (record.language) {
<dt translate>Language</dt>
<dd>
<ul>
@for (language of record.language; track language) {
<li>{{ ('lang_' + language) | translate }}</li>
}
</ul>
</dd>
}
<!-- GENDER -->
@if (record.Gender) {
<dt translate>Gender</dt>
<dd>{{ record.Gender }}</dd>
}
<!-- BIBLIOGRAPHICAL INFORMATION -->
@if (record.biographical_information) {
<dt translate>Biographical information</dt>
<dd [innerHtml]="record.biographical_information.join('\n') | urlActive | nl2br"></dd>
}
<!-- NAME -->
@if (record.name) {
<dt translate>Name</dt>
<dd>{{ record.name }}</dd>
}
<!-- VARIANT ACCESS POINT -->
@if (record.variant_access_point) {
<dt translate>Variant name</dt>
<dd>
<ul>
@for (variant_name of record.variant_access_point; track variant_name) {
<li>{{ variant_name }}</li>
}
</ul>
</dd>
}
<!-- AUTHORIZED ACCESS POINT -->
@if (record.authorized_access_point) {
<dt translate>Authorized access point</dt>
<dd>{{ record.authorized_access_point }}</dd>
}
<!-- ID -->
@if (record.identifier) {
<dt translate>Id</dt>
<dd>
@if (disabledLink(source)) {
<a href="{{ record.identifier }}">{{ record.pid }}</a>
} @else {
{{ record.pid }}
<!-- DATE OF BIRTH -->
@if (record.date_of_birth) {
<dt translate>Birth date</dt>
<dd>{{ record.date_of_birth }}</dd>
}
<!-- DATE OF DEATH -->
@if (record.date_of_death) {
<dt translate>Death date</dt>
<dd>{{ record.date_of_death }}</dd>
}
<!-- LANGUAGE -->
@if (record.language) {
<dt translate>Language</dt>
<dd>
<ul>
@for (language of record.language; track language) {
<li>{{ ('lang_' + language) | translate }}</li>
}
</dd>
}
</dl>
</ul>
</dd>
}
<!-- GENDER -->
@if (record.Gender) {
<dt translate>Gender</dt>
<dd>{{ record.Gender }}</dd>
}
<!-- BIBLIOGRAPHICAL INFORMATION -->
@if (record.biographical_information) {
<dt translate>Biographical information</dt>
<dd [innerHtml]="record.biographical_information.join('\n') | urlActive | nl2br"></dd>
}
<!-- NAME -->
@if (record.name) {
<dt translate>Name</dt>
<dd>{{ record.name }}</dd>
}
<!-- VARIANT ACCESS POINT -->
@if (record.variant_access_point) {
<dt translate>Variant name</dt>
<dd>
<ul>
@for (variant_name of record.variant_access_point; track variant_name) {
<li>{{ variant_name }}</li>
}
</ul>
</dd>
}
<!-- AUTHORIZED ACCESS POINT -->
@if (record.authorized_access_point) {
<dt translate>Authorized access point</dt>
<dd>{{ record.authorized_access_point }}</dd>
}
Loading
Loading