2023-10-02 11:18:29 +02:00
import { Component , Input , ViewChild } from "@angular/core" ;
2023-02-17 18:40:05 +01:00
import { EnvProperties } from "../../utils/properties/env-properties" ;
import { properties } from "../../../../environments/environment" ;
import { OpenaireEntities } from "../../utils/properties/searchFields" ;
2023-02-20 17:17:30 +01:00
import { Organization , Project } from "../../utils/result-preview/result-preview" ;
2023-05-09 18:04:06 +02:00
import { RouterHelper } from "../../utils/routerHelper.class" ;
2023-02-17 18:40:05 +01:00
@Component ( {
selector : 'entity-metadata' ,
template : `
2023-02-22 13:43:31 +01:00
< div class = "uk-text-xsmall entity-metadata uk-flex-inline uk-flex-wrap uk-text-emphasis" >
2023-02-17 18:40:05 +01:00
<!-- oa -- >
2023-02-22 13:43:31 +01:00
< span class = "uk-flex-inline uk-flex-middle uk-flex-wrap"
* ngIf = "(openAccessMandatePublications != undefined && openAccessMandatePublications) || (openAccessMandateDatasets != undefined && openAccessMandateDatasets)" >
< span class = "uk-margin-xsmall-right open-access" >
< icon name = "open_access" [ flex ] = " true " [ ratio ] = " 0.8 " > < / icon >
< / span >
2023-02-17 18:40:05 +01:00
< span class = "uk-text-bolder"
* ngIf = "openAccessMandatePublications != undefined && openAccessMandatePublications && openAccessMandateDatasets != undefined && openAccessMandateDatasets" >
2023-02-22 13:43:31 +01:00
Open Access Mandate for { { openaireEntities . PUBLICATIONS } } and { { openaireEntities . DATASETS } }
< / span >
2023-02-17 18:40:05 +01:00
< span class = "uk-text-bolder"
* ngIf = "openAccessMandatePublications != undefined && openAccessMandatePublications && (openAccessMandateDatasets == undefined || !openAccessMandateDatasets)" >
2023-02-22 13:43:31 +01:00
Open Access Mandate for { { openaireEntities . PUBLICATIONS } }
< / span >
2023-02-17 18:40:05 +01:00
< span class = "uk-text-bolder"
* ngIf = "openAccessMandateDatasets != undefined && openAccessMandateDatasets && (openAccessMandatePublications == undefined || !openAccessMandatePublications)" >
2023-02-22 13:43:31 +01:00
Open Access Mandate for { { openaireEntities . DATASETS } }
< / span >
2023-02-20 15:59:07 +01:00
< / span >
2023-02-22 13:43:31 +01:00
<!-- types -- >
< span * ngIf = "entityType" class = "uk-flex-inline uk-flex-middle uk-flex-wrap"
[ class . other - separator ] = "types && removeUnknown(types, true).length > 0" >
2023-12-08 13:37:25 +01:00
< icon * ngIf = "entityType.toLowerCase() == 'publication'" name = "description" type = "outlined"
[ flex ] = "true" [ ratio ] = "0.8" class = "uk-margin-xsmall-right" > < / icon >
< icon * ngIf = "entityType.toLowerCase() == 'research data'" name = "database" type = "outlined"
[ flex ] = "true" [ ratio ] = "0.8" class = "uk-margin-xsmall-right" > < / icon >
< icon * ngIf = "entityType.toLowerCase() == 'research software'" name = "integration_instructions"
type = "outlined" [ flex ] = "true" [ ratio ] = "0.8" class = "uk-margin-xsmall-right" > < / icon >
< icon * ngIf = "entityType.toLowerCase() == 'other research product'" name = "apps" type = "outlined"
[ flex ] = "true" [ ratio ] = "0.8" class = "uk-margin-xsmall-right" > < / icon >
< icon * ngIf = "entityType.toLowerCase() == 'project'" name = "assignment_turned_in" type = "outlined"
[ flex ] = "true" [ ratio ] = "0.8" class = "uk-margin-xsmall-right" > < / icon >
< icon * ngIf = "entityType.toLowerCase() == 'data source'" name = "note_add" type = "outlined"
[ flex ] = "true" [ ratio ] = "0.8" class = "uk-margin-xsmall-right" > < / icon >
< icon * ngIf = "entityType.toLowerCase() == 'organization'" name = "corporate_fare" type = "outlined"
[ flex ] = "true" [ ratio ] = "0.8" class = "uk-margin-xsmall-right" > < / icon >
2023-02-22 13:43:31 +01:00
< u class = "uk-text-capitalize uk-text-bolder" > { { entityType } } < / u >
< span * ngIf = "types && removeUnknown(types, true).length > 0" >
< icon name = "keyboard_double_arrow_right" [ flex ] = " true " [ ratio ] = " 0.8 " > < / icon >
< / span >
2023-02-20 15:59:07 +01:00
< / span >
2023-02-17 18:40:05 +01:00
< span * ngIf = "types && removeUnknown(types, true).length > 0" class = "uk-text-italic" >
2023-02-20 15:59:07 +01:00
{ { removeUnknown ( types , true ) . join ( ' , ' ) } }
< / span >
2023-02-17 18:40:05 +01:00
<!-- years -- >
< ng - container * ngIf = "year" >
< span > { { year } } < / span >
< / n g - c o n t a i n e r >
< ng - container * ngIf = "startYear && !endYear" >
2023-09-19 15:38:16 +02:00
< span > From { { startYear } } < / span >
2023-02-17 18:40:05 +01:00
< / n g - c o n t a i n e r >
< ng - container * ngIf = "!startYear && endYear" >
2023-09-19 15:38:16 +02:00
< span > Until { { endYear } } < / span >
2023-02-17 18:40:05 +01:00
< / n g - c o n t a i n e r >
< ng - container * ngIf = "startYear && endYear" >
2023-02-20 15:59:07 +01:00
< ng - container >
2023-02-17 18:40:05 +01:00
< span > { { startYear } } - { { endYear } } < / span >
< / n g - c o n t a i n e r >
< / n g - c o n t a i n e r >
<!-- dates -- >
2023-02-22 13:43:31 +01:00
< span * ngIf = "startDate && !endDate" >
2023-02-17 18:40:05 +01:00
< span class = "uk-margin-xsmall-right" > From < / span >
< span > { { startDate | date : 'dd MMM yyyy' } } < / span >
2023-02-22 13:43:31 +01:00
< / span >
< span * ngIf = "!startDate && endDate" >
2023-02-17 18:40:05 +01:00
< span class = "uk-margin-xsmall-right" > Until < / span >
< span > { { endDate | date : 'dd MMM yyyy' } } < / span >
2023-02-22 13:43:31 +01:00
< / span >
< span * ngIf = "startDate && endDate" >
2023-02-17 18:40:05 +01:00
< ng - container * ngIf = "startDate" >
< span > { { startDate | date : 'dd MMM yyyy' } } < / span >
< span class = "uk-margin-xsmall-left" > ( Started ) < / span >
< / n g - c o n t a i n e r >
< span * ngIf = "startDate && endDate" class = "uk-margin-xsmall-left uk-margin-xsmall-right" > - < / span >
< ng - container * ngIf = "endDate" >
< span > { { endDate | date : 'dd MMM yyyy' } } < / span >
< span class = "uk-margin-xsmall-left" > { { currentDate >= endDate ? '(Ended)' : '(Ending)' } } < / span >
< / n g - c o n t a i n e r >
2023-02-22 13:43:31 +01:00
< / span >
2023-02-20 15:59:07 +01:00
< ng - container * ngIf = "status" >
2023-02-17 18:40:05 +01:00
< span > { { status } } < / span >
< / n g - c o n t a i n e r >
< ng - container * ngIf = "date" >
< span > { { date | date : 'dd MMM yyyy' : 'UTC' } } < / span >
< / n g - c o n t a i n e r >
< ng - container * ngIf = "embargoEndDate" >
< span > Embargo end date : { { embargoEndDate | date : 'dd MMM yyyy' } } < / span >
< / n g - c o n t a i n e r >
< span * ngIf = "underCuration" >
2023-02-22 13:43:31 +01:00
< span title = "{{buildCurationTooltip()}}" uk - tooltip = "pos:bottom-right; delay:10;"
2023-02-20 15:59:07 +01:00
class = "uk-text-primary" > Under curation < / span >
< / span >
2023-02-17 18:40:05 +01:00
<!-- countries -- >
2023-02-22 13:43:31 +01:00
< span * ngIf = "countries && removeUnknown(countries).length > 0" >
{ { removeUnknown ( countries ) . join ( ', ' ) } }
< / span >
2023-02-17 18:40:05 +01:00
<!-- languages -- >
2023-02-22 13:43:31 +01:00
< span * ngIf = "languages && removeUnknown(languages).length > 0" >
{ { removeUnknown ( languages ) . join ( ', ' ) } }
< / span >
2023-02-17 18:40:05 +01:00
<!-- programming languages -- >
2023-02-22 13:43:31 +01:00
< span * ngIf = "programmingLanguages && removeUnknown(programmingLanguages).length > 0"
class = "uk-flex uk-flex-middle uk-flex-wrap" >
{ { removeUnknown ( programmingLanguages ) . join ( ', ' ) } }
< / span >
2023-02-17 18:40:05 +01:00
<!-- published info -- >
2023-02-22 13:43:31 +01:00
< showPublisher * ngIf = "publisher || journal" [ publisher ] = " publisher " [ journal ] = " journal "
[ properties ] = "properties" > < / showPublisher >
2023-02-17 18:40:05 +01:00
<!-- data provider labels -- >
< ng - container * ngIf = "compatibility && !(compatibility.info == 'not available' && type == 'service')" >
2023-02-20 15:59:07 +01:00
< span uk - tooltip title = "Compatibility" >
< a * ngIf = "compatibility.id"
2023-05-09 18:04:06 +02:00
[ queryParams ] = "addEoscPrevInParams({datasourceId: compatibility.id})" routerLinkActive = "router-link-active"
2023-02-20 15:59:07 +01:00
[ routerLink ] = "properties.searchLinkToDataProvider.split('?')[0]" >
{ { compatibility . info } }
< ng - container * ngIf = "compatibility.name" > { { compatibility . name } } < / n g - c o n t a i n e r >
< / a >
< span * ngIf = "!compatibility.id && compatibility.info" >
< ng - container
* ngIf = "compatibility.info.toLowerCase() != 'not yet registered'" > { { compatibility . info } } < / n g - c o n t a i n e r >
< ng - container * ngIf = "compatibility.info.toLowerCase() == 'not yet registered'" >
{ { compatibility . info } } < span * ngIf = "properties.adminToolsPortalType == 'eosc'" > in OpenAIRE < / span >
< / n g - c o n t a i n e r >
< / span >
< span * ngIf = "compatibility.name && !compatibility.id" >
{ { compatibility . name } }
< / span >
< / span >
< / n g - c o n t a i n e r >
< ng - container * ngIf = "compatibilityString" >
< span uk - tooltip title = "Compatibility" > { { compatibilityString } } < / span >
2023-02-17 18:40:05 +01:00
< / n g - c o n t a i n e r >
< ng - container
* ngIf = "aggregationStatus && aggregationStatus.fulltexts && aggregationStatus.fulltexts > 0" >
< span > OpenAIRE Text Mining < / span >
< / n g - c o n t a i n e r >
< ng - container * ngIf = "thematic" >
< span > Thematic < / span >
< / n g - c o n t a i n e r >
2023-02-20 17:17:30 +01:00
<!-- Projects -- >
2023-10-02 11:18:29 +02:00
< span * ngIf = "projects && projects.length > 0"
[ attr . uk - tooltip ] = "projects.length > projectsLimit ? 'cls: uk-invisible' : 'pos: top; cls: uk-active'" title = "Funded by" >
{ { showInline ? projectNames . join ( ', ' ) : projectNames . slice ( 0 , projectsLimit ) . join ( ', ' ) } }
< span * ngIf = "projects.length > projectsLimit" >
< a * ngIf = "!showInline" ( click ) = " viewAllProjectsClick ( ) ; " class = "uk-background-muted custom-extra-entities" >
+ { { projects . length - projectsLimit | number } } projects
< / a >
< a * ngIf = "showInline && lessBtn" ( click ) = " showInline = ! showInline ; lessBtn = false ; "
class = "uk-background-muted custom-extra-entities" >
View less
< / a >
< / span >
2023-02-22 13:43:31 +01:00
< / span >
2023-02-20 17:17:30 +01:00
<!-- Organizations -- >
2023-10-02 11:18:29 +02:00
< span * ngIf = "organizations && organizations.length > 0"
[ attr . uk - tooltip ] = "organizations.length > organizationsLimit ? 'cls: uk-invisible' : 'pos: top; cls: uk-active'" title = "Partners" >
{ { showInline ? organizationNames . join ( ', ' ) : organizationNames . slice ( 0 , organizationsLimit ) . join ( ', ' ) } }
< span * ngIf = "organizations.length > organizationsLimit" >
< a * ngIf = "!showInline" ( click ) = " viewAllPartnersClick ( ) ; " class = "uk-background-muted custom-extra-entities" >
+ { { organizations . length - organizationsLimit | number } } partners
< / a >
< a * ngIf = "showInline && lessBtn" ( click ) = " showInline = ! showInline ; lessBtn = false ; "
class = "uk-background-muted custom-extra-entities" >
View less
< / a >
< / span >
2023-02-22 13:43:31 +01:00
< / span >
2023-02-20 17:17:30 +01:00
<!-- Subjects -- >
2023-02-22 13:43:31 +01:00
< span uk - tooltip = "Subjects" * ngIf = "subjects && subjects.length > 0" [ class.truncated ] = " subjects.length > 3 " >
{ { subjects . slice ( 0 , 3 ) . join ( ', ' ) } }
< / span >
2023-02-17 18:40:05 +01:00
< ng - container * ngIf = "provenanceAction" >
< span > { { provenanceAction } } < / span >
< / n g - c o n t a i n e r >
< ng - container * ngIf = "relationName" >
< span > { { relationName } } < / span >
< / n g - c o n t a i n e r >
< / div >
2023-10-02 11:18:29 +02:00
< modal - alert * ngIf = "!isMobile" # partnersModal >
< div class = "uk-text-small uk-text-emphasis uk-grid uk-grid-column-collapse uk-grid-row-small" uk - grid >
< ng - container * ngFor = "let item of organizations; let i = index" >
< div class = "uk-margin-xsmall-right" >
{ { item . name } } { { i == organizations . length - 1 ? '' : ',' } }
< / div >
< / n g - c o n t a i n e r >
< / div >
< / m o d a l - a l e r t >
< modal - alert * ngIf = "!isMobile" # projectsModal >
< div class = "uk-text-small uk-text-emphasis uk-grid uk-grid-column-collapse uk-grid-row-small" uk - grid >
< ng - container * ngFor = "let item of projects; let i = index" >
< div class = "uk-margin-xsmall-right" >
< span
* ngIf = "item['funderShortname'] || item['funderName']" > { { item [ 'funderShortname' ] ? item [ 'funderShortname' ] : item [ 'funderName' ] } } < / span >
< span * ngIf = "!item['funderShortname'] && !item['funderName']" > [ no funder available ] < / span >
< span * ngIf = "item['acronym'] || item['title']" > | { { item [ 'acronym' ] ? item [ 'acronym' ] : item [ 'title' ] } } < / span >
{ { i == projects . length - 1 ? '' : ',' } }
< / div >
< / n g - c o n t a i n e r >
< / div >
< / m o d a l - a l e r t >
2023-02-22 13:43:31 +01:00
` ,
styleUrls : [ 'entity-metadata.component.less' ]
2023-02-17 18:40:05 +01:00
} )
export class EntityMetadataComponent {
2023-10-02 11:18:29 +02:00
@Input ( ) isMobile : boolean = false ;
2023-02-17 18:40:05 +01:00
@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 ;
2023-02-20 15:59:07 +01:00
@Input ( ) compatibilityString : string ;
2023-02-17 18:40:05 +01:00
@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
2023-02-20 15:59:07 +01:00
@Input ( ) projects : Project [ ] ;
2023-02-20 17:17:30 +01:00
@Input ( ) organizations : Organization [ ] ;
2023-02-20 15:59:07 +01:00
@Input ( ) subjects : string [ ] ;
2023-05-09 18:04:06 +02:00
@Input ( ) prevPath : string = "" ;
2023-10-02 11:18:29 +02:00
@ViewChild ( 'partnersModal' ) partnersModal ;
@ViewChild ( 'projectsModal' ) projectsModal ;
organizationsLimit : number = 5 ;
projectsLimit : number = 3 ;
showInline : boolean = false ;
lessBtn : boolean = false ;
2023-02-17 18:40:05 +01:00
properties : EnvProperties = properties ;
public openaireEntities = OpenaireEntities ;
2023-05-09 18:04:06 +02:00
public routerHelper : RouterHelper = new RouterHelper ( ) ;
2023-02-17 18:40:05 +01:00
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 = "<div class='uk-padding-small'>" ;
tooltipContent += "<h5>Record in preview</h5>" ;
tooltipContent += "<p>Bibliographic record accepted by the system, but not yet processed by <br> OpenAIRE tools for information quality improvement and de-duplication</p>" ;
tooltipContent += "</div>" ;
return tooltipContent ;
}
2023-02-22 13:43:31 +01:00
get projectNames ( ) : string [ ] {
if ( this . projects && this . projects . length > 0 ) {
return this . projects . map ( project = > {
let value = project . funderShortname ? project.funderShortname : project.funderName ;
if ( project . acronym || project . title ) {
value = value + ' | ' + ( project . acronym ? project . acronym :
( project . title . length > 25 ? ( project . title . slice ( 0 , 25 ) + '...' ) : project . title ) ) ;
}
2023-07-19 11:20:49 +02:00
// if(project.code) {
// value = value + ' (' + project.code + ')';
// }
2023-02-22 13:43:31 +01:00
return value ;
} ) ;
}
return [ ] ;
}
get organizationNames ( ) : string [ ] {
if ( this . organizations && this . organizations . length > 0 ) {
return this . organizations . map ( organization = > organization . name ) ;
}
return [ ] ;
}
2023-05-09 18:04:06 +02:00
public addEoscPrevInParams ( obj ) {
if ( properties . adminToolsPortalType == "eosc" && this . prevPath ) {
return this . routerHelper . addQueryParam ( "pv" , this . prevPath , obj ) ;
}
return obj ;
}
2023-10-02 11:18:29 +02:00
public viewAllPartnersClick() {
if ( this . organizations . length <= this . organizationsLimit * 2 ) {
this . showInline = true ;
this . lessBtn = true ;
} else {
this . openPartnersModal ( ) ;
}
}
public openPartnersModal() {
if ( this . isMobile ) {
this . partnersModal . okButton = false ;
this . partnersModal . title = "Partners" ;
this . partnersModal . open ( ) ;
} else {
this . partnersModal . cancelButton = false ;
this . partnersModal . okButton = false ;
this . partnersModal . alertTitle = "Partners" ;
this . partnersModal . open ( ) ;
}
}
public viewAllProjectsClick() {
if ( this . projects . length <= this . projectsLimit * 2 ) {
this . showInline = true ;
this . lessBtn = true ;
} else {
this . openProjectsModal ( ) ;
}
}
public openProjectsModal() {
if ( this . isMobile ) {
this . projectsModal . okButton = false ;
this . projectsModal . title = "Projects" ;
this . projectsModal . open ( ) ;
} else {
this . projectsModal . cancelButton = false ;
this . projectsModal . okButton = false ;
this . projectsModal . alertTitle = "Projects" ;
this . projectsModal . open ( ) ;
}
}
}