import {Component, Input} from "@angular/core";
import {EnvProperties} from "../../utils/properties/env-properties";
import {properties} from "../../../../environments/environment";
import {OpenaireEntities} from "../../utils/properties/searchFields";
import {Project} from "../../utils/result-preview/result-preview";
@Component({
selector: 'entity-metadata',
template: `
Open Access Mandate for {{openaireEntities.PUBLICATIONS}} and {{openaireEntities.DATASETS}}
Open Access Mandate for {{openaireEntities.PUBLICATIONS}}
Open Access Mandate for {{openaireEntities.DATASETS}}
{{entityType}}
0">
0" class="uk-text-italic">
{{removeUnknown(types, true).join(' , ')}}
{{year}}
{{startYear}}
{{endYear}}
{{startYear}} - {{endYear}}
From
{{startDate | date: 'dd MMM yyyy'}}
Until
{{endDate | date: 'dd MMM yyyy'}}
{{startDate | date: 'dd MMM yyyy'}}
(Started)
-
{{endDate | date: 'dd MMM yyyy'}}
{{currentDate >= endDate ? '(Ended)' : '(Ending)'}}
{{status}}
{{date | date: 'dd MMM yyyy': 'UTC'}}
Embargo end date: {{embargoEndDate | date: 'dd MMM yyyy'}}
Under curation
0">
{{country}}
0">
{{language}}
0">
{{programmingLanguage}}
0">
{{project.funderShortname ? project.funderShortname : project.funderName}}
| {{ project.acronym ? project.acronym : (project.title.length > 25 ?
project.title.substring(0, 25) + '...' : project.title)}}
({{project.code}})
,
10">...
0">
{{subject}}
{{(i < (subjects.slice(0, 10).length - 1)) ? ", " : ""}}
{{(i == subjects.slice(0, 10).length - 1 && subjects.length > 10) ? "..." : ""}}
{{compatibility.info}}
{{compatibility.name}}
{{compatibility.info}}
{{compatibility.info}} in OpenAIRE
{{compatibility.name}}
{{compatibilityString}}
0">
OpenAIRE Text Mining
Thematic
{{provenanceAction}}
{{relationName}}
`
})
export class EntityMetadataComponent {
@Input() entityType: string;
@Input() types: string[];
@Input() year: string; // search result
@Input() startDate: number; // project landing
@Input() startYear: string; // search result
@Input() endDate: number; // project landing
@Input() endYear: string; // search result
@Input() currentDate: number; // project landing
@Input() status: string; // project landing
@Input() openAccessMandatePublications: boolean // project landing
@Input() openAccessMandateDatasets: boolean // project landing
@Input() date: Date;
@Input() embargoEndDate: Date | string;
@Input() underCuration: boolean = false;
@Input() publisher; // showPublisher component
@Input() journal; // showPublisher component
@Input() countries;
@Input() languages;
@Input() programmingLanguages;
@Input() compatibilityString: string;
@Input() compatibility; // data provider landing
@Input() aggregationStatus; // data provider landing
@Input() thematic: boolean; // data provider landing
@Input() type; // data provider landing
@Input() provenanceAction: string; // search result
@Input() relationName: string; // search result
@Input() projects: Project[];
@Input() subjects: string[];
properties: EnvProperties = properties;
public openaireEntities = OpenaireEntities;
public removeUnknown(array: string[], type: boolean = false): string[] {
if (type) {
return this.removeDuplicates(array).filter(value => value.toLowerCase() !== 'unknown');
} else {
return array.filter(value => value.toLowerCase() !== 'unknown');
}
}
public removeDuplicates(array: string[]): string[] {
return array.filter(value => value.toLowerCase() !== this.entityType);
}
public buildCurationTooltip(): string {
let tooltipContent: string = "";
tooltipContent += "
Record in preview
";
tooltipContent += "
Bibliographic record accepted by the system, but not yet processed by
OpenAIRE tools for information quality improvement and de-duplication
";
tooltipContent += "
";
return tooltipContent;
}
}