Merging explore-redesign branch into develop for Explore July release #7

Merged
konstantina.galouni merged 112 commits from explore-redesign into develop 2023-07-05 11:11:53 +02:00
20 changed files with 894 additions and 933 deletions
Showing only changes of commit 238aafd552 - Show all commits

View File

@ -2,7 +2,7 @@ import {
ChangeDetectorRef, ChangeDetectorRef,
Component, Component,
EventEmitter, EventEmitter,
Inject, Inject, Input,
OnInit, OnInit,
Output, Output,
RendererFactory2, RendererFactory2,
@ -28,18 +28,22 @@ declare var addthis: addthis;
@Component({ @Component({
selector: 'addThis', selector: 'addThis',
template: ` template: `
<div id="addThis" class="addthis_inline_share_toolbox_lcx9_8cfy"></div> <div id="addThis" class="addthis_inline_share_toolbox_lcx9_8cfy" [attr.data-url]="url"></div>
<div *ngIf="showWarning" class="uk-alert uk-alert-warning uk-animation-fade" > <div *ngIf="showWarning" class="uk-alert uk-alert-warning uk-animation-fade">
Do the share buttons not appear? Please make sure, any blocking addon is disabled, and then reload the page. Do the share buttons not appear? Please make sure, any blocking addon is disabled, and then reload the page.
</div> </div>
` `
}) })
export class AddThisComponent implements OnInit { export class AddThisComponent implements OnInit {
subs=[]; subs = [];
showWarning = false; showWarning = false;
constructor(private route: ActivatedRoute, @Inject(DOCUMENT) private document, private rendererFactory: RendererFactory2) {} @Input() url: string = null;
constructor(private route: ActivatedRoute, @Inject(DOCUMENT) private document, private rendererFactory: RendererFactory2) {
}
public ngOnDestroy() { public ngOnDestroy() {
for(let value of this.subs){ for (let value of this.subs) {
if (value instanceof Subscriber) { if (value instanceof Subscriber) {
value.unsubscribe(); value.unsubscribe();
} else if (value instanceof Function) { } else if (value instanceof Function) {
@ -47,12 +51,13 @@ export class AddThisComponent implements OnInit {
} }
} }
} }
ngOnInit() { ngOnInit() {
this.subs.push(this.route.queryParams.subscribe(data => { this.subs.push(this.route.queryParams.subscribe(data => {
this.showWarning = false; this.showWarning = false;
try { try {
if (!this.document.getElementById('addThisScript') && typeof document !== 'undefined') { if (!this.document.getElementById('addThisScript') && typeof document !== 'undefined') {
// console.log(" create script AddThis"); // console.log(" create script AddThis");
const renderer = this.rendererFactory.createRenderer(this.document, { const renderer = this.rendererFactory.createRenderer(this.document, {
id: '-1', id: '-1',
@ -71,20 +76,20 @@ export class AddThisComponent implements OnInit {
renderer.appendChild(head, script); renderer.appendChild(head, script);
} }
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
if(typeof addthis !== 'undefined' && addthis.layers && addthis.layers.refresh) { if (typeof addthis !== 'undefined' && addthis.layers && addthis.layers.refresh) {
// console.log("Add This: Call Refresh") // console.log("Add This: Call Refresh")
addthis.layers.refresh(); addthis.layers.refresh();
} }
} }
this.subs.push(setTimeout(() => { this.subs.push(setTimeout(() => {
if(this.document.getElementById('addThis') && !this.document.getElementById('addThis').innerText){ if (this.document.getElementById('addThis') && !this.document.getElementById('addThis').innerText) {
this.showWarning = true; this.showWarning = true;
} }
}, 4000)); }, 4000));
}catch (e) { } catch (e) {
// console.error(e) // console.error(e)
} }
})); }));
} }
} }

View File

@ -4,58 +4,64 @@ import {properties} from "../../../../environments/environment";
import {StringUtils} from '../../utils/string-utils.class'; import {StringUtils} from '../../utils/string-utils.class';
declare var UIkit; declare var UIkit;
@Component({ @Component({
selector: 'availableOn', selector: 'availableOn',
template: ` template: `
<ng-container *ngIf="availableOn"> <ng-container *ngIf="availableOn">
<div class="uk-flex uk-flex-middle uk-flex-center"> <div class="uk-flex uk-flex-middle">
<ng-container *ngIf="availableOn[0].downloadUrl"> <ng-container *ngIf="availableOn[0].downloadUrl">
<span class="uk-margin-xsmall-right">Source: </span> <span *ngIf="source" class="uk-margin-xsmall-right">Source: </span>
<span [class]="'uk-margin-xsmall-right ' + (availableOn[0].accessRightIcon == 'open_access' ? 'open-access' : 'uk-text-meta')" <span
uk-tooltip [title]="availableOn[0].accessRight ? availableOn[0].accessRight : 'Not available'"> [class]="'uk-margin-xsmall-right ' + (availableOn[0].accessRightIcon == 'open_access' ? 'open-access' : 'closed-access')"
uk-tooltip [title]="availableOn[0].accessRight ? availableOn[0].accessRight : 'Not available'">
<icon [name]="availableOn[0].accessRightIcon" [flex]="true" [ratio]="0.8"></icon> <icon [name]="availableOn[0].accessRightIcon" [flex]="true" [ratio]="0.8"></icon>
</span> </span>
<a [href]="availableOn[0].downloadUrl" target="_blank" <a [href]="availableOn[0].downloadUrl" target="_blank"
class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder custom-external"> class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder custom-external">
<span>{{sliceString(availableOn[0].downloadNames.join("; "), 20)}}</span> <span>{{sliceString(availableOn[0].downloadNames.join("; "), 20)}}</span>
</a> </a>
</ng-container> </ng-container>
<a class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder"> <a class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder">
<icon [flex]="true" [name]="'expand_' + (isOpen?'less':'more')"></icon> <icon [flex]="true" [name]="'expand_' + (isOpen?'less':'more')"></icon>
</a> </a>
<div #dropElement uk-drop="mode: click; pos: bottom-left;"
<div #dropElement uk-drop="mode: click; pos: bottom-left;" class="download-drop uk-card uk-card-default uk-padding-small uk-padding-remove-horizontal uk-text-small"> class="download-drop uk-card uk-card-default uk-padding-small uk-padding-remove-horizontal uk-text-small">
<div *ngFor="let instance of availableOn let i=index" class="download-drop-item uk-flex uk-flex-top"> <div *ngFor="let instance of availableOn let i=index" class="download-drop-item uk-flex uk-flex-top">
<span [class]="'uk-margin-small-right ' + (instance.accessRightIcon == 'open_access' ? 'open-access' : 'uk-text-meta')" <span
uk-tooltip [title]="instance.accessRight ? instance.accessRight : 'Not available'"> [class]="'uk-margin-small-right ' + (instance.accessRightIcon == 'open_access' ? 'open-access' : 'closed-access')"
uk-tooltip [title]="instance.accessRight ? instance.accessRight : 'Not available'">
<icon [name]="instance.accessRightIcon" [flex]="true"></icon> <icon [name]="instance.accessRightIcon" [flex]="true"></icon>
</span> </span>
<div class="uk-width-expand uk-padding-small uk-padding-remove-left uk-padding-remove-vertical"> <div class="uk-width-expand uk-padding-small uk-padding-remove-left uk-padding-remove-vertical">
<span class="uk-text-emphasis"> <span class="uk-text-emphasis">
<a *ngIf="instance.downloadUrl" [href]="instance.downloadUrl" target="_blank" <a *ngIf="instance.downloadUrl" [href]="instance.downloadUrl" target="_blank"
class="title uk-link-text uk-text-bold custom-external uk-display-inline-block"> class="title uk-link-text uk-text-bold custom-external uk-display-inline-block">
{{instance.downloadNames.join("; ")}} {{instance.downloadNames.join("; ")}}
</a> </a>
</span> </span>
<div *ngIf="instance.types?.length > 0 || instance.years?.length > 0" class="uk-text-meta"> <div *ngIf="instance.types?.length > 0 || instance.years?.length > 0" class="uk-text-meta">
<span *ngIf="instance.types?.length > 0" class="uk-text-capitalize">{{instance.types.join(" . ")}}</span> <span *ngIf="instance.types?.length > 0"
class="uk-text-capitalize">{{instance.types.join(" . ")}}</span>
<span *ngIf="instance.types?.length > 0 && instance.years?.length > 0"> . </span> <span *ngIf="instance.types?.length > 0 && instance.years?.length > 0"> . </span>
<span *ngIf="instance.years?.length > 0">{{instance.years.join(" . ")}}</span> <span *ngIf="instance.years?.length > 0">{{instance.years.join(" . ")}}</span>
</div> </div>
<div *ngIf="instance.license" class="uk-text-meta uk-text-truncate" uk-tooltip [title]="instance.license"> <div *ngIf="instance.license" class="uk-text-meta uk-text-truncate" uk-tooltip [title]="instance.license">
License: License:
<a *ngIf="isUrl(instance.license); else elseBlock" <a *ngIf="isUrl(instance.license); else elseBlock"
[href]="instance.license" target="_blank" class="custom-external uk-link-text"> [href]="instance.license" target="_blank" class="custom-external uk-link-text">
{{instance.license}} {{instance.license}}
</a> </a>
<ng-template #elseBlock> {{instance.license}}</ng-template> <ng-template #elseBlock> {{instance.license}}</ng-template>
</div> </div>
<div *ngIf="instance.collectedNamesAndIds?.size > 0" class="uk-text-meta"> <div *ngIf="instance.collectedNamesAndIds?.size > 0" class="uk-text-meta">
<span>Providers: </span> <span>Providers: </span>
<a *ngFor="let collectedName of getKeys(instance.collectedNamesAndIds); let i=index" [routerLink]="dataProviderUrl" <a *ngFor="let collectedName of getKeys(instance.collectedNamesAndIds); let i=index"
[queryParams]="{datasourceId: instance.collectedNamesAndIds.get(collectedName)}" class="uk-link-text"> [routerLink]="dataProviderUrl"
{{collectedName}}<ng-container *ngIf="(i !== (instance.collectedNamesAndIds.size - 1))">; </ng-container> [queryParams]="{datasourceId: instance.collectedNamesAndIds.get(collectedName)}"
class="uk-link-text">
{{collectedName}}
<ng-container *ngIf="(i !== (instance.collectedNamesAndIds.size - 1))">;</ng-container>
</a> </a>
</div> </div>
</div> </div>
@ -63,134 +69,38 @@ declare var UIkit;
</div> </div>
</div> </div>
</ng-container> </ng-container>
<!-- <div class="uk-margin-small-bottom uk-flex uk-flex-between">
<span *ngIf="viewAll && !lessBtn" class="clickable uk-h6 uk-flex uk-flex-middle" (click)="viewLessClick()">
<icon class="uk-margin-small-right" name="arrow_back" [flex]="true" ratio="1.2"></icon>
{{title}}
</span>
<span *ngIf="!viewAll || lessBtn" class="uk-margin-small-bottom uk-flex uk-flex-middle">
<span class="uk-text-light-grey uk-margin-small-right">Download from</span>
</span>
<a *ngIf="viewAll && lessBtn" (click)="viewAll = !viewAll; lessBtn=false;" class="view-more-less-link">View less</a>
<a *ngIf="availableOn && availableOn.length > threshold && !viewAll" class="view-more-less-link"
(click)="viewAllClick();">View all {{availableOn.length}} sources</a>
</div>
<div *ngIf="availableOn" class="download-from uk-margin-small-bottom">
<div *ngFor="let instance of availableOn.slice(0, viewAll?availableOn.length:threshold) let i=index"
class="uk-flex uk-flex-top uk-padding-small uk-margin-small-bottom"
uk-tooltip [title]="instance.accessRight ? instance.accessRight : 'Not available'">
<span [class]="'uk-margin-small-right ' + (instance.accessRightIcon == 'lock_open' ? 'uk-text-success' : 'uk-text-meta')"
uk-tooltip [title]="instance.accessRight ? instance.accessRight : 'Not available'">
<icon [name]="instance.accessRightIcon" [flex]="true" type="outlined"></icon>
</span>
<div class="uk-width-expand uk-padding-small uk-padding-remove-left uk-padding-remove-vertical">
<span class="uk-text-emphasis">
<a *ngIf="instance.downloadUrl" [href]="instance.downloadUrl" target="_blank"
class="title uk-link-text uk-text-bold custom-external uk-display-inline-block">
{{instance.downloadNames.join("; ")}}
</a>
</span>
<div *ngIf="instance.types?.length > 0 || instance.years?.length > 0" class="uk-text-meta">
<span *ngIf="instance.types?.length > 0" class="uk-text-capitalize">{{instance.types.join(" . ")}}</span>
<span *ngIf="instance.types?.length > 0 && instance.years?.length > 0"> . </span>
<span *ngIf="instance.years?.length > 0">{{instance.years.join(" . ")}}</span>
</div>
<div *ngIf="instance.license" class="uk-text-meta uk-text-truncate" uk-tooltip [title]="instance.license">
License:
<a *ngIf="isUrl(instance.license); else elseBlock"
[href]="instance.license" target="_blank" class="custom-external uk-link-text">
{{instance.license}}
</a>
<ng-template #elseBlock> {{instance.license}}</ng-template>
</div>
<div *ngIf="instance.collectedNamesAndIds?.size > 0" class="uk-text-meta">
<span>Providers: </span>
<a *ngFor="let collectedName of getKeys(instance.collectedNamesAndIds); let i=index" [routerLink]="dataProviderUrl"
[queryParams]="{datasourceId: instance.collectedNamesAndIds.get(collectedName)}" class="uk-link-text">
{{collectedName}}<ng-container *ngIf="(i !== (instance.collectedNamesAndIds.size - 1))">; </ng-container>
</a>
</div>
</div>
</div>
</div> -->
<!-- <div *ngIf="showNum > threshold" class="uk-margin-bottom">-->
<!-- <a (click)="showNum = threshold;" class="uk-flex uk-flex-middle uk-flex-center">-->
<!-- <span>View less</span>-->
<!-- <span class="space uk-icon">-->
<!-- <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="chevron-up">-->
<!-- <polyline fill="none" stroke="#000" stroke-width="1.03" points="4 13 10 7 16 13"></polyline>-->
<!-- </svg>-->
<!-- </span>-->
<!-- </a>-->
<!-- </div>-->
<!-- <div *ngIf="showNum == threshold && availableOn && availableOn.length > 5" class="uk-margin-bottom">-->
<!-- <a (click)="showNum = availableOn.length;" class="uk-flex uk-flex-middle uk-flex-center">-->
<!-- <span>View more</span>-->
<!-- <span class="space uk-icon">-->
<!-- <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="chevron-down">-->
<!-- <polyline fill="none" stroke="#000" stroke-width="1.03" points="16 7 10 13 4 7"></polyline>-->
<!-- </svg>-->
<!-- </span>-->
<!-- </a>-->
<!-- </div>-->
` `
}) })
export class AvailableOnComponent { export class AvailableOnComponent {
@Input() availableOn: HostedByCollectedFrom[]; @Input() availableOn: HostedByCollectedFrom[];
@Input() viewAll: boolean = false; @Input() source: boolean = true;
@Output() viewAllClicked = new EventEmitter(); /** @deprecated */
@ViewChild("dropElement") dropElement: ElementRef; @Output() viewAllClicked = new EventEmitter();
public lessBtn: boolean = false; @ViewChild("dropElement") dropElement: ElementRef;
public threshold: number = 1; public threshold: number = 1;
public dataProviderUrl = properties.searchLinkToDataProvider.split('?')[0]; public dataProviderUrl = properties.searchLinkToDataProvider.split('?')[0];
public title: string = "Download from"; public title: string = "Download from";
constructor() { constructor() {
} }
ngOnInit() { ngOnInit() {
}
public removeUnknown(value: string): string {
if (value.toLowerCase() === 'unknown') {
return null;
}
return value;
} }
public getKeys( map) { public getKeys(map) {
return Array.from(map.keys()); return Array.from(map.keys());
} }
public viewAllClick() {
if(this.availableOn.length <= this.threshold*2) {
this.viewAll = true;
this.lessBtn = true;
} else {
this.viewAll = true;
this.viewAllClicked.emit('availableOn');
}
}
public viewLessClick() {
this.viewAll = false;
this.viewAllClicked.emit("");
}
public isUrl(str: string): boolean { public isUrl(str: string): boolean {
return str.startsWith('http://') || str.startsWith('https://') || str.startsWith('//') || str.startsWith('www.'); return str.startsWith('http://') || str.startsWith('https://') || str.startsWith('//') || str.startsWith('www.');
} }
get isOpen() { get isOpen() {
return (typeof document !== 'undefined') && this.dropElement && UIkit.drop(this.dropElement.nativeElement).isActive(); return (typeof document !== 'undefined') && this.dropElement && UIkit.drop(this.dropElement.nativeElement).isActive();
} }
public sliceString(str: string, size: number) { public sliceString(str: string, size: number) {
return StringUtils.sliceString(str, size) return StringUtils.sliceString(str, size)
} }
} }

View File

@ -13,6 +13,7 @@ import {DOCUMENT} from "@angular/common";
import {EnvProperties} from "../../../utils/properties/env-properties"; import {EnvProperties} from "../../../utils/properties/env-properties";
import {properties} from "../../../../../environments/environment"; import {properties} from "../../../../../environments/environment";
import {PiwikService} from "../../../utils/piwik/piwik.service"; import {PiwikService} from "../../../utils/piwik/piwik.service";
import {ResultPreview} from "../../../utils/result-preview/result-preview";
declare var Cite: any; declare var Cite: any;
// Based on https://citation.js.org/api/tutorial-getting_started.html browser release // Based on https://citation.js.org/api/tutorial-getting_started.html browser release
@ -53,7 +54,7 @@ export class CiteThisComponent implements OnInit, OnDestroy {
properties:EnvProperties; properties:EnvProperties;
public citationText: string; public citationText: string;
public citation: Citation = new Citation(); public citation: Citation = new Citation();
@Input() result: ResultLandingInfo; @Input() result: any;
@Input() id: string; @Input() id: string;
@Input() type: string = "article"; @Input() type: string = "article";
@Input() piwikSiteId; @Input() piwikSiteId;

View File

@ -0,0 +1,228 @@
import {Component, Input} from "@angular/core";
import {EnvProperties} from "../../utils/properties/env-properties";
import {properties} from "../../../../environments/environment";
import {OpenaireEntities} from "../../utils/properties/searchFields";
@Component({
selector: 'entity-metadata',
template: `
<div class="uk-text-xsmall uk-text-emphasis uk-flex uk-flex-middle uk-flex-wrap">
<!-- oa -->
<ng-container *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>
<span class="uk-text-bolder"
*ngIf="openAccessMandatePublications != undefined && openAccessMandatePublications && openAccessMandateDatasets != undefined && openAccessMandateDatasets">
Open Access Mandate for {{openaireEntities.PUBLICATIONS}} and {{openaireEntities.DATASETS}}
</span>
<span class="uk-text-bolder"
*ngIf="openAccessMandatePublications != undefined && openAccessMandatePublications && (openAccessMandateDatasets == undefined || !openAccessMandateDatasets)">
Open Access Mandate for {{openaireEntities.PUBLICATIONS}}
</span>
<span class="uk-text-bolder"
*ngIf="openAccessMandateDatasets != undefined && openAccessMandateDatasets && (openAccessMandatePublications == undefined || !openAccessMandatePublications)">
Open Access Mandate for {{openaireEntities.DATASETS}}
</span>
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
</ng-container>
<!-- types -->
<span *ngIf="entityType" class="uk-margin-xsmall-right">
<icon *ngIf="entityType.toLowerCase() == 'publication'" name="description" type="outlined"
[flex]="true" [ratio]="0.8"></icon>
<icon *ngIf="entityType.toLowerCase() == 'research data'" name="database" type="outlined"
[flex]="true" [ratio]="0.8"></icon>
<icon *ngIf="entityType.toLowerCase() == 'research software'" name="integration_instructions"
type="outlined" [flex]="true" [ratio]="0.8"></icon>
<icon *ngIf="entityType.toLowerCase() == 'other research product'" name="apps" type="outlined"
[flex]="true" [ratio]="0.8"></icon>
<icon *ngIf="entityType.toLowerCase() == 'project'" name="assignment_turned_in" type="outlined"
[flex]="true" [ratio]="0.8"></icon>
<icon *ngIf="entityType.toLowerCase() == 'data source'" name="note_add" type="outlined"
[flex]="true" [ratio]="0.8"></icon>
<icon *ngIf="entityType.toLowerCase() == 'organization'" name="corporate_fare" type="outlined"
[flex]="true" [ratio]="0.8"></icon>
</span>
<u *ngIf="entityType" class="uk-text-capitalize uk-text-bolder">{{entityType}}</u>
<span *ngIf="entityType && types && removeUnknown(types, true).length > 0">
<icon name="keyboard_double_arrow_right" [flex]="true" [ratio]="0.8"></icon>
</span>
<span *ngIf="types && removeUnknown(types, true).length > 0" class="uk-text-italic">
{{removeUnknown(types, true).join(' , ')}}
</span>
<!-- years -->
<ng-container *ngIf="year">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<span>{{year}}</span>
</ng-container>
<ng-container *ngIf="startYear && !endYear">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<span>{{startYear}}</span>
</ng-container>
<ng-container *ngIf="!startYear && endYear">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<span>{{endYear}}</span>
</ng-container>
<ng-container *ngIf="startYear && endYear">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<ng-container *ngIf="startDate">
<span>{{startYear}} - {{endYear}}</span>
</ng-container>
</ng-container>
<!-- dates -->
<ng-container *ngIf="startDate && !endDate">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<span class="uk-margin-xsmall-right">From</span>
<span>{{startDate | date: 'dd MMM yyyy'}}</span>
</ng-container>
<ng-container *ngIf="!startDate && endDate">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<span class="uk-margin-xsmall-right">Until</span>
<span>{{endDate | date: 'dd MMM yyyy'}}</span>
</ng-container>
<ng-container *ngIf="startDate && endDate">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<ng-container *ngIf="startDate">
<span>{{startDate | date: 'dd MMM yyyy'}}</span>
<span class="uk-margin-xsmall-left">(Started)</span>
</ng-container>
<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>
</ng-container>
</ng-container>
<ng-container *ngIf="status && status != ''">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<span>{{status}}</span>
</ng-container>
<ng-container *ngIf="date">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<span>{{date | date: 'dd MMM yyyy': 'UTC'}}</span>
</ng-container>
<ng-container *ngIf="embargoEndDate">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<span>Embargo end date: {{embargoEndDate | date: 'dd MMM yyyy'}}</span>
</ng-container>
<span *ngIf="underCuration">
. <span title="{{buildCurationTooltip()}}"
uk-tooltip="pos:bottom-right; delay:10;"
class="uk-text-primary">Under curation</span>
</span>
<!-- countries -->
<ng-container *ngIf="countries && removeUnknown(countries).length > 0">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<ng-container *ngFor="let country of removeUnknown(countries)">
<span>{{country}}</span>
</ng-container>
</ng-container>
<!-- languages -->
<ng-container *ngIf="languages && removeUnknown(languages).length > 0">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<ng-container *ngFor="let language of removeUnknown(languages)">
<span>{{language}}</span>
</ng-container>
</ng-container>
<!-- programming languages -->
<ng-container *ngIf="programmingLanguages && programmingLanguages.length > 0">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<ng-container *ngFor="let programmingLanguage of programmingLanguages">
<span>{{programmingLanguage}}</span>
</ng-container>
</ng-container>
<!-- published info -->
<showPublisher [publisher]="publisher" [journal]="journal" [properties]="properties"></showPublisher>
<!-- data provider labels -->
<ng-container *ngIf="compatibility && !(compatibility.info == 'not available' && type == 'service')">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<span title="Compatibility">
<a *ngIf="compatibility.id"
[queryParams]="{datasourceId: compatibility.id}" routerLinkActive="router-link-active"
[routerLink]="properties.searchLinkToDataProvider.split('?')[0]">
{{compatibility.info}}
<ng-container *ngIf="compatibility.name">{{compatibility.name}}</ng-container>
</a>
<span *ngIf="!compatibility.id && compatibility.info">
<ng-container
*ngIf="compatibility.info.toLowerCase() != 'not yet registered'">{{compatibility.info}}</ng-container>
<ng-container *ngIf="compatibility.info.toLowerCase() == 'not yet registered'">
{{compatibility.info}} <span *ngIf="properties.adminToolsPortalType == 'eosc'">in OpenAIRE</span>
</ng-container>
</span>
<span *ngIf="compatibility.name && !compatibility.id">
{{compatibility.name}}
</span>
</span>
</ng-container>
<ng-container
*ngIf="aggregationStatus && aggregationStatus.fulltexts && aggregationStatus.fulltexts > 0">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<span>OpenAIRE Text Mining</span>
</ng-container>
<ng-container *ngIf="thematic">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<span>Thematic</span>
</ng-container>
<ng-container *ngIf="provenanceAction">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<span>{{provenanceAction}}</span>
</ng-container>
<ng-container *ngIf="relationName">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right bullet"></span>
<span>{{relationName}}</span>
</ng-container>
</div>
`
})
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() 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
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 = "<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;
}
}

View File

@ -2,7 +2,6 @@ import {Component, Input} from "@angular/core";
import {EnvProperties} from "../../../utils/properties/env-properties"; import {EnvProperties} from "../../../utils/properties/env-properties";
import {Author} from "../../../utils/result-preview/result-preview"; import {Author} from "../../../utils/result-preview/result-preview";
import {AlertModal} from "../../../utils/modal/alert"; import {AlertModal} from "../../../utils/modal/alert";
import {OpenaireEntities} from "src/app/openaireLibrary/utils/properties/searchFields";
@Component({ @Component({
selector: 'landing-header', selector: 'landing-header',
@ -14,140 +13,15 @@ import {OpenaireEntities} from "src/app/openaireLibrary/utils/properties/searchF
<span class="uk-text-meta uk-text-small" [innerHTML]="subTitle"></span> <span class="uk-text-meta uk-text-small" [innerHTML]="subTitle"></span>
</div> </div>
</div> </div>
<div class="uk-margin-bottom uk-text-xsmall uk-text-emphasis uk-flex uk-flex-middle uk-flex-wrap"> <div class="uk-margin-bottom">
<!-- oa --> <entity-metadata [entityType]="entityType" [types]="types" [startDate]="startDate" [endDate]="endDate"
<ng-container [currentDate]="currentDate" [status]="status" [openAccessMandatePublications]="openAccessMandatePublications"
*ngIf="(openAccessMandatePublications != undefined && openAccessMandatePublications) || (openAccessMandateDatasets != undefined && openAccessMandateDatasets)"> [openAccessMandateDatasets]="openAccessMandateDatasets" [date]="date" [embargoEndDate]="embargoEndDate"
<span class="uk-margin-xsmall-right open-access"> [underCuration]="underCuration" [publisher]="publisher" [journal]="journal"
<icon name="open_access" [flex]="true" [ratio]="0.8"></icon> [languages]="languages" [programmingLanguages]="programmingLanguages"
</span> [compatibility]="compatibility" [aggregationStatus]="aggregationStatus"
<span class="uk-text-bolder" [thematic]="thematic" [type]="type"
*ngIf="openAccessMandatePublications != undefined && openAccessMandatePublications && openAccessMandateDatasets != undefined && openAccessMandateDatasets"> ></entity-metadata>
Open Access Mandate for {{openaireEntities.PUBLICATIONS}} and {{openaireEntities.DATASETS}}
</span>
<span class="uk-text-bolder"
*ngIf="openAccessMandatePublications != undefined && openAccessMandatePublications && (openAccessMandateDatasets == undefined || !openAccessMandateDatasets)">
Open Access Mandate for {{openaireEntities.PUBLICATIONS}}
</span>
<span class="uk-text-bolder"
*ngIf="openAccessMandateDatasets != undefined && openAccessMandateDatasets && (openAccessMandatePublications == undefined || !openAccessMandatePublications)">
Open Access Mandate for {{openaireEntities.DATASETS}}
</span>
<span class="uk-margin-xsmall-left uk-margin-xsmall-right">&#x2022;</span>
</ng-container>
<!-- types -->
<span *ngIf="entityType" class="uk-margin-xsmall-right">
<icon *ngIf="entityType.toLowerCase() == 'publication'" name="description" type="outlined"
[flex]="true" [ratio]="0.8"></icon>
<icon *ngIf="entityType.toLowerCase() == 'research data'" name="database" type="outlined"
[flex]="true" [ratio]="0.8"></icon>
<icon *ngIf="entityType.toLowerCase() == 'research software'" name="integration_instructions"
type="outlined" [flex]="true" [ratio]="0.8"></icon>
<icon *ngIf="entityType.toLowerCase() == 'other research product'" name="apps" type="outlined"
[flex]="true" [ratio]="0.8"></icon>
<icon *ngIf="entityType.toLowerCase() == 'project'" name="assignment_turned_in" type="outlined"
[flex]="true" [ratio]="0.8"></icon>
<icon *ngIf="entityType.toLowerCase() == 'data source'" name="note_add" type="outlined"
[flex]="true" [ratio]="0.8"></icon>
<icon *ngIf="entityType.toLowerCase() == 'organization'" name="corporate_fare" type="outlined"
[flex]="true" [ratio]="0.8"></icon>
</span>
<span *ngIf="entityType" class="uk-text-capitalize uk-text-bolder" style="text-decoration: underline;">
{{entityType}}
</span>
<span *ngIf="entityType && types && removeUnknown(types, true).length > 0">
<icon name="keyboard_double_arrow_right" [flex]="true" [ratio]="0.8"></icon>
</span>
<span *ngIf="types && removeUnknown(types, true).length > 0" class="uk-text-italic">
{{removeUnknown(types, true).join(' , ')}}
</span>
<!-- dates -->
<ng-container *ngIf="startDate && !endDate">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right">&#x2022;</span>
<span class="uk-margin-xsmall-right">From</span>
<span>{{startDate | date: 'dd MMM yyyy'}}</span>
</ng-container>
<ng-container *ngIf="!startDate && endDate">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right">&#x2022;</span>
<span class="uk-margin-xsmall-right">Until</span>
<span>{{endDate | date: 'dd MMM yyyy'}}</span>
</ng-container>
<ng-container *ngIf="startDate && endDate">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right">&#x2022;</span>
<ng-container *ngIf="startDate">
<span>{{startDate | date: 'dd MMM yyyy'}}</span>
<span class="uk-margin-xsmall-left">(Started)</span>
</ng-container>
<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>
</ng-container>
</ng-container>
<ng-container *ngIf="status && status != ''">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right">&#x2022;</span>
<span>{{status}}</span>
</ng-container>
<ng-container *ngIf="date">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right">&#x2022;</span>
<span>{{date | date: 'dd MMM yyyy': 'UTC'}}</span>
</ng-container>
<ng-container *ngIf="embargoEndDate">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right">&#x2022;</span>
<span>Embargo end date: {{embargoEndDate | date: 'dd MMM yyyy'}}</span>
</ng-container>
<span *ngIf="underCuration">
. <span title="{{buildCurationTooltip()}}"
uk-tooltip="pos:bottom-right; delay:10;"
class="uk-text-primary">Under curation</span>
</span>
<!-- languages -->
<ng-container *ngIf="languages && removeUnknown(languages).length > 0">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right">&#x2022;</span>
<ng-container *ngFor="let language of removeUnknown(languages)">
<span>{{language}}</span>
</ng-container>
</ng-container>
<!-- programming languages -->
<ng-container *ngIf="programmingLanguages && programmingLanguages.length > 0">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right">&#x2022;</span>
<ng-container *ngFor="let programmingLanguage of programmingLanguages">
<span>{{programmingLanguage}}</span>
</ng-container>
</ng-container>
<!-- published info -->
<showPublisher [publisher]="publisher" [journal]="journal" [properties]="properties"></showPublisher>
<!-- data provider labels -->
<ng-container *ngIf="compatibility && !(compatibility.info == 'not available' && type == 'service')">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right">&#x2022;</span>
<span title="Compatibility">
<a *ngIf="compatibility.id"
[queryParams]="{datasourceId: compatibility.id}" routerLinkActive="router-link-active"
[routerLink]="properties.searchLinkToDataProvider.split('?')[0]">
{{compatibility.info}}
<ng-container *ngIf="compatibility.name">{{compatibility.name}}</ng-container>
</a>
<span *ngIf="!compatibility.id">
<ng-container
*ngIf="compatibility.info.toLowerCase() != 'not yet registered'">{{compatibility.info}}</ng-container>
<ng-container *ngIf="compatibility.info.toLowerCase() == 'not yet registered'">
{{compatibility.info}} <span *ngIf="properties.adminToolsPortalType == 'eosc'">in OpenAIRE</span>
</ng-container>
</span>
<span *ngIf="compatibility.name && !compatibility.id">
{{compatibility.name}}
</span>
</span>
</ng-container>
<ng-container
*ngIf="aggregationStatus && aggregationStatus.fulltexts && aggregationStatus.fulltexts > 0">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right">&#x2022;</span>
<span>OpenAIRE Text Mining</span>
</ng-container>
<ng-container *ngIf="thematic">
<span class="uk-margin-xsmall-left uk-margin-xsmall-right">&#x2022;</span>
<span>Thematic</span>
</ng-container>
</div> </div>
<div *ngIf="authors"> <div *ngIf="authors">
<showAuthors [authorsLimit]="authorLimit" [modal]="modal" [showAll]="showAllAuthors" [authors]="authors" <showAuthors [authorsLimit]="authorLimit" [modal]="modal" [showAll]="showAllAuthors" [authors]="authors"
@ -176,7 +50,6 @@ export class LandingHeaderComponent {
@Input() underCuration: boolean = false; @Input() underCuration: boolean = false;
@Input() modal: AlertModal; @Input() modal: AlertModal;
@Input() titleClass: string = null; @Input() titleClass: string = null;
@Input() isTitleH1: boolean = true;
@Input() isSticky: boolean = false; @Input() isSticky: boolean = false;
@Input() publisher; // showPublisher component @Input() publisher; // showPublisher component
@Input() journal; // showPublisher component @Input() journal; // showPublisher component
@ -186,28 +59,4 @@ export class LandingHeaderComponent {
@Input() aggregationStatus; // data provider landing @Input() aggregationStatus; // data provider landing
@Input() thematic: boolean; // data provider landing @Input() thematic: boolean; // data provider landing
@Input() type; // data provider landing @Input() type; // data provider landing
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 = "<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;
}
} }

View File

@ -6,10 +6,11 @@ import {ShowAuthorsModule} from "../../../utils/authors/showAuthors.module";
import {IconsModule} from "src/app/openaireLibrary/utils/icons/icons.module"; import {IconsModule} from "src/app/openaireLibrary/utils/icons/icons.module";
import {ShowPublisherModule} from "../showPublisher.module"; import {ShowPublisherModule} from "../showPublisher.module";
import {RouterModule} from "@angular/router"; import {RouterModule} from "@angular/router";
import {ResultLandingUtilsModule} from "../resultLandingUtils.module";
@NgModule({ @NgModule({
imports: [CommonModule, LandingModule, ShowAuthorsModule, IconsModule, ShowPublisherModule, RouterModule], imports: [CommonModule, LandingModule, ShowAuthorsModule, IconsModule, ShowPublisherModule, RouterModule, ResultLandingUtilsModule],
declarations: [LandingHeaderComponent], declarations: [LandingHeaderComponent],
exports: [LandingHeaderComponent] exports: [LandingHeaderComponent]
}) })
export class LandingHeaderModule {} export class LandingHeaderModule {}

View File

@ -1,5 +1,5 @@
import {HostedByCollectedFrom, Journal, Project, RelationResult} from "../../utils/result-preview/result-preview"; import {HostedByCollectedFrom, Project, RelationResult} from "../../utils/result-preview/result-preview";
import {Context, Measure, Reference} from "../../utils/entities/resultLandingInfo"; import {Context, Measure, Metric, Reference} from "../../utils/entities/resultLandingInfo";
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {properties} from "../../../../environments/environment"; import {properties} from "../../../../environments/environment";
import {StringUtils} from "../../utils/string-utils.class"; import {StringUtils} from "../../utils/string-utils.class";
@ -30,35 +30,35 @@ export class ParsingFunctions {
value: 'Twitter Data' value: 'Twitter Data'
} }
] ]
public notebookInSubjects: boolean = false; public notebookInSubjects: boolean = false;
private notebookKeyword: string = "eosc jupyter notebook"; private notebookKeyword: string = "eosc jupyter notebook";
private notebook_label: string = "EOSC"; private notebook_label: string = "EOSC";
private notebook_value: string = "EOSC Jupyter Notebook"; private notebook_value: string = "EOSC Jupyter Notebook";
public open = 'open_access'; public open = 'open_access';
public closed = 'closed_access'; public closed = 'closed_access';
public unknown = 'question_mark'; public unknown = 'question_mark';
private instanceWithDoiExists: boolean = false; private instanceWithDoiExists: boolean = false;
constructor() { constructor() {
} }
public ngOnDestroy() { public ngOnDestroy() {
} }
public parseFundingByProjects(fundedByProjects: Project[], relation: any): Project[] { public parseFundingByProjects(fundedByProjects: Project[], relation: any): Project[] {
if (fundedByProjects == undefined) { if (fundedByProjects == undefined) {
fundedByProjects = []; fundedByProjects = [];
} }
let fundedByProject: Project = { let fundedByProject: Project = {
"id": "", "acronym": "", "title": "", "id": "", "acronym": "", "title": "",
"funderShortname": "", "funderName": "", "funderShortname": "", "funderName": "",
"funding": "", "code": "", "provenanceAction": "", "validated": false "funding": "", "code": "", "provenanceAction": "", "validated": false
}; };
if (relation.title != 'unidentified') { if (relation.title != 'unidentified') {
fundedByProject['id'] = relation['to'].content; fundedByProject['id'] = relation['to'].content;
fundedByProject['acronym'] = relation.acronym; fundedByProject['acronym'] = relation.acronym;
@ -75,11 +75,11 @@ export class ParsingFunctions {
fundedByProject['code'] = ""; fundedByProject['code'] = "";
fundedByProject['provenanceAction'] = ""; fundedByProject['provenanceAction'] = "";
} }
if (relation.hasOwnProperty("funding")) { if (relation.hasOwnProperty("funding")) {
let funding: { "funderName": string, "funderShortname": string, "stream": string }; let funding: { "funderName": string, "funderShortname": string, "stream": string };
funding = this.parseFundingTrees(relation.funding); funding = this.parseFundingTrees(relation.funding);
if (funding.funderName) { if (funding.funderName) {
fundedByProject['funderName'] = funding.funderName; fundedByProject['funderName'] = funding.funderName;
} }
@ -93,7 +93,7 @@ export class ParsingFunctions {
fundedByProjects.push(fundedByProject); fundedByProjects.push(fundedByProject);
return fundedByProjects; return fundedByProjects;
} }
// publication & research data : for fundedByProjects | project landing : for funding // publication & research data : for fundedByProjects | project landing : for funding
public parseFundingTrees(fundingTree: any): { "funderName": string, "funderShortname": string, "stream": string } { public parseFundingTrees(fundingTree: any): { "funderName": string, "funderShortname": string, "stream": string } {
let funding: { "funderName": string, "funderShortname": string, "stream": string } = { let funding: { "funderName": string, "funderShortname": string, "stream": string } = {
@ -102,64 +102,64 @@ export class ParsingFunctions {
"stream": "" "stream": ""
}; };
let length = Array.isArray(fundingTree) ? fundingTree.length : 1; let length = Array.isArray(fundingTree) ? fundingTree.length : 1;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
let fundingData = Array.isArray(fundingTree) ? fundingTree[i] : fundingTree; let fundingData = Array.isArray(fundingTree) ? fundingTree[i] : fundingTree;
if (fundingData.hasOwnProperty("funder")) { if (fundingData.hasOwnProperty("funder")) {
funding.funderShortname = fundingData['funder'].shortname; funding.funderShortname = fundingData['funder'].shortname;
funding.funderName = fundingData['funder'].name; funding.funderName = fundingData['funder'].name;
} }
funding.stream = this.addFundingLevel0(fundingData, funding.stream); funding.stream = this.addFundingLevel0(fundingData, funding.stream);
funding.stream = this.addFundingLevel1(fundingData, funding.stream); funding.stream = this.addFundingLevel1(fundingData, funding.stream);
funding.stream = this.addFundingLevel2(fundingData, funding.stream); funding.stream = this.addFundingLevel2(fundingData, funding.stream);
} }
return funding; return funding;
} }
addFundingLevel0(parent: string, fundingStream: string): string { addFundingLevel0(parent: string, fundingStream: string): string {
if (parent.hasOwnProperty("funding_level_0")) { if (parent.hasOwnProperty("funding_level_0")) {
let level0 = parent['funding_level_0']; let level0 = parent['funding_level_0'];
fundingStream += (fundingStream) ? " ; " : ""; fundingStream += (fundingStream) ? " ; " : "";
fundingStream += level0.name; fundingStream += level0.name;
} }
return fundingStream; return fundingStream;
} }
addFundingLevel1(parent: string, fundingStream: string): string { addFundingLevel1(parent: string, fundingStream: string): string {
if (parent.hasOwnProperty("funding_level_1")) { if (parent.hasOwnProperty("funding_level_1")) {
let level1 = parent['funding_level_1']; let level1 = parent['funding_level_1'];
// For projects' parsing // For projects' parsing
if (level1.hasOwnProperty("parent")) { if (level1.hasOwnProperty("parent")) {
fundingStream = this.addFundingLevel0(level1.parent, fundingStream); fundingStream = this.addFundingLevel0(level1.parent, fundingStream);
} }
fundingStream += (fundingStream) ? " | " : ""; fundingStream += (fundingStream) ? " | " : "";
fundingStream += level1.name; fundingStream += level1.name;
} }
return fundingStream; return fundingStream;
} }
addFundingLevel2(parent: string, fundingStream: string): string { addFundingLevel2(parent: string, fundingStream: string): string {
if (parent.hasOwnProperty("funding_level_2")) { if (parent.hasOwnProperty("funding_level_2")) {
let level2 = parent['funding_level_2']; let level2 = parent['funding_level_2'];
// For projects' parsing // For projects' parsing
if (level2.hasOwnProperty("parent")) { if (level2.hasOwnProperty("parent")) {
fundingStream = this.addFundingLevel1(level2.parent, fundingStream); fundingStream = this.addFundingLevel1(level2.parent, fundingStream);
} }
fundingStream += (fundingStream) ? " | " : ""; fundingStream += (fundingStream) ? " | " : "";
fundingStream += level2.name; fundingStream += level2.name;
} }
return fundingStream; return fundingStream;
} }
// publication & dataset landing : for collectedFrom // publication & dataset landing : for collectedFrom
parseCollectedFrom(collectedFrom: { "name": string, "id": string }[], parseCollectedFrom(collectedFrom: { "name": string, "id": string }[],
_collectedFrom: any) { _collectedFrom: any) {
@ -168,7 +168,7 @@ export class ParsingFunctions {
collectedFrom[length]['name'] = _collectedFrom.name; collectedFrom[length]['name'] = _collectedFrom.name;
collectedFrom[length]['id'] = _collectedFrom.id; collectedFrom[length]['id'] = _collectedFrom.id;
} }
// publication & dataset landing : for downloadFrom // publication & dataset landing : for downloadFrom
addPublisherToHostedBy_collectedFrom(hostedBy_collectedFrom: HostedByCollectedFrom[], addPublisherToHostedBy_collectedFrom(hostedBy_collectedFrom: HostedByCollectedFrom[],
publisher: string, journal: string, publisher: string, journal: string,
@ -186,13 +186,13 @@ export class ParsingFunctions {
years: [], years: [],
accessRightIcon: "" accessRightIcon: ""
}; };
if (journal) { if (journal) {
available.downloadNames.push(publisher + "/ " + journal['journal']); available.downloadNames.push(publisher + "/ " + journal['journal']);
} else { } else {
available.downloadNames.push(publisher); available.downloadNames.push(publisher);
} }
available.downloadUrl = properties.doiURL + identifiers.get("doi")[0]; available.downloadUrl = properties.doiURL + identifiers.get("doi")[0];
available.accessRightIcon = this.unknown; available.accessRightIcon = this.unknown;
/* /*
@ -204,16 +204,16 @@ export class ParsingFunctions {
} }
return hostedBy_collectedFrom; return hostedBy_collectedFrom;
} }
// publication & dataset landing : for downloadFrom // publication & dataset landing : for downloadFrom
parseDownloadFrom(downloadFrom: Map<string, { "url": string[], "accessMode": string[], "bestAccessMode": string }>, instance: any, url: string) { parseDownloadFrom(downloadFrom: Map<string, { "url": string[], "accessMode": string[], "bestAccessMode": string }>, instance: any, url: string) {
let key: string = instance['hostedby'].name; let key: string = instance['hostedby'].name;
if (key) { if (key) {
this.addUrlAndAccessMode(downloadFrom, instance, key, url); this.addUrlAndAccessMode(downloadFrom, instance, key, url);
} }
} }
// publication & dataset landing : for publishedIn // publication & dataset landing : for publishedIn
parsePublishedIn(publishedIn: Map<string, { "url": string[], "accessMode": string[], "bestAccessMode": string }>, instance: any, result: any, url: string, counter: number): number { parsePublishedIn(publishedIn: Map<string, { "url": string[], "accessMode": string[], "bestAccessMode": string }>, instance: any, result: any, url: string, counter: number): number {
if (result != null && result.hasOwnProperty("source")) { if (result != null && result.hasOwnProperty("source")) {
@ -226,7 +226,7 @@ export class ParsingFunctions {
} else { } else {
key = result['source']; key = result['source'];
} }
if (key) { if (key) {
this.addUrlAndAccessMode(publishedIn, instance, key, url); this.addUrlAndAccessMode(publishedIn, instance, key, url);
counter++; counter++;
@ -234,30 +234,30 @@ export class ParsingFunctions {
} }
return counter; return counter;
} }
// publication & dataset landing : for downloadFrom and publishedIn // publication & dataset landing : for downloadFrom and publishedIn
addUrlAndAccessMode(mapStructure: Map<string, { "url": string[], "accessMode": string[], "bestAccessMode": string }>, instance: any, key: string, url: string) { addUrlAndAccessMode(mapStructure: Map<string, { "url": string[], "accessMode": string[], "bestAccessMode": string }>, instance: any, key: string, url: string) {
if (!mapStructure.has(key)) { if (!mapStructure.has(key)) {
mapStructure.set(key, {"url": null, "accessMode": null, "bestAccessMode": null}); mapStructure.set(key, {"url": null, "accessMode": null, "bestAccessMode": null});
} }
if (mapStructure.get(key)['url'] == null) { if (mapStructure.get(key)['url'] == null) {
mapStructure.get(key)['url'] = new Array<string>(); mapStructure.get(key)['url'] = new Array<string>();
} }
if (url) { if (url) {
mapStructure.get(key)['url'].push(url); mapStructure.get(key)['url'].push(url);
} }
if (mapStructure.get(key)['accessMode'] == null) { if (mapStructure.get(key)['accessMode'] == null) {
mapStructure.get(key)['accessMode'] = new Array<string>(); mapStructure.get(key)['accessMode'] = new Array<string>();
} }
if (instance.hasOwnProperty("accessright")) { if (instance.hasOwnProperty("accessright")) {
if (url) { if (url) {
mapStructure.get(key)['accessMode'].push(instance['accessright'].classname); mapStructure.get(key)['accessMode'].push(instance['accessright'].classname);
} }
if (this.changeBestAccessMode(mapStructure.get(key)['bestAccessMode'], instance['accessright'])) { if (this.changeBestAccessMode(mapStructure.get(key)['bestAccessMode'], instance['accessright'])) {
mapStructure.get(key)['bestAccessMode'] = instance['accessright'].classname; mapStructure.get(key)['bestAccessMode'] = instance['accessright'].classname;
} }
@ -265,13 +265,13 @@ export class ParsingFunctions {
mapStructure.get(key)['accessMode'].push(""); mapStructure.get(key)['accessMode'].push("");
} }
} }
parseHostedBy_collectedFrom(hostedBy_collectedFrom: HostedByCollectedFrom[], parseHostedBy_collectedFrom(hostedBy_collectedFrom: HostedByCollectedFrom[],
instance: any, url: string, globalAccessRight: string) { instance: any, url: string, globalAccessRight: string) {
if (!url) { if (!url) {
return; return;
} }
let available: HostedByCollectedFrom = { let available: HostedByCollectedFrom = {
"downloadNames": [], "downloadNames": [],
"downloadUrl": null, "downloadUrl": null,
@ -282,7 +282,7 @@ export class ParsingFunctions {
"years": [], "years": [],
"license": "" "license": ""
}; };
if (instance.hasOwnProperty("hostedby")) { if (instance.hasOwnProperty("hostedby")) {
let downloadNames: Set<string> = new Set(); let downloadNames: Set<string> = new Set();
let length = Array.isArray(instance['hostedby']) ? instance['hostedby'].length : 1; let length = Array.isArray(instance['hostedby']) ? instance['hostedby'].length : 1;
@ -293,12 +293,12 @@ export class ParsingFunctions {
} }
} }
available.downloadNames = Array.from(downloadNames); available.downloadNames = Array.from(downloadNames);
if (available.downloadNames.length == 0) { if (available.downloadNames.length == 0) {
available.downloadNames.push(url.substring(0, 30) + '...'); // substring(from, to); available.downloadNames.push(url.substring(0, 30) + '...'); // substring(from, to);
} }
} }
if (instance.hasOwnProperty("collectedfrom")) { if (instance.hasOwnProperty("collectedfrom")) {
let length = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'].length : 1; let length = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'].length : 1;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
@ -308,7 +308,7 @@ export class ParsingFunctions {
} }
} }
} }
if (instance.hasOwnProperty("instancetype")) { if (instance.hasOwnProperty("instancetype")) {
let types: Set<string> = new Set(); let types: Set<string> = new Set();
let length = Array.isArray(instance['instancetype']) ? instance['instancetype'].length : 1; let length = Array.isArray(instance['instancetype']) ? instance['instancetype'].length : 1;
@ -320,7 +320,7 @@ export class ParsingFunctions {
} }
available.types = Array.from(types); available.types = Array.from(types);
} }
if (instance.hasOwnProperty("dateofacceptance")) { if (instance.hasOwnProperty("dateofacceptance")) {
let years: Set<string> = new Set(); let years: Set<string> = new Set();
let length = Array.isArray(instance['dateofacceptance']) ? instance['dateofacceptance'].length : 1; let length = Array.isArray(instance['dateofacceptance']) ? instance['dateofacceptance'].length : 1;
@ -331,17 +331,17 @@ export class ParsingFunctions {
} }
available.years = Array.from(years); available.years = Array.from(years);
} }
available['downloadUrl'] = url; available['downloadUrl'] = url;
if (url.includes("doi.org/")) { if (url.includes("doi.org/")) {
this.instanceWithDoiExists = true; this.instanceWithDoiExists = true;
} }
if (instance.hasOwnProperty("accessright")) { if (instance.hasOwnProperty("accessright")) {
let length = Array.isArray(instance['accessright']) ? instance['accessright'].length : 1; let length = Array.isArray(instance['accessright']) ? instance['accessright'].length : 1;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
let accessRight = Array.isArray(instance['accessright']) ? instance['accessright'][i] : instance['accessright']; let accessRight = Array.isArray(instance['accessright']) ? instance['accessright'][i] : instance['accessright'];
if (this.changeBestAccessMode(available.accessRight, accessRight)) { if (this.changeBestAccessMode(available.accessRight, accessRight)) {
available.accessRight = accessRight.classname; available.accessRight = accessRight.classname;
if (this.changeBestAccessMode(globalAccessRight, accessRight)) { if (this.changeBestAccessMode(globalAccessRight, accessRight)) {
@ -349,9 +349,9 @@ export class ParsingFunctions {
} }
} }
} }
} }
if (available.accessRight) { if (available.accessRight) {
if (available.accessRight.toLowerCase().indexOf('open') !== -1) { if (available.accessRight.toLowerCase().indexOf('open') !== -1) {
available.accessRightIcon = this.open; available.accessRightIcon = this.open;
@ -363,18 +363,18 @@ export class ParsingFunctions {
} else { } else {
available.accessRightIcon = this.unknown; available.accessRightIcon = this.unknown;
} }
if (instance.hasOwnProperty("license")) { if (instance.hasOwnProperty("license")) {
available.license = Array.isArray(instance['license']) ? instance['license'][0] : instance['license']; available.license = Array.isArray(instance['license']) ? instance['license'][0] : instance['license'];
} }
hostedBy_collectedFrom.push(available); hostedBy_collectedFrom.push(available);
} }
compareHostedByCollectedFrom(a: HostedByCollectedFrom, b: HostedByCollectedFrom) { compareHostedByCollectedFrom(a: HostedByCollectedFrom, b: HostedByCollectedFrom) {
let firstAccessRight: string = (a.accessRight ? a.accessRight.toLowerCase() : null); let firstAccessRight: string = (a.accessRight ? a.accessRight.toLowerCase() : null);
let secondAccessRight: string = (b.accessRight ? b.accessRight.toLowerCase() : null); let secondAccessRight: string = (b.accessRight ? b.accessRight.toLowerCase() : null);
if (firstAccessRight === secondAccessRight) { if (firstAccessRight === secondAccessRight) {
return 0; return 0;
} else { } else {
@ -406,14 +406,14 @@ export class ParsingFunctions {
} }
return 0; return 0;
} }
// publication & dataset landing : for downloadFrom and publishedIn // publication & dataset landing : for downloadFrom and publishedIn
changeBestAccessMode(currentAccessMode: string, accessMode: any): boolean { changeBestAccessMode(currentAccessMode: string, accessMode: any): boolean {
if (!accessMode) { if (!accessMode) {
return false; return false;
} }
accessMode = accessMode.classid; accessMode = accessMode.classid;
switch (currentAccessMode) { switch (currentAccessMode) {
case null: case null:
if (accessMode != "UNKNOWN") { if (accessMode != "UNKNOWN") {
@ -422,22 +422,22 @@ export class ParsingFunctions {
return false; return false;
case "CLOSED": case "CLOSED":
if (accessMode == "OPEN" || if (accessMode == "OPEN" ||
accessMode == "OPEN SOURCE" || accessMode == "OPEN SOURCE" ||
accessMode == "EMBARGO" || accessMode == "EMBARGO" ||
accessMode == "RESTRICTED") { accessMode == "RESTRICTED") {
return true; return true;
} }
return false; return false;
case "RESTRICTED": case "RESTRICTED":
if (accessMode == "OPEN" || if (accessMode == "OPEN" ||
accessMode == "OPEN SOURCE" || accessMode == "OPEN SOURCE" ||
accessMode == "EMBARGO") { accessMode == "EMBARGO") {
return true; return true;
} }
return false; return false;
case "EMBARGO": case "EMBARGO":
if (accessMode == "OPEN" || if (accessMode == "OPEN" ||
accessMode == "OPEN SOURCE") { accessMode == "OPEN SOURCE") {
return true; return true;
} }
return false; return false;
@ -449,13 +449,13 @@ export class ParsingFunctions {
} }
return false; return false;
} }
// publication & dataset & software & orp landing : for relatedResearchResults // publication & dataset & software & orp landing : for relatedResearchResults
parseResults(researchResults: RelationResult[], relation, provenanceAction: string, relationName: string): RelationResult[] { parseResults(researchResults: RelationResult[], relation, provenanceAction: string, relationName: string): RelationResult[] {
if (researchResults == undefined) { if (researchResults == undefined) {
researchResults = []; researchResults = [];
} }
let researchResult: RelationResult = { let researchResult: RelationResult = {
name: "", name: "",
id: "", id: "",
@ -466,9 +466,9 @@ export class ParsingFunctions {
provenanceAction: provenanceAction, provenanceAction: provenanceAction,
relationName: relationName relationName: relationName
}; };
// researchResult.relationName = relation.to.class; // researchResult.relationName = relation.to.class;
if (relation['resulttype']) { if (relation['resulttype']) {
if (relation['resulttype'].classname == "publication") { if (relation['resulttype'].classname == "publication") {
researchResult['class'] = "publication"; researchResult['class'] = "publication";
@ -513,7 +513,7 @@ export class ParsingFunctions {
researchResults.push(researchResult); researchResults.push(researchResult);
return researchResults; return researchResults;
} }
sortByPercentage(results: RelationResult[]): RelationResult[] { sortByPercentage(results: RelationResult[]): RelationResult[] {
if (results) { if (results) {
return results.sort(function (a, b) { return results.sort(function (a, b) {
@ -522,11 +522,11 @@ export class ParsingFunctions {
} }
return results; return results;
} }
// publication & dataset landing : for identifiers // publication & dataset landing : for identifiers
parseIdentifiers(pid: any): Map<string, string[]> { parseIdentifiers(pid: any): Map<string, string[]> {
let identifiers = new Map<string, string[]>(); let identifiers = new Map<string, string[]>();
if (pid.hasOwnProperty("classid") && pid['classid'] != "") { if (pid.hasOwnProperty("classid") && pid['classid'] != "") {
if (pid.classid == "doi" || pid.classid == "pmc" || pid.classid == "handle" || pid.classid == "pmid" || pid.classid == "re3data") { if (pid.classid == "doi" || pid.classid == "pmc" || pid.classid == "handle" || pid.classid == "pmid" || pid.classid == "re3data") {
if (!identifiers.has(pid.classid)) { if (!identifiers.has(pid.classid)) {
@ -546,15 +546,15 @@ export class ParsingFunctions {
} }
return identifiers; return identifiers;
} }
// publication & dataset landing : for subjects and otherSubjects and classifiedSubjects // publication & dataset landing : for subjects and otherSubjects and classifiedSubjects
parseEoscSubjects(_subjects: any): any[] { parseEoscSubjects(_subjects: any): any[] {
let eoscSubjectsFound = []; let eoscSubjectsFound = [];
let setOfEoscSubjects: Set<string> = new Set(); let setOfEoscSubjects: Set<string> = new Set();
let subject; let subject;
let length = Array.isArray(_subjects) ? _subjects.length : 1; let length = Array.isArray(_subjects) ? _subjects.length : 1;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
subject = Array.isArray(_subjects) ? _subjects[i] : _subjects; subject = Array.isArray(_subjects) ? _subjects[i] : _subjects;
let content: string = subject.code + ""; let content: string = subject.code + "";
@ -565,10 +565,10 @@ export class ParsingFunctions {
eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"]; eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"];
} }
} }
return eoscSubjectsFound; return eoscSubjectsFound;
} }
// publication & dataset landing : for subjects and otherSubjects and classifiedSubjects // publication & dataset landing : for subjects and otherSubjects and classifiedSubjects
parseAllSubjects(_subjects: any, vocabulary: any): [string[], Map<string, string[]>, Map<string, string[]>, string[], string[],] { parseAllSubjects(_subjects: any, vocabulary: any): [string[], Map<string, string[]>, Map<string, string[]>, string[], string[],] {
// let eoscSubjectsFound = []; // let eoscSubjectsFound = [];
@ -577,12 +577,12 @@ export class ParsingFunctions {
let classifiedSubjects: Map<string, string[]>; let classifiedSubjects: Map<string, string[]>;
let fos: string[]; let fos: string[];
let sdg: string[]; let sdg: string[];
let setOfEoscSubjects: Set<string> = new Set(); let setOfEoscSubjects: Set<string> = new Set();
let subject; let subject;
let length = Array.isArray(_subjects) ? _subjects.length : 1; let length = Array.isArray(_subjects) ? _subjects.length : 1;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
subject = Array.isArray(_subjects) ? _subjects[i] : _subjects; subject = Array.isArray(_subjects) ? _subjects[i] : _subjects;
if (subject.classid != "") { if (subject.classid != "") {
@ -615,7 +615,7 @@ export class ParsingFunctions {
if (classifiedSubjects == undefined) { if (classifiedSubjects == undefined) {
classifiedSubjects = new Map<string, string[]>(); classifiedSubjects = new Map<string, string[]>();
} }
let content: string = subject.content + ""; let content: string = subject.content + "";
// let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content); // let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content);
// let found: boolean = checkAndAddEoscSubjectResp["found"]; // let found: boolean = checkAndAddEoscSubjectResp["found"];
@ -648,10 +648,10 @@ export class ParsingFunctions {
} }
return [subjects, otherSubjects, classifiedSubjects, fos, sdg]; return [subjects, otherSubjects, classifiedSubjects, fos, sdg];
} }
checkAndAddEoscSubject(setOfEoscSubjects: Set<string>, eoscSubjectsFound, subject, content) { checkAndAddEoscSubject(setOfEoscSubjects: Set<string>, eoscSubjectsFound, subject, content) {
let found: boolean = false; let found: boolean = false;
if (!setOfEoscSubjects.has(content)) { if (!setOfEoscSubjects.has(content)) {
// looping through our declared array // looping through our declared array
this.eoscSubjects.forEach(item => { this.eoscSubjects.forEach(item => {
@ -664,10 +664,10 @@ export class ParsingFunctions {
} }
return {"found": found, "setOfEoscSubject": setOfEoscSubjects, "eoscSubjectsFound": eoscSubjectsFound}; return {"found": found, "setOfEoscSubject": setOfEoscSubjects, "eoscSubjectsFound": eoscSubjectsFound};
} }
parseContexts(_contexts: any): Context[] { parseContexts(_contexts: any): Context[] {
let contexts = new Array<Context>(); let contexts = new Array<Context>();
let position = 0; let position = 0;
let labels = ""; let labels = "";
let context; let context;
@ -675,7 +675,7 @@ export class ParsingFunctions {
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
let numOfCategories: number = 0; // count categories with label let numOfCategories: number = 0; // count categories with label
context = Array.isArray(_contexts) ? _contexts[i] : _contexts; context = Array.isArray(_contexts) ? _contexts[i] : _contexts;
if (context.label && context.hasOwnProperty("type") && (context['type'] == "community" || context['type'] == "ri")) { if (context.label && context.hasOwnProperty("type") && (context['type'] == "community" || context['type'] == "ri")) {
if (context.hasOwnProperty("category")) { if (context.hasOwnProperty("category")) {
let category; let category;
@ -688,7 +688,7 @@ export class ParsingFunctions {
let length1 = Array.isArray(category['concept']) ? category['concept'].length : 1; let length1 = Array.isArray(category['concept']) ? category['concept'].length : 1;
for (let j = 0; j < length1; j++) { for (let j = 0; j < length1; j++) {
categoryConcept = Array.isArray(category['concept']) ? category['concept'][j] : category['concept']; categoryConcept = Array.isArray(category['concept']) ? category['concept'][j] : category['concept'];
// initalize if there is concept label or this is the last concept of the category and there were no concepts // initalize if there is concept label or this is the last concept of the category and there were no concepts
// otherwise we could have multiple entries for the same category but without concepts // otherwise we could have multiple entries for the same category but without concepts
if (categoryConcept.label || (numOfConcepts == 0 && j == (length1 - 1))) { if (categoryConcept.label || (numOfConcepts == 0 && j == (length1 - 1))) {
@ -703,7 +703,7 @@ export class ParsingFunctions {
contexts[position]['idCategory'] = category.id; contexts[position]['idCategory'] = category.id;
contexts[position]['labelConcept'] = categoryConcept.label ? categoryConcept.label : null; contexts[position]['labelConcept'] = categoryConcept.label ? categoryConcept.label : null;
contexts[position]['idConcept'] = categoryConcept.label ? categoryConcept.id : null; contexts[position]['idConcept'] = categoryConcept.label ? categoryConcept.id : null;
position++; position++;
numOfConcepts++; numOfConcepts++;
} }
@ -743,7 +743,7 @@ export class ParsingFunctions {
} }
return contexts; return contexts;
} }
public static getEnermapsConceptId(contexts: any): string { public static getEnermapsConceptId(contexts: any): string {
let enermapsconcepts = contexts.filter(c => { let enermapsconcepts = contexts.filter(c => {
return c.idCategory == "enermaps::selection" && c.idConcept return c.idCategory == "enermaps::selection" && c.idConcept
@ -751,7 +751,7 @@ export class ParsingFunctions {
return enermapsconcepts && enermapsconcepts.length > 0 ? enermapsconcepts[0].idConcept.split("enermaps::selection::")[1] : null; return enermapsconcepts && enermapsconcepts.length > 0 ? enermapsconcepts[0].idConcept.split("enermaps::selection::")[1] : null;
// return "hotmaps_heat_tot_curr_density" // return "hotmaps_heat_tot_curr_density"
} }
parseTypes(types: string[], uniqueTypes: Set<string>, instance: any) { parseTypes(types: string[], uniqueTypes: Set<string>, instance: any) {
if (instance && instance.hasOwnProperty("instancetype") && instance['instancetype'].classname) { if (instance && instance.hasOwnProperty("instancetype") && instance['instancetype'].classname) {
if (!uniqueTypes.has(instance['instancetype'].classname)) { if (!uniqueTypes.has(instance['instancetype'].classname)) {
@ -760,10 +760,10 @@ export class ParsingFunctions {
} }
} }
} }
parseLanguages(_languages: any) { parseLanguages(_languages: any) {
var languages = new Array<string>(); var languages = new Array<string>();
if (!Array.isArray(_languages)) { if (!Array.isArray(_languages)) {
if (_languages.classname != "Undetermined" && _languages.classname) { if (_languages.classname != "Undetermined" && _languages.classname) {
languages.push(_languages.classname); languages.push(_languages.classname);
@ -777,10 +777,10 @@ export class ParsingFunctions {
} }
return languages; return languages;
} }
parseCountries(_countries: any) { parseCountries(_countries: any) {
var countries = new Array<string>(); var countries = new Array<string>();
if (!Array.isArray(_countries)) { if (!Array.isArray(_countries)) {
if (_countries.classname != "Undetermined" && _countries.classname) { if (_countries.classname != "Undetermined" && _countries.classname) {
countries.push(_countries.classname); countries.push(_countries.classname);
@ -794,10 +794,10 @@ export class ParsingFunctions {
} }
return countries; return countries;
} }
parseProgrammingLanguages(_pLanguages) { parseProgrammingLanguages(_pLanguages) {
var pLanguages = new Array<string>(); var pLanguages = new Array<string>();
if (!Array.isArray(_pLanguages)) { if (!Array.isArray(_pLanguages)) {
if (_pLanguages.classname != "Undetermined" && _pLanguages.classname) { if (_pLanguages.classname != "Undetermined" && _pLanguages.classname) {
pLanguages.push(_pLanguages.classname); pLanguages.push(_pLanguages.classname);
@ -811,7 +811,7 @@ export class ParsingFunctions {
} }
return pLanguages; return pLanguages;
} }
parseReferences(citations: any): Reference[] { parseReferences(citations: any): Reference[] {
let references: Reference[] = []; let references: Reference[] = [];
citations = Array.isArray(citations) ? citations : [citations]; citations = Array.isArray(citations) ? citations : [citations];
@ -834,7 +834,7 @@ export class ParsingFunctions {
}); });
return references; return references;
} }
static parseRelCanonicalId(record, type) { static parseRelCanonicalId(record, type) {
try { try {
if (record["result"]["metadata"]["oaf:entity"][("oaf:" + type)]["children"] && record["result"]["metadata"]["oaf:entity"][("oaf:" + type)]["children"][type]) { if (record["result"]["metadata"]["oaf:entity"][("oaf:" + type)]["children"] && record["result"]["metadata"]["oaf:entity"][("oaf:" + type)]["children"][type]) {
@ -846,9 +846,9 @@ export class ParsingFunctions {
// console.error(e); // console.error(e);
} }
return record["result"]["header"]["dri:objIdentifier"]; return record["result"]["header"]["dri:objIdentifier"];
} }
parseDescription(description, stripHTML: boolean = false): string { parseDescription(description, stripHTML: boolean = false): string {
let abstracts = []; let abstracts = [];
if (!Array.isArray(description)) { if (!Array.isArray(description)) {
@ -867,83 +867,89 @@ export class ParsingFunctions {
return abstracts.length > 0 ? ('<p>' + abstracts.join('</p> <p>') + '</p>') : abstracts.join(' '); return abstracts.length > 0 ? ('<p>' + abstracts.join('</p> <p>') + '</p>') : abstracts.join(' ');
} }
} }
parseMeasures(measures: any[]): Measure { parseMeasures(elements: any[]): Measure {
if (measures && measures.length) { if (elements && elements.length) {
let parsed: Measure = { let bip: Metric[] = [];
"downloads": null, let counts: Metric[] = [];
"views": null, let measure: Measure = {};
"popularity": null, elements.forEach(element => {
"influence": null, if (element.id == 'views') {
"citations": null, counts.push({name: 'views', icon: 'visibility', value: element.count, order: 0});
"impulse": null measure.views = element.count;
};
measures.forEach(measure => {
if (measure.id == 'downloads') {
// parsed.downloads = measure.count == 0 ? ' - ' : measure.count;
parsed.downloads = measure.count;
} }
if (measure.id == 'views') { if (element.id == 'downloads') {
// parsed.views = measure.count == 0 ? ' - ' : measure.count; counts.push({name: 'downloads', icon: 'download', value: element.count, order: 1});
parsed.views = measure.count; measure.downloads = element.count;
} }
if (measure.id == 'influence') { if (element.id == 'influence_alt') {
if (measure.class == 'C1') { bip.push({name: 'citations', icon: 'cite', value: element.score, order: 2});
parsed.influence = 'Top 0.01%'; measure.citations = element.score;
} else if (measure.class == 'C2') { }
parsed.influence = 'Top 0.1%'; if (element.id == 'popularity') {
} else if (measure.class == 'C3') { let metric: Metric = {name: 'popularity', icon: 'fire', value: null, order: 3};
parsed.influence = 'Top 1%'; if (element.class == 'C1') {
} else if (measure.class == 'C4') { metric.value = 'Top 0.01%';
parsed.influence = 'Top 10%'; } else if (element.class == 'C2') {
} else if (measure.class == 'A') { metric.value = 'Top 0.1%';
parsed.influence = 'Exceptional'; } else if (element.class == 'C3') {
} else if (measure.class == 'B') { metric.value = 'Top 1%';
parsed.influence = 'Substantial'; } else if (element.class == 'C4') {
metric.value = 'Top 10%';
} else if (element.class == 'A') {
metric.value = 'Exceptional';
} else if (element.class == 'B') {
metric.value = 'Substantial';
} else { } else {
parsed.influence = 'Average'; metric.value = 'Average';
} }
measure.popularity = metric.value;
bip.push(metric);
} }
if (measure.id == 'popularity') { if (element.id == 'influence') {
if (measure.class == 'C1') { let metric: Metric = {name: 'influence', icon: 'landmark', value: null, order: 4};
parsed.popularity = 'Top 0.01%'; if (element.class == 'C1') {
} else if (measure.class == 'C2') { metric.value = 'Top 0.01%';
parsed.popularity = 'Top 0.1%'; } else if (element.class == 'C2') {
} else if (measure.class == 'C3') { metric.value = 'Top 0.1%';
parsed.popularity = 'Top 1%'; } else if (element.class == 'C3') {
} else if (measure.class == 'C4') { metric.value = 'Top 1%';
parsed.popularity = 'Top 10%'; } else if (element.class == 'C4') {
} else if (measure.class == 'A') { metric.value = 'Top 10%';
parsed.popularity = 'Exceptional'; } else if (element.class == 'A') {
} else if (measure.class == 'B') { metric.value = 'Exceptional';
parsed.popularity = 'Substantial'; } else if (element.class == 'B') {
metric.value = 'Substantial';
} else { } else {
parsed.popularity = 'Average'; metric.value = 'Average';
} }
measure.influence = metric.value;
bip.push(metric);
} }
if (measure.id == 'influence_alt') { if (element.id == 'impulse') {
// parsed['citations'] = measure.score == 0 ? ' - ' : measure.score; let metric: Metric = {name: 'impulse', icon: 'rocket', value: null, order: 5};
parsed.citations = measure.score; if (element.class == 'C1') {
} metric.value = 'Top 0.01%';
if (measure.id == 'impulse') { } else if (element.class == 'C2') {
if (measure.class == 'C1') { metric.value = 'Top 0.1%';
parsed.impulse = 'Top 0.01%'; } else if (element.class == 'C3') {
} else if (measure.class == 'C2') { metric.value = 'Top 1%';
parsed.impulse = 'Top 0.1%'; } else if (element.class == 'C4') {
} else if (measure.class == 'C3') { metric.value = 'Top 10%';
parsed.impulse = 'Top 1%'; } else if (element.class == 'A') {
} else if (measure.class == 'C4') { metric.value = 'Exceptional';
parsed.impulse = 'Top 10%'; } else if (element.class == 'B') {
} else if (measure.class == 'A') { metric.value = 'Substantial';
parsed.impulse = 'Exceptional';
} else if (measure.class == 'B') {
parsed.impulse = 'Substantial';
} else { } else {
parsed.impulse = 'Average'; metric.value = 'Average';
} }
measure.impulse = metric.value;
bip.push(metric);
} }
}); });
return parsed; measure.bip = bip.sort((a, b) => a.order - b.order);
measure.counts = counts.sort((a, b) => a.order - b.order);
return measure;
} }
return null; return null;
} }

View File

@ -17,6 +17,9 @@ import {SdgComponent} from "./sdg.component";
import {IconsModule} from "../../utils/icons/icons.module"; import {IconsModule} from "../../utils/icons/icons.module";
import {AlertModalModule} from "../../utils/modal/alertModal.module"; import {AlertModalModule} from "../../utils/modal/alertModal.module";
import { SearchInputModule } from '../../sharedComponents/search-input/search-input.module'; import { SearchInputModule } from '../../sharedComponents/search-input/search-input.module';
import {EntityMetadataComponent} from "./entity-metadata.component";
import {IconsService} from "../../utils/icons/icons.service";
import {closed_access, open_access} from "../../utils/icons/icons";
@NgModule({ @NgModule({
@ -27,7 +30,8 @@ import { SearchInputModule } from '../../sharedComponents/search-input/search-in
declarations: [ declarations: [
ShowIdentifiersComponent,ShowSubjectsComponent, ShowIdentifiersComponent,ShowSubjectsComponent,
FundedByComponent,AvailableOnComponent,TabTableComponent, FundedByComponent,AvailableOnComponent,TabTableComponent,
RelatedToComponent, FosComponent, SdgComponent RelatedToComponent, FosComponent, SdgComponent,
EntityMetadataComponent
], ],
providers:[ providers:[
], ],
@ -37,4 +41,8 @@ import { SearchInputModule } from '../../sharedComponents/search-input/search-in
RelatedToComponent, FosComponent, SdgComponent RelatedToComponent, FosComponent, SdgComponent
] ]
}) })
export class ResultLandingUtilsModule { } export class ResultLandingUtilsModule {
constructor(private iconsService: IconsService) {
this.iconsService.registerIcons([open_access, closed_access]);
}
}

View File

@ -1,26 +1,26 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common'; import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
import {SharedModule} from '../../../openaireLibrary/shared/shared.module'; import {SharedModule} from '../../../openaireLibrary/shared/shared.module';
import {MetricsModule} from '../landing-utils/metrics/metrics.module'; import {MetricsModule} from '../landing-utils/metrics/metrics.module';
import {LandingModule} from '../landing-utils/landing.module'; import {LandingModule} from '../landing-utils/landing.module';
import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module'; import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module';
import {IFrameModule} from '../../utils/iframe.module'; import {IFrameModule} from '../../utils/iframe.module';
import {AltMetricsModule} from '../../utils/altmetrics.module'; import {AltMetricsModule} from '../../utils/altmetrics.module';
import {PagingModule} from '../../utils/paging.module'; import {PagingModule} from '../../utils/paging.module';
import {ResultLandingService} from './resultLanding.service'; import {ResultLandingService} from './resultLanding.service';
import {ResultLandingComponent} from './resultLanding.component'; import {ResultLandingComponent} from './resultLanding.component';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; import {SEOServiceModule} from '../../sharedComponents/SEO/SEOService.module';
import {DeletedByInferenceModule} from './deletedByInference/deletedByInference.module'; import {DeletedByInferenceModule} from './deletedByInference/deletedByInference.module';
import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module";
import {HelperModule} from "../../utils/helper/helper.module"; import {HelperModule} from "../../utils/helper/helper.module";
import {ResultLandingUtilsModule} from "../landing-utils/resultLandingUtils.module"; import {ResultLandingUtilsModule} from "../landing-utils/resultLandingUtils.module";
import {AlertModalModule} from "../../utils/modal/alertModal.module"; import {AlertModalModule} from "../../utils/modal/alertModal.module";
import {AnnotationModule} from "../annotation/annotation.module"; import {AnnotationModule} from "../annotation/annotation.module";
import {LandingHeaderModule} from "../landing-utils/landing-header/landing-header.module"; import {LandingHeaderModule} from "../landing-utils/landing-header/landing-header.module";
import {NoLoadPaging} from "../../searchPages/searchUtils/no-load-paging.module"; import {NoLoadPaging} from "../../searchPages/searchUtils/no-load-paging.module";
@ -33,7 +33,7 @@ import {MatFormFieldModule} from "@angular/material/form-field";
import {MatSelectModule} from "@angular/material/select"; import {MatSelectModule} from "@angular/material/select";
import {IconsModule} from "../../utils/icons/icons.module"; import {IconsModule} from "../../utils/icons/icons.module";
import {IconsService} from "../../utils/icons/icons.service"; import {IconsService} from "../../utils/icons/icons.service";
import {graph, link, quotes, cite, link_to, versions, rocket, fire, landmark, open_access, closed_access} from "../../utils/icons/icons"; import {cite, fire, graph, landmark, link, link_to, quotes, rocket, versions} from "../../utils/icons/icons";
import {InputModule} from "../../sharedComponents/input/input.module"; import {InputModule} from "../../sharedComponents/input/input.module";
import {EGIDataTransferModule} from "../../utils/dataTransfer/transferData.module"; import {EGIDataTransferModule} from "../../utils/dataTransfer/transferData.module";
import {RecaptchaModule} from 'ng-recaptcha'; import {RecaptchaModule} from 'ng-recaptcha';
@ -61,6 +61,6 @@ import {SdgFosSuggestModule} from '../landing-utils/sdg-fos-suggest/sdg-fos-sugg
}) })
export class ResultLandingModule { export class ResultLandingModule {
constructor(private iconsService: IconsService) { constructor(private iconsService: IconsService) {
this.iconsService.registerIcons([link, graph, quotes, cite, link_to, versions, rocket, fire, landmark, open_access, closed_access]) this.iconsService.registerIcons([link, graph, quotes, cite, link_to, versions, rocket, fire, landmark])
} }
} }

View File

@ -330,7 +330,7 @@ export class ResultLandingService {
this.resultLandingInfo.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom( this.resultLandingInfo.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom(
this.resultLandingInfo.hostedBy_collectedFrom, this.resultLandingInfo.publisher, this.resultLandingInfo.hostedBy_collectedFrom, this.resultLandingInfo.publisher,
this.resultLandingInfo.journal.journal, this.resultLandingInfo.identifiers); this.resultLandingInfo.journal?.journal, this.resultLandingInfo.identifiers);
// res['result']['metadata']['oaf:entity']['oaf:result']['programmingLanguage'] // res['result']['metadata']['oaf:entity']['oaf:result']['programmingLanguage']
if (data[12] != null) { if (data[12] != null) {

View File

@ -17,71 +17,42 @@ declare var UIkit: any;
@Component({ @Component({
selector: 'orcid-work', selector: 'orcid-work',
template: ` template: `
<ng-container *ngIf="pageType == 'search'"> <ng-container *ngIf="pageType == 'landing' || pageType == 'search'">
<span *ngIf="!putCodes || putCodes.length == 0" <span *ngIf="!putCodes || putCodes.length == 0"
[attr.uk-tooltip]="(!isLoggedIn) ? tooltipNoLoggedInUser : tooltipAdd" [attr.uk-tooltip]="'pos: bottom; cls: uk-active uk-text-small uk-padding-small'"
class="uk-margin-remove-bottom"> [title]="(!pids || !isLoggedIn) ? (!pids ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipAdd">
<a (click)="currentAction='add'; saveWorkPreparation();"
[class]="'uk-button uk-button-link uk-flex uk-flex-middle uk-flex-right@s uk-margin-right '+ ((showLoading || !isLoggedIn) ? 'uk-disabled ' : '') + (!isLoggedIn ? 'half-opacity' : '')">
<icon *ngIf="!showLoading" name="add" ratio="1" flex="true"></icon>
<span *ngIf="showLoading" class="uk-icon icon-button"><loading [top_margin]="false" [size]="'small'"></loading></span>
<span class="uk-margin-small-left uk-flex uk-flex-middle">Add to&#160;
<span class="uk-flex uk-flex-middle">
<span>ORCID&#160;</span>
<img class="" src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="orcid" style="width:16px; height:16px" loading="lazy">&#160;
</span>
</span>
</a>
</span>
<span *ngIf="putCodes && putCodes.length > 0"
[attr.uk-tooltip]="(!isLoggedIn) ? tooltipNoLoggedInUser : tooltipDelete"
class="uk-margin-remove-bottom">
<a (click)="currentAction='delete'; deleteWorks();"
[class]="'uk-button uk-button-link uk-flex uk-flex-middle uk-flex-right@s uk-margin-right '+ (showLoading ? 'uk-disabled' : '')">
<icon *ngIf="!showLoading" name="delete" ratio="0.8" flex="true"></icon>
<span *ngIf="showLoading" class="uk-icon icon-button"><loading [top_margin]="false" [size]="'small'"></loading></span>
<span class="uk-margin-small-left uk-flex uk-flex-middle">Delete from&#160;
<span class="uk-flex uk-flex-middle">
<span>ORCID&#160;</span>
<img src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="" loading="lazy">&#160;
</span>
</span>
</a>
</span>
</ng-container>
<ng-container *ngIf="pageType == 'landing'">
<span *ngIf="!putCodes || putCodes.length == 0"
[attr.uk-tooltip]="'pos: bottom; cls: uk-active uk-text-small uk-padding-small'"
[title]="(!pids || !isLoggedIn) ? (!pids ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipAdd">
<a *ngIf="!showLoading" (click)="currentAction='add'; saveWorkPreparation();" <a *ngIf="!showLoading" (click)="currentAction='add'; saveWorkPreparation();"
class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder landing-action-button-orcid" class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder"
[class.uk-disabled]="showLoading || !isLoggedIn || !pids" [class.uk-disabled]="showLoading || !isLoggedIn || !pids"
(mouseover)="hoverEvent($event)" (mouseout)="hoverEvent($event)"> [class.uk-text-muted]="showLoading || !isLoggedIn || !pids"
<icon name="orcid_add" ratio="1" visuallyHidden="add"></icon> (mouseover)="hoverEvent($event)" (mouseout)="hoverEvent($event)">
<icon [class.text-orcid]="!showLoading && isLoggedIn && pids"
[class.uk-text-muted]="showLoading || !isLoggedIn || !pids" name="orcid_add" ratio="1"
visuallyHidden="add"></icon>
<span class="uk-margin-xsmall-left">Claim</span> <span class="uk-margin-xsmall-left">Claim</span>
</a> </a>
<span *ngIf="showLoading" class="uk-icon icon-button uk-icon-button-small"><loading <span *ngIf="showLoading" class="uk-icon icon-button uk-icon-button-small"><loading
[top_margin]="false" [size]="'small'"></loading></span> [top_margin]="false" [size]="'small'"></loading></span>
</span> </span>
<span *ngIf="putCodes && putCodes.length > 0" <span *ngIf="putCodes && putCodes.length > 0"
[attr.uk-tooltip]="'pos: bottom; cls: uk-active uk-text-small uk-padding-small'" [attr.uk-tooltip]="'pos: bottom; cls: uk-active uk-text-small uk-padding-small'"
[title]="(!pids || !isLoggedIn) ? (!pids ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipDelete"> [title]="(!pids || !isLoggedIn) ? (!pids ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipDelete">
<a *ngIf="!showLoading" (click)="currentAction='delete'; deleteWorks();" <a *ngIf="!showLoading" (click)="currentAction='delete'; deleteWorks();"
class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder landing-action-button-orcid" class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder"
[class.uk-disabled]="showLoading || !isLoggedIn || !pids" [class.uk-disabled]="showLoading || !isLoggedIn || !pids"
(mouseover)="hoverEvent($event, 'delete')" (mouseout)="hoverEvent($event, 'delete')"> [class.uk-text-muted]="showLoading || !isLoggedIn || !pids"
<icon name="orcid_bin" ratio="1" visuallyHidden="delete"></icon> (mouseover)="hoverEvent($event, 'delete')" (mouseout)="hoverEvent($event, 'delete')">
<icon [class.text-orcid]="!showLoading && isLoggedIn && pids"
[class.uk-text-muted]="showLoading || !isLoggedIn || !pids" name="orcid_bin" ratio="1"
visuallyHidden="delete"></icon>
<span class="uk-margin-xsmall-left">Remove</span> <span class="uk-margin-xsmall-left">Remove</span>
</a> </a>
<span *ngIf="showLoading" class="uk-icon icon-button uk-icon-button-small"><loading <span *ngIf="showLoading" class="uk-icon icon-button uk-icon-button-small"><loading
[top_margin]="false" [size]="'small'"></loading></span> [top_margin]="false" [size]="'small'"></loading></span>
</span> </span>
<!-- Old 'remove' code --> <!-- Old 'remove' code -->
<!-- <span *ngIf="putCodes && putCodes.length > 0" <!-- <span *ngIf="putCodes && putCodes.length > 0"
[attr.uk-tooltip]="'pos: bottom; cls: uk-active uk-text-small uk-padding-small'" [attr.uk-tooltip]="'pos: bottom; cls: uk-active uk-text-small uk-padding-small'"
[title]="(!pids || !isLoggedIn) ? (!pids ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipDelete"> [title]="(!pids || !isLoggedIn) ? (!pids ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipDelete">
@ -101,23 +72,23 @@ declare var UIkit: any;
<div> <div>
<div>{{requestGrantMessage}}</div> <div>{{requestGrantMessage}}</div>
<!-- <div class="uk-margin-medium-top uk-align-right">--> <!-- <div class="uk-margin-medium-top uk-align-right">-->
<!-- <button (click)="closeGrantModal()" type="submit"--> <!-- <button (click)="closeGrantModal()" type="submit"-->
<!-- class="uk-button uk-padding-small uk-padding-remove-vertical uk-button-default">--> <!-- class="uk-button uk-padding-small uk-padding-remove-vertical uk-button-default">-->
<!-- <span>Cancel</span>--> <!-- <span>Cancel</span>-->
<!-- </button>--> <!-- </button>-->
<!-- <button (click)="openGrantWindow()" type="submit"--> <!-- <button (click)="openGrantWindow()" type="submit"-->
<!-- class="uk-button uk-padding-small uk-padding-remove-vertical uk-margin-left uk-button-primary">--> <!-- class="uk-button uk-padding-small uk-padding-remove-vertical uk-margin-left uk-button-primary">-->
<!-- <span>Grant OpenAIRE</span>--> <!-- <span>Grant OpenAIRE</span>-->
<!-- </button>--> <!-- </button>-->
<!--&lt;!&ndash; <button (click)="openGrantWindow()" type="submit"&ndash;&gt;--> <!--&lt;!&ndash; <button (click)="openGrantWindow()" type="submit"&ndash;&gt;-->
<!--&lt;!&ndash; class="uk-button uk-padding-small uk-padding-remove-vertical uk-margin-left orcid-button">&ndash;&gt;--> <!--&lt;!&ndash; class="uk-button uk-padding-small uk-padding-remove-vertical uk-margin-left orcid-button">&ndash;&gt;-->
<!--&lt;!&ndash; <img src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="">{{" "}}&ndash;&gt;--> <!--&lt;!&ndash; <img src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="">{{" "}}&ndash;&gt;-->
<!--&lt;!&ndash; <span>Create or Connect your ORCID iD</span>&ndash;&gt;--> <!--&lt;!&ndash; <span>Create or Connect your ORCID iD</span>&ndash;&gt;-->
<!--&lt;!&ndash; </button>&ndash;&gt;--> <!--&lt;!&ndash; </button>&ndash;&gt;-->
<!-- </div>--> <!-- </div>-->
</div> </div>
</modal-alert> </modal-alert>
@ -128,27 +99,29 @@ declare var UIkit: any;
<img src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="" loading="lazy"> <img src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="" loading="lazy">
<span>&#160;ACTIONS</span> <span>&#160;ACTIONS</span>
</span> </span>
<span [attr.uk-tooltip]="(!putCodes || putCodes.length == 0) <span [attr.uk-tooltip]="(!putCodes || putCodes.length == 0)
? 'This work is currently deleted.' ? 'This work is currently deleted.'
: 'View this work from your ORCID record'"> : 'View this work from your ORCID record'">
<a (click)="currentAction='get'; getOrcidWorks()" <a (click)="currentAction='get'; getOrcidWorks()"
[class]="'uk-button uk-button-default action uk-flex uk-flex-middle '+ ((showLoading || !putCodes || putCodes.length == 0) ? 'uk-disabled' : '')"> [class]="'uk-button uk-button-default action uk-flex uk-flex-middle '+ ((showLoading || !putCodes || putCodes.length == 0) ? 'uk-disabled' : '')">
<icon *ngIf="!showLoading || currentAction!='get'" name="visibility" ratio="1" flex="true"></icon> <icon *ngIf="!showLoading || currentAction!='get'" name="visibility" ratio="1" flex="true"></icon>
<span *ngIf="showLoading && currentAction=='get'" class="uk-icon icon-button"><loading [top_margin]="false" [size]="'small'"></loading></span> <span *ngIf="showLoading && currentAction=='get'" class="uk-icon icon-button"><loading [top_margin]="false"
[size]="'small'"></loading></span>
<span class="uk-margin-small-left">View ORCID work</span> <span class="uk-margin-small-left">View ORCID work</span>
</a> </a>
</span> </span>
<span [attr.uk-tooltip]="(!putCodes || putCodes.length == 0) <span [attr.uk-tooltip]="(!putCodes || putCodes.length == 0)
? 'This work is currently deleted.' ? 'This work is currently deleted.'
: ('Update this work to your ORCID record' + ((properties.environment == 'beta') ? '. The action will affect your real ORCID iD.' : '') : ('Update this work to your ORCID record' + ((properties.environment == 'beta') ? '. The action will affect your real ORCID iD.' : '')
+ showUpdateDatesInTooltip())"> + showUpdateDatesInTooltip())">
<a (click)="currentAction='update'; updateWorkPreparation()" <a (click)="currentAction='update'; updateWorkPreparation()"
[class]="'uk-button uk-button-default action uk-margin-top uk-flex uk-flex-middle '+ ((showLoading || !putCodes || putCodes.length == 0) ? 'uk-disabled' : '')"> [class]="'uk-button uk-button-default action uk-margin-top uk-flex uk-flex-middle '+ ((showLoading || !putCodes || putCodes.length == 0) ? 'uk-disabled' : '')">
<icon *ngIf="!showLoading || currentAction!='update'" name="refresh" ratio="1" flex="true"></icon> <icon *ngIf="!showLoading || currentAction!='update'" name="refresh" ratio="1" flex="true"></icon>
<span *ngIf="showLoading && currentAction=='update'" class="uk-icon icon-button"><loading [top_margin]="false" [size]="'small'"></loading></span> <span *ngIf="showLoading && currentAction=='update'" class="uk-icon icon-button"><loading [top_margin]="false"
[size]="'small'"></loading></span>
<span class="uk-margin-small-left">Update ORCID work</span> <span class="uk-margin-small-left">Update ORCID work</span>
</a> </a>
</span> </span>
@ -158,7 +131,8 @@ declare var UIkit: any;
<a (click)="currentAction='add'; saveWorkPreparation();" <a (click)="currentAction='add'; saveWorkPreparation();"
[class]="'uk-button uk-button-default action uk-margin-top uk-flex uk-flex-middle '+ (showLoading ? 'uk-disabled' : '')"> [class]="'uk-button uk-button-default action uk-margin-top uk-flex uk-flex-middle '+ (showLoading ? 'uk-disabled' : '')">
<icon *ngIf="!showLoading || currentAction!='add'" name="add" ratio="1" flex="true"></icon> <icon *ngIf="!showLoading || currentAction!='add'" name="add" ratio="1" flex="true"></icon>
<span *ngIf="showLoading && currentAction=='add'" class="uk-icon icon-button"><loading [top_margin]="false" [size]="'small'"></loading></span> <span *ngIf="showLoading && currentAction=='add'" class="uk-icon icon-button"><loading [top_margin]="false"
[size]="'small'"></loading></span>
<span class="uk-margin-small-left">Add to ORCID</span> <span class="uk-margin-small-left">Add to ORCID</span>
</a> </a>
</span> </span>
@ -168,7 +142,8 @@ declare var UIkit: any;
<a (click)="currentAction='delete'; deleteWorks();" <a (click)="currentAction='delete'; deleteWorks();"
[class]="'uk-button uk-button-default action uk-margin-top uk-flex uk-flex-middle '+ (showLoading ? 'uk-disabled' : '')"> [class]="'uk-button uk-button-default action uk-margin-top uk-flex uk-flex-middle '+ (showLoading ? 'uk-disabled' : '')">
<icon *ngIf="!showLoading || currentAction!='delete'" name="delete" ratio="1" flex="true"></icon> <icon *ngIf="!showLoading || currentAction!='delete'" name="delete" ratio="1" flex="true"></icon>
<span *ngIf="showLoading && currentAction=='delete'" class="uk-icon icon-button"><loading [top_margin]="false" [size]="'small'"></loading></span> <span *ngIf="showLoading && currentAction=='delete'" class="uk-icon icon-button"><loading [top_margin]="false"
[size]="'small'"></loading></span>
<span class="uk-margin-small-left">Delete from ORCID</span> <span class="uk-margin-small-left">Delete from ORCID</span>
</a> </a>
</span> </span>
@ -188,9 +163,9 @@ declare var UIkit: any;
<div class="uk-card uk-card-default uk-padding uk-card-hover"> <div class="uk-card uk-card-default uk-padding uk-card-hover">
<div>{{work.title?.title?.value}}</div> <div>{{work.title?.title?.value}}</div>
<div>{{work.title?.subtitle?.value}}</div> <div>{{work.title?.subtitle?.value}}</div>
<div class="uk-text-uppercase">{{work['journal-title']?.value}}</div> <div class="uk-text-uppercase">{{work['journal-title']?.value}}</div>
<div *ngIf="work['publication-date'] || work['type']" class="uk-text-small uk-margin-small-bottom"> <div *ngIf="work['publication-date'] || work['type']" class="uk-text-small uk-margin-small-bottom">
<span *ngIf="work['publication-date']"> <span *ngIf="work['publication-date']">
<span *ngIf="work['publication-date']['year'] && work['publication-date']['year'].value"> <span *ngIf="work['publication-date']['year'] && work['publication-date']['year'].value">
@ -224,11 +199,11 @@ declare var UIkit: any;
{{work['short-description']}} {{work['short-description']}}
</p> </p>
</div> </div>
<div *ngIf="work['external-ids'] && work['external-ids']['external-id']" class="uk-margin-small-bottom"> <div *ngIf="work['external-ids'] && work['external-ids']['external-id']" class="uk-margin-small-bottom">
<showIdentifiers [identifiers]="parseIdentifiers(work['external-ids']['external-id'])"></showIdentifiers> <showIdentifiers [identifiers]="parseIdentifiers(work['external-ids']['external-id'])"></showIdentifiers>
</div> </div>
<div *ngIf="work['contributors'] && work['contributors']['contributor']"> <div *ngIf="work['contributors'] && work['contributors']['contributor']">
<div *ngFor="let contributor of work['contributors']['contributor']"> <div *ngFor="let contributor of work['contributors']['contributor']">
<span *ngIf="contributor['credit-name'] && contributor['credit-name'].value"> <span *ngIf="contributor['credit-name'] && contributor['credit-name'].value">
@ -238,24 +213,26 @@ declare var UIkit: any;
(contributor['contributor-attributes'] && contributor['contributor-attributes']['contributor-role']) (contributor['contributor-attributes'] && contributor['contributor-attributes']['contributor-role'])
|| ||
(contributor['contributor-attributes'] && contributor['contributor-attributes']['contributor-sequence']) (contributor['contributor-attributes'] && contributor['contributor-attributes']['contributor-sequence'])
|| ||
(contributor['contributor-orcid'] && contributor['contributor-orcid']['path']) (contributor['contributor-orcid'] && contributor['contributor-orcid']['path'])
)"> )">
( (
</span> </span>
<span *ngIf="contributor['contributor-attributes'] && contributor['contributor-attributes']['contributor-role']"> <span
*ngIf="contributor['contributor-attributes'] && contributor['contributor-attributes']['contributor-role']">
{{contributor['contributor-attributes']['contributor-role']}} {{contributor['contributor-attributes']['contributor-role']}}
</span> </span>
<span *ngIf="(contributor['contributor-attributes'] && contributor['contributor-attributes']['contributor-role']) <span *ngIf="(contributor['contributor-attributes'] && contributor['contributor-attributes']['contributor-role'])
&& (contributor['contributor-attributes']['contributor-sequence'] || (contributor['contributor-orcid'] && contributor['contributor-orcid']['path']))"> && (contributor['contributor-attributes']['contributor-sequence'] || (contributor['contributor-orcid'] && contributor['contributor-orcid']['path']))">
, ,
</span> </span>
<span *ngIf="contributor['contributor-attributes'] && contributor['contributor-attributes']['contributor-sequence']"> <span
*ngIf="contributor['contributor-attributes'] && contributor['contributor-attributes']['contributor-sequence']">
{{contributor['contributor-attributes']['contributor-sequence']}} {{contributor['contributor-attributes']['contributor-sequence']}}
</span> </span>
<span *ngIf="contributor['contributor-attributes'] && contributor['contributor-attributes']['contributor-sequence'] <span *ngIf="contributor['contributor-attributes'] && contributor['contributor-attributes']['contributor-sequence']
&& contributor['contributor-orcid'] && contributor['contributor-orcid']['path']"> && contributor['contributor-orcid'] && contributor['contributor-orcid']['path']">
, ,
</span> </span>
<span *ngIf="contributor['contributor-orcid'] && contributor['contributor-orcid']['path']"> <span *ngIf="contributor['contributor-orcid'] && contributor['contributor-orcid']['path']">
{{contributor['contributor-orcid']?.path}} {{contributor['contributor-orcid']?.path}}
@ -276,28 +253,31 @@ declare var UIkit: any;
<modal-alert #propagationModal (alertOutput)="confirmedPropagation()"> <modal-alert #propagationModal (alertOutput)="confirmedPropagation()">
<div> <div>
This {{openaireEntities.RESULT}} is the result of <span class="uk-text-bold"> merged {{openaireEntities.RESULTS}} in OpenAIRE</span>. This {{openaireEntities.RESULT}} is the result of <span
class="uk-text-bold"> merged {{openaireEntities.RESULTS}} in OpenAIRE</span>.
<br><br> <br><br>
You have already added <span class="uk-text-bold">{{this.putCodes?.length}} works</span> in your ORCID record related to the merged {{openaireEntities.RESULT}}. You have already added <span class="uk-text-bold">{{this.putCodes?.length}} works</span> in your ORCID record
related to the merged {{openaireEntities.RESULT}}.
<div *ngIf="currentAction == 'delete'"> <div *ngIf="currentAction == 'delete'">
If you continue with delete action, <span class="uk-text-bold">all these works will be deleted</span>. If you continue with delete action, <span class="uk-text-bold">all these works will be deleted</span>.
</div> </div>
<div *ngIf="currentAction == 'update'"> <div *ngIf="currentAction == 'update'">
If you continue with update action, <span class="uk-text-bold">all these works will be deleted and a new merged work will be added</span> instead. If you continue with update action, <span class="uk-text-bold">all these works will be deleted and a new merged work will be added</span>
instead.
</div> </div>
</div> </div>
<!-- <div class="uk-margin-medium-top uk-align-right">--> <!-- <div class="uk-margin-medium-top uk-align-right">-->
<!-- <button (click)="closePropagationModal()" type="submit"--> <!-- <button (click)="closePropagationModal()" type="submit"-->
<!-- class="uk-button uk-padding-small uk-padding-remove-vertical uk-button-default">--> <!-- class="uk-button uk-padding-small uk-padding-remove-vertical uk-button-default">-->
<!-- <span>Cancel</span>--> <!-- <span>Cancel</span>-->
<!-- </button>--> <!-- </button>-->
<!-- <button (click)="confirmedPropagation()" type="submit"--> <!-- <button (click)="confirmedPropagation()" type="submit"-->
<!-- class="uk-button uk-padding-small uk-padding-remove-vertical uk-margin-left uk-button-primary">--> <!-- class="uk-button uk-padding-small uk-padding-remove-vertical uk-margin-left uk-button-primary">-->
<!-- <span>Continue</span>--> <!-- <span>Continue</span>-->
<!-- </button>--> <!-- </button>-->
<!-- </div>--> <!-- </div>-->
</modal-alert> </modal-alert>
` `
}) })
@ -314,54 +294,54 @@ export class OrcidWorkComponent {
@Input() updateDates: string[] = []; @Input() updateDates: string[] = [];
@Input() givenPutCode: boolean = false; @Input() givenPutCode: boolean = false;
@Input() pageType: string = "search"; @Input() pageType: string = "search";
public subscriptions: Subscription[] = []; public subscriptions: Subscription[] = [];
@ViewChild('workModal') workModal; @ViewChild('workModal') workModal;
// @ViewChild('saveWorkModal') saveWorkModal; // @ViewChild('saveWorkModal') saveWorkModal;
@ViewChild('grantModal') grantModal; @ViewChild('grantModal') grantModal;
// @ViewChild('messageModal') messageModal; // @ViewChild('messageModal') messageModal;
@ViewChild('propagationModal') propagationModal; @ViewChild('propagationModal') propagationModal;
public requestGrant: boolean = false; public requestGrant: boolean = false;
public requestGrantMessage: string = "Please grant OpenAIRE to access and update your ORCID works."; public requestGrantMessage: string = "Please grant OpenAIRE to access and update your ORCID works.";
private tokenUrl: string; private tokenUrl: string;
public message: string = ""; public message: string = "";
public showLoading: boolean = false; public showLoading: boolean = false;
public works: any[] = []; public works: any[] = [];
public orcidWorks: any[] = []; public orcidWorks: any[] = [];
public window: any; public window: any;
public isLoggedIn: boolean = false; public isLoggedIn: boolean = false;
public currentAction: string = ""; public currentAction: string = "";
public hoverAdd: boolean = false; public hoverAdd: boolean = false;
public hoverDelete: boolean = false; public hoverDelete: boolean = false;
public properties: EnvProperties = properties; public properties: EnvProperties = properties;
public openaireEntities = OpenaireEntities; public openaireEntities = OpenaireEntities;
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private _router: Router, private _router: Router,
private orcidService: OrcidService, private orcidService: OrcidService,
private resultLandingService: ResultLandingService, private resultLandingService: ResultLandingService,
private userManagementService: UserManagementService) { private userManagementService: UserManagementService) {
if(typeof document !== 'undefined') { if (typeof document !== 'undefined') {
this.tokenUrl = properties.orcidTokenURL this.tokenUrl = properties.orcidTokenURL
+ "client_id="+properties.orcidClientId + "client_id=" + properties.orcidClientId
// + "&response_type=code&scope=/activities/update" // + "&response_type=code&scope=/activities/update"
// + "&response_type=code&scope=/authenticate /activities/update /person/update /read-limited" // + "&response_type=code&scope=/authenticate /activities/update /person/update /read-limited"
+ "&response_type=code&scope=/activities/update /read-limited" + "&response_type=code&scope=/activities/update /read-limited"
+ "&redirect_uri="+location.origin+"/orcid?source=openaire"; + "&redirect_uri=" + location.origin + "/orcid?source=openaire";
} }
} }
ngOnInit() { ngOnInit() {
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
if (user) { if (user) {
this.isLoggedIn = true; this.isLoggedIn = true;
if(!this.givenPutCode) { if (!this.givenPutCode) {
this.getPutCode(); this.getPutCode();
} }
} else { } else {
@ -371,7 +351,7 @@ export class OrcidWorkComponent {
this.isLoggedIn = false; this.isLoggedIn = false;
})); }));
} }
ngOnDestroy() { ngOnDestroy() {
this.subscriptions.forEach(subscription => { this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) { if (subscription instanceof Subscriber) {
@ -380,16 +360,16 @@ export class OrcidWorkComponent {
} }
}); });
} }
public showUpdateDatesInTooltip() { public showUpdateDatesInTooltip() {
const monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; const monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
let response: string = ""; let response: string = "";
if(this.updateDates != null && this.updateDates.length > 0) { if (this.updateDates != null && this.updateDates.length > 0) {
response += "<br><br> Last update in ORCID<br>"; response += "<br><br> Last update in ORCID<br>";
for(let i=0; i<this.updateDates.length; i++) { for (let i = 0; i < this.updateDates.length; i++) {
let date: Date = new Date(this.updateDates[i]); let date: Date = new Date(this.updateDates[i]);
response += "<span>"+date.getDate() + " " + monthNames[date.getMonth()] + " " + date.getFullYear(); response += "<span>" + date.getDate() + " " + monthNames[date.getMonth()] + " " + date.getFullYear();
if(i < this.updateDates.length - 1) { if (i < this.updateDates.length - 1) {
response += "& "; response += "& ";
} }
response += "</span>"; response += "</span>";
@ -397,29 +377,34 @@ export class OrcidWorkComponent {
} }
return response; return response;
} }
public parseIdentifiers(identifiers: ExternalIDV3_0[]): Map<string, string[]> { public parseIdentifiers(identifiers: ExternalIDV3_0[]): Map<string, string[]> {
let identifiersMap: Map<string, string[]> = new Map<string, string[]>(); let identifiersMap: Map<string, string[]> = new Map<string, string[]>();
for(let identifier of identifiers) { for (let identifier of identifiers) {
if(!identifiersMap.has(identifier['external-id-type'])) { if (!identifiersMap.has(identifier['external-id-type'])) {
identifiersMap.set(identifier['external-id-type'], new Array<string>()); identifiersMap.set(identifier['external-id-type'], new Array<string>());
} }
identifiersMap.get(identifier['external-id-type']).push(identifier['external-id-value']); identifiersMap.get(identifier['external-id-type']).push(identifier['external-id-value']);
} }
return identifiersMap; return identifiersMap;
} }
openGrantWindow() { openGrantWindow() {
if(!Session.isLoggedIn()){ if (!Session.isLoggedIn()) {
//this.userValidMessage = "User session has expired. Please login again."; //this.userValidMessage = "User session has expired. Please login again.";
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); this._router.navigate(['/user-info'], {
queryParams: {
"errorCode": LoginErrorCodes.NOT_VALID,
"redirectUrl": this._router.url
}
});
} else { } else {
// this.tokenUrl = location.origin+"/orcid"; // this.tokenUrl = location.origin+"/orcid";
this.window = window.open(this.tokenUrl, '_blank', this.window = window.open(this.tokenUrl, '_blank',
'location=yes,height=700,width=540,left=500,top=100,scrollbars=yes,status=yes'); 'location=yes,height=700,width=540,left=500,top=100,scrollbars=yes,status=yes');
// this.requestGrant = false; // this.requestGrant = false;
this.closeGrantModal(); this.closeGrantModal();
let self = this; let self = this;
window.onmessage = function (ev) { window.onmessage = function (ev) {
if (ev.isTrusted && ev.origin == location.origin && ev.data == 'success') { if (ev.isTrusted && ev.origin == location.origin && ev.data == 'success') {
@ -441,17 +426,17 @@ export class OrcidWorkComponent {
} }
} }
} }
private getPutCode() { private getPutCode() {
this.subscriptions.push(this.orcidService.getPutCode(this.pids).subscribe( this.subscriptions.push(this.orcidService.getPutCode(this.pids).subscribe(
putCodes => { putCodes => {
this.putCodes = putCodes; this.putCodes = putCodes;
}, error => { }, error => {
} }
)) ))
} }
private getResultLandingInfo(action: string) { private getResultLandingInfo(action: string) {
this.subscriptions.push(this.resultLandingService.getResultLandingInfo(this.resultId, null, this.type, null, properties).subscribe( this.subscriptions.push(this.resultLandingService.getResultLandingInfo(this.resultId, null, this.type, null, properties).subscribe(
resultLandingInfo => { resultLandingInfo => {
@ -463,7 +448,7 @@ export class OrcidWorkComponent {
} }
this.pids = pidsArray.join(); this.pids = pidsArray.join();
} }
if(action == "save") { if (action == "save") {
this.saveWork(); this.saveWork();
} else if (action == "update") { } else if (action == "update") {
this.updateWork(); this.updateWork();
@ -475,18 +460,23 @@ export class OrcidWorkComponent {
} }
)) ))
} }
public saveWorkPreparation() { public saveWorkPreparation() {
if(!Session.isLoggedIn()){ if (!Session.isLoggedIn()) {
//this.userValidMessage = "User session has expired. Please login again."; //this.userValidMessage = "User session has expired. Please login again.";
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); this._router.navigate(['/user-info'], {
queryParams: {
"errorCode": LoginErrorCodes.NOT_VALID,
"redirectUrl": this._router.url
}
});
} else { } else {
if (this.requestGrant) { if (this.requestGrant) {
this.openGrantModal("Add, delete or edit work in your ORCID record"); this.openGrantModal("Add, delete or edit work in your ORCID record");
} else { } else {
this.showLoading = true; this.showLoading = true;
if (this.resultLandingInfo) { if (this.resultLandingInfo) {
this.saveWork(); this.saveWork();
} else { } else {
@ -495,42 +485,42 @@ export class OrcidWorkComponent {
} }
} }
} }
private saveWork() { private saveWork() {
this.subscriptions.push(this.orcidService.saveWork(this.resultLandingInfo, this.pids).subscribe( this.subscriptions.push(this.orcidService.saveWork(this.resultLandingInfo, this.pids).subscribe(
response => { response => {
// for testing only // for testing only
// this.openGrantModal("Add work in your ORCID record"); // this.openGrantModal("Add work in your ORCID record");
// this.requestGrant = true; // this.requestGrant = true;
// this.requestGrantMessage = "Please grant OpenAIRE to access and update your ORCID record and works."; // this.requestGrantMessage = "Please grant OpenAIRE to access and update your ORCID record and works.";
if(response == null) { if (response == null) {
this.handleError(null); this.handleError(null);
console.error("Error posting landing info: null"); console.error("Error posting landing info: null");
} else { } else {
this.putCodes.push(""+response['put-code']); this.putCodes.push("" + response['put-code']);
this.creationDates.push(response['created-date']['value']); this.creationDates.push(response['created-date']['value']);
this.updateDates.push(response['last-modified-date']['value']); this.updateDates.push(response['last-modified-date']['value']);
// this.closeGrantModal(); // this.closeGrantModal();
// this.message = "You have successfully added work with pids: "+this.pids+" in your ORCID record!"; // this.message = "You have successfully added work with pids: "+this.pids+" in your ORCID record!";
this.message = "You have successfully added work \""+this.resultTitle+"\" in your ORCID record!"; this.message = "You have successfully added work \"" + this.resultTitle + "\" in your ORCID record!";
// this.openMessageModal("Work added successfully"); // this.openMessageModal("Work added successfully");
// message: 'You have <strong>successfully added</strong> work with pids: <strong>'+this.pids+'</strong> in your ORCID record!', // message: 'You have <strong>successfully added</strong> work with pids: <strong>'+this.pids+'</strong> in your ORCID record!',
UIkit.notification({ UIkit.notification({
message: 'You have <strong>successfully added</strong> work "<strong>'+this.resultTitle+'</strong>" in your ORCID record!' message: 'You have <strong>successfully added</strong> work "<strong>' + this.resultTitle + '</strong>" in your ORCID record!'
// + // +
// '<br><br><a class="uk-link" [href]="goToOrcidLinksPage()">Manager your ORCID links</a>' // '<br><br><a class="uk-link" [href]="goToOrcidLinksPage()">Manager your ORCID links</a>'
, ,
// '<br><br><a class="uk-link" (click)="goToOrcidLinksPage()">Manager your ORCID links</a>', // '<br><br><a class="uk-link" (click)="goToOrcidLinksPage()">Manager your ORCID links</a>',
// '<br><br><a class="uk-link" routerLinkActive="router-link-active" [routerLink]="myOrcidLinksPage">Manager your ORCID links</a>', // '<br><br><a class="uk-link" routerLinkActive="router-link-active" [routerLink]="myOrcidLinksPage">Manager your ORCID links</a>',
status: 'success', status: 'success',
timeout: 6000, timeout: 6000,
pos: 'bottom-right' pos: 'bottom-right'
}); });
this.showLoading = false; this.showLoading = false;
} }
}, },
@ -540,23 +530,28 @@ export class OrcidWorkComponent {
} }
)); ));
} }
goToOrcidLinksPage() { goToOrcidLinksPage() {
this._router.navigate([this.properties.myOrcidLinksPage]); this._router.navigate([this.properties.myOrcidLinksPage]);
} }
private updateWorkPreparation() { private updateWorkPreparation() {
if(!Session.isLoggedIn()){ if (!Session.isLoggedIn()) {
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); this._router.navigate(['/user-info'], {
queryParams: {
"errorCode": LoginErrorCodes.NOT_VALID,
"redirectUrl": this._router.url
}
});
} else { } else {
if (this.requestGrant) { if (this.requestGrant) {
this.openGrantModal("Add, delete or edit work in your ORCID record"); this.openGrantModal("Add, delete or edit work in your ORCID record");
} else if(this.putCodes.length > 1) { } else if (this.putCodes.length > 1) {
this.openPropagationModal("Update ORCID work"); this.openPropagationModal("Update ORCID work");
} else { } else {
this.showLoading = true; this.showLoading = true;
if (this.resultLandingInfo) { if (this.resultLandingInfo) {
this.updateWork(); this.updateWork();
} else { } else {
@ -565,18 +560,18 @@ export class OrcidWorkComponent {
} }
} }
} }
private updateWork() { private updateWork() {
this.subscriptions.push(this.orcidService.updateWork(this.resultLandingInfo, this.pids, this.putCodes[0]).subscribe( this.subscriptions.push(this.orcidService.updateWork(this.resultLandingInfo, this.pids, this.putCodes[0]).subscribe(
response => { response => {
if(response) { if (response) {
this.updateDates[0] = response['last-modified-date'].value; this.updateDates[0] = response['last-modified-date'].value;
// message: 'You have <strong>successfully updated</strong> work with pids: <strong>' + this.pids + '</strong> in your ORCID record!', // message: 'You have <strong>successfully updated</strong> work with pids: <strong>' + this.pids + '</strong> in your ORCID record!',
UIkit.notification({ UIkit.notification({
message: 'You have <strong>successfully updated</strong> work "<strong>' + this.resultTitle + '</strong>" in your ORCID record!' message: 'You have <strong>successfully updated</strong> work "<strong>' + this.resultTitle + '</strong>" in your ORCID record!'
// + // +
// '<br><br><a routerLinkActive="router-link-active" [routerLink]="myOrcidLinksPage">Manager your ORCID links</a>' // '<br><br><a routerLinkActive="router-link-active" [routerLink]="myOrcidLinksPage">Manager your ORCID links</a>'
, ,
status: 'success', status: 'success',
timeout: 6000, timeout: 6000,
@ -591,36 +586,41 @@ export class OrcidWorkComponent {
} }
)); ));
} }
public confirmedPropagation() { public confirmedPropagation() {
this.propagationModal.cancel(); this.propagationModal.cancel();
this.deleteWorks(true); this.deleteWorks(true);
//} //}
// if(this.currentAction == "update") { // if(this.currentAction == "update") {
// this.saveWork(); // this.saveWork();
// } // }
} }
public getOrcidWorks() { public getOrcidWorks() {
if(!Session.isLoggedIn()){ if (!Session.isLoggedIn()) {
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); this._router.navigate(['/user-info'], {
queryParams: {
"errorCode": LoginErrorCodes.NOT_VALID,
"redirectUrl": this._router.url
}
});
} else { } else {
this.showLoading = true; this.showLoading = true;
this.subscriptions.push(this.orcidService.getOrcidWorks(this.putCodes).subscribe( this.subscriptions.push(this.orcidService.getOrcidWorks(this.putCodes).subscribe(
(response) => { (response) => {
let error: boolean = true; let error: boolean = true;
if(response && response['bulk']) { if (response && response['bulk']) {
response = response['bulk'].filter(res => { response = response['bulk'].filter(res => {
return (!res.error && res.work); return (!res.error && res.work);
}); });
if(response && response.length > 0) { if (response && response.length > 0) {
error = false; error = false;
this.orcidWorks = response; this.orcidWorks = response;
this.openWorkModal(); this.openWorkModal();
} }
} }
if(error) { if (error) {
UIkit.notification({ UIkit.notification({
message: 'There was an error getting this work. </br> Please make sure you have not deleted it from your ORCID iD.', message: 'There was an error getting this work. </br> Please make sure you have not deleted it from your ORCID iD.',
status: 'warning', status: 'warning',
@ -637,20 +637,25 @@ export class OrcidWorkComponent {
)); ));
} }
} }
public deleteWorks(confirmed: boolean = false) { public deleteWorks(confirmed: boolean = false) {
if(!Session.isLoggedIn()){ if (!Session.isLoggedIn()) {
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); this._router.navigate(['/user-info'], {
queryParams: {
"errorCode": LoginErrorCodes.NOT_VALID,
"redirectUrl": this._router.url
}
});
} else { } else {
if (this.requestGrant) { if (this.requestGrant) {
this.openGrantModal("Add, delete or edit work in your ORCID record"); this.openGrantModal("Add, delete or edit work in your ORCID record");
} else if(this.putCodes.length > 1 && !confirmed) { } else if (this.putCodes.length > 1 && !confirmed) {
this.openPropagationModal("Delete ORCID work"); this.openPropagationModal("Delete ORCID work");
} else { } else {
this.showLoading = true; this.showLoading = true;
if (!this.resultLandingInfo && this.identifiers) { if (!this.resultLandingInfo && this.identifiers) {
let pidsArray: string[] = []; let pidsArray: string[] = [];
for (let key of Array.from(this.identifiers.keys())) { for (let key of Array.from(this.identifiers.keys())) {
@ -658,11 +663,11 @@ export class OrcidWorkComponent {
} }
this.pids = pidsArray.join(); this.pids = pidsArray.join();
} }
this.subscriptions.push(this.orcidService.deleteWorks(this.putCodes).subscribe( this.subscriptions.push(this.orcidService.deleteWorks(this.putCodes).subscribe(
deletedPutCodes => { deletedPutCodes => {
let deletedAll: boolean = true; let deletedAll: boolean = true;
if (deletedPutCodes) { if (deletedPutCodes) {
for (let i = 0; i < deletedPutCodes.length; i++) { for (let i = 0; i < deletedPutCodes.length; i++) {
let deletedPutCode = deletedPutCodes[i]; let deletedPutCode = deletedPutCodes[i];
@ -678,24 +683,24 @@ export class OrcidWorkComponent {
} else { } else {
deletedAll = false; deletedAll = false;
} }
if (!deletedAll) { if (!deletedAll) {
this.handleError(null); this.handleError(null);
console.error("Error deleting landing info: null"); console.error("Error deleting landing info: null");
} else { } else {
if(this.currentAction == "update") { if (this.currentAction == "update") {
this.saveWork(); this.saveWork();
} else { } else {
// this.closeGrantModal(); // this.closeGrantModal();
// this.message = "You have successfully deleted work with pids: " + this.pids + " from your ORCID record!"; // this.message = "You have successfully deleted work with pids: " + this.pids + " from your ORCID record!";
this.message = "You have successfully deleted work \"" + this.resultTitle + "\" from your ORCID record!"; this.message = "You have successfully deleted work \"" + this.resultTitle + "\" from your ORCID record!";
// this.openMessageModal("Work deleted successfully"); // this.openMessageModal("Work deleted successfully");
// message: 'You have <strong>successfully deleted</strong> work with pids: <strong>' + this.pids + '</strong> from your ORCID record!', // message: 'You have <strong>successfully deleted</strong> work with pids: <strong>' + this.pids + '</strong> from your ORCID record!',
UIkit.notification({ UIkit.notification({
message: 'You have <strong>successfully deleted</strong> work "<strong>' + this.resultTitle + '</strong>" from your ORCID record!' message: 'You have <strong>successfully deleted</strong> work "<strong>' + this.resultTitle + '</strong>" from your ORCID record!'
// + // +
// '<br><br><a routerLinkActive="router-link-active" [routerLink]="myOrcidLinksPage">Manager your ORCID links</a>' // '<br><br><a routerLinkActive="router-link-active" [routerLink]="myOrcidLinksPage">Manager your ORCID links</a>'
, ,
status: 'success', status: 'success',
timeout: 6000, timeout: 6000,
@ -713,7 +718,7 @@ export class OrcidWorkComponent {
} }
} }
} }
openGrantModal(title: string) { openGrantModal(title: string) {
this.grantModal.cancelButton = true; this.grantModal.cancelButton = true;
this.grantModal.okButton = true; this.grantModal.okButton = true;
@ -722,22 +727,22 @@ export class OrcidWorkComponent {
this.grantModal.alertTitle = title; this.grantModal.alertTitle = title;
this.grantModal.open(); this.grantModal.open();
} }
closeGrantModal() { closeGrantModal() {
this.grantModal.cancel(); this.grantModal.cancel();
} }
openWorkModal() { openWorkModal() {
this.workModal.cancelButton = false; this.workModal.cancelButton = false;
this.workModal.okButton = false; this.workModal.okButton = false;
this.workModal.alertTitle = "Work in your ORCID record"; this.workModal.alertTitle = "Work in your ORCID record";
this.workModal.open(); this.workModal.open();
} }
closeWorkModal() { closeWorkModal() {
this.workModal.cancel(); this.workModal.cancel();
} }
// openMessageModal(title: string) { // openMessageModal(title: string) {
// this.messageModal.cancelButton = false; // this.messageModal.cancelButton = false;
// this.messageModal.okButton = false; // this.messageModal.okButton = false;
@ -748,7 +753,7 @@ export class OrcidWorkComponent {
// closeMessageModal() { // closeMessageModal() {
// this.messageModal.cancel(); // this.messageModal.cancel();
// } // }
openPropagationModal(title: string) { openPropagationModal(title: string) {
this.propagationModal.cancelButton = true; this.propagationModal.cancelButton = true;
this.propagationModal.okButton = true; this.propagationModal.okButton = true;
@ -757,43 +762,43 @@ export class OrcidWorkComponent {
this.propagationModal.alertTitle = title; this.propagationModal.alertTitle = title;
this.propagationModal.open(); this.propagationModal.open();
} }
closePropagationModal() { closePropagationModal() {
this.propagationModal.cancel(); this.propagationModal.cancel();
} }
handleError(error) { handleError(error) {
if(error && error.status == "401") { if (error && error.status == "401") {
this.openGrantModal("Add, delete or edit work in your ORCID record"); this.openGrantModal("Add, delete or edit work in your ORCID record");
this.requestGrant = true; this.requestGrant = true;
this.requestGrantMessage = "Please grant OpenAIRE to access and update your ORCID record and works. "; this.requestGrantMessage = "Please grant OpenAIRE to access and update your ORCID record and works. ";
// + "If you have already granted OpenAIRE, you just need to login again to ORCID!"; // + "If you have already granted OpenAIRE, you just need to login again to ORCID!";
} else if(error && error.status == "403") { } else if (error && error.status == "403") {
this.openGrantModal("Add, delete or edit work in your ORCID record"); this.openGrantModal("Add, delete or edit work in your ORCID record");
this.requestGrant = true; this.requestGrant = true;
this.requestGrantMessage = "Please login again to ORCID." this.requestGrantMessage = "Please login again to ORCID."
// this.openGrantModal(); // this.openGrantModal();
} else { } else {
this.message = ""; this.message = "";
if(error && error.status == "409") { if (error && error.status == "409") {
this.message = "There is <span class='uk-text-bold'>already a work in your ORCID record</span> with the same information of the work you are trying to add now. <br><br>"; this.message = "There is <span class='uk-text-bold'>already a work in your ORCID record</span> with the same information of the work you are trying to add now. <br><br>";
} }
if(this.currentAction == "get") { if (this.currentAction == "get") {
// this.message += "There was an <span class='uk-text-bold'>error getting</span> work with pids: <span class='uk-text-bold'>" + this.pids + "</span> from your ORCID record. <br> Please try again later."; // this.message += "There was an <span class='uk-text-bold'>error getting</span> work with pids: <span class='uk-text-bold'>" + this.pids + "</span> from your ORCID record. <br> Please try again later.";
this.message += "There was an <span class='uk-text-bold'>error getting</span> work \"<span class='uk-text-bold'>" + this.resultTitle + "</span>\" from your ORCID record. <br> Please try again later."; this.message += "There was an <span class='uk-text-bold'>error getting</span> work \"<span class='uk-text-bold'>" + this.resultTitle + "</span>\" from your ORCID record. <br> Please try again later.";
} else if(this.currentAction == "add") { } else if (this.currentAction == "add") {
// this.message += "There was an <span class='uk-text-bold'>error adding</span> work with pids: <span class='uk-text-bold'>"+this.pids+"</span> to your ORCID record. <br> Please try again later."; // this.message += "There was an <span class='uk-text-bold'>error adding</span> work with pids: <span class='uk-text-bold'>"+this.pids+"</span> to your ORCID record. <br> Please try again later.";
this.message += "There was an <span class='uk-text-bold'>error adding</span> work with pids: \"<span class='uk-text-bold'>"+this.pids+"</span>\" to your ORCID record. <br> Please try again later."; this.message += "There was an <span class='uk-text-bold'>error adding</span> work with pids: \"<span class='uk-text-bold'>" + this.pids + "</span>\" to your ORCID record. <br> Please try again later.";
} else if(this.currentAction == "update") { } else if (this.currentAction == "update") {
// this.message += "There was an <span class='uk-text-bold'>error updating</span> work with pids: <span class='uk-text-bold'>"+this.pids+"</span> to your ORCID record. <br> Please try again later."; // this.message += "There was an <span class='uk-text-bold'>error updating</span> work with pids: <span class='uk-text-bold'>"+this.pids+"</span> to your ORCID record. <br> Please try again later.";
this.message += "There was an <span class='uk-text-bold'>error updating</span> work \"<span class='uk-text-bold'>"+this.resultTitle+"</span>\" to your ORCID record. <br> Please try again later."; this.message += "There was an <span class='uk-text-bold'>error updating</span> work \"<span class='uk-text-bold'>" + this.resultTitle + "</span>\" to your ORCID record. <br> Please try again later.";
} else if(this.currentAction == "delete") { } else if (this.currentAction == "delete") {
// this.message += "There was an <span class='uk-text-bold'>error deleting</span> work with pids: <span class='uk-text-bold'>"+this.pids+"</span> from your ORCID record. <br> Please try again later."; // this.message += "There was an <span class='uk-text-bold'>error deleting</span> work with pids: <span class='uk-text-bold'>"+this.pids+"</span> from your ORCID record. <br> Please try again later.";
this.message += "There was an <span class='uk-text-bold'>error deleting</span> work \"<span class='uk-text-bold'>"+this.resultTitle+"</span>\" from your ORCID record. <br> Please try again later."; this.message += "There was an <span class='uk-text-bold'>error deleting</span> work \"<span class='uk-text-bold'>" + this.resultTitle + "</span>\" from your ORCID record. <br> Please try again later.";
} else { } else {
this.message += "There was an error. Please try again later." this.message += "There was an error. Please try again later."
} }
UIkit.notification({ UIkit.notification({
message: this.message, message: this.message,
status: 'danger', status: 'danger',
@ -804,28 +809,28 @@ export class OrcidWorkComponent {
} }
this.showLoading = false; this.showLoading = false;
} }
get tooltipAdd() { get tooltipAdd() {
return "Add this work to your <span class=\"text-orcid\">ORCID</span> record" + ((properties.environment == "beta") ? ". The action will affect your real ORCID iD." : ""); return "Add this work to your <span class=\"text-orcid\">ORCID</span> record" + ((properties.environment == "beta") ? ". The action will affect your real ORCID iD." : "");
} }
get tooltipDelete() { get tooltipDelete() {
return "Delete this work from your <span class=\"text-orcid\">ORCID</span> record" + ((properties.environment == "beta") ? ". The action will affect your real ORCID iD." : ""); return "Delete this work from your <span class=\"text-orcid\">ORCID</span> record" + ((properties.environment == "beta") ? ". The action will affect your real ORCID iD." : "");
} }
get tooltipNoPid() { get tooltipNoPid() {
return "Only resources with a PID (persistent identifier) like DOI, handle, PMID can be added or deleted from your <span class=\"text-orcid\">ORCID</span> record"; return "Only resources with a PID (persistent identifier) like DOI, handle, PMID can be added or deleted from your <span class=\"text-orcid\">ORCID</span> record";
} }
get tooltipNoLoggedInUser() { get tooltipNoLoggedInUser() {
return "Add or delete a work from your <span class=\"text-orcid\">ORCID</span> record. Please log in first." return "Add or delete a work from your <span class=\"text-orcid\">ORCID</span> record. Please log in first."
} }
hoverEvent($event, action: string = "add") { hoverEvent($event, action: string = "add") {
if(action == "add") { if (action == "add") {
this.hoverAdd = $event.type == "mouseover"; this.hoverAdd = $event.type == "mouseover";
this.hoverDelete = false; this.hoverDelete = false;
} else if(action == "delete") { } else if (action == "delete") {
this.hoverDelete = $event.type == "mouseover"; this.hoverDelete = $event.type == "mouseover";
this.hoverAdd = false; this.hoverAdd = false;
} }

View File

@ -252,9 +252,10 @@
[href]="openaireLink+this.routerHelper.createQueryParamsString(this.parameterNames, this.parameterValues)" [href]="openaireLink+this.routerHelper.createQueryParamsString(this.parameterNames, this.parameterValues)"
target="_blank"> OpenAIRE - Explore</a>. target="_blank"> OpenAIRE - Explore</a>.
</div> </div>
<div class="uk-flex uk-flex-between uk-flex-middle uk-flex-wrap"> <div class="uk-flex uk-flex-middle uk-flex-wrap" [class.uk-flex-between]="!mobile"
[class.uk-margin-top]="mobile" [class.uk-flex-center]="mobile">
<!-- Total results, number of pages --> <!-- Total results, number of pages -->
<h6 class="uk-margin-remove"> <div class="uk-margin-remove" [class.uk-h6]="!mobile">
<ng-container *ngIf="results && searchUtils.totalResults > 0"> <ng-container *ngIf="results && searchUtils.totalResults > 0">
<span>{{searchUtils.totalResults|number}}</span> <span>{{searchUtils.totalResults|number}}</span>
<span class="uk-text-meta uk-text-capitalize"> {{type}}, page </span> <span class="uk-text-meta uk-text-capitalize"> {{type}}, page </span>
@ -267,9 +268,10 @@
<span>{{searchUtils.page | number}}</span> <span>{{searchUtils.page | number}}</span>
<span class="uk-text-meta"> of {{(totalPages(oldTotalResults)|number)}}</span> <span class="uk-text-meta"> of {{(totalPages(oldTotalResults)|number)}}</span>
</ng-container> </ng-container>
</h6> </div>
<!-- Download results --> <!-- Download results -->
<div *ngIf="showDownload && (searchUtils.status !== errorCodes.LOADING || !loadPaging)" class="uk-margin-small-bottom uk-margin-small-top"> <div *ngIf="showDownload && (searchUtils.status !== errorCodes.LOADING || !loadPaging)"
class="uk-margin-small-bottom uk-margin-small-top" [class.uk-margin-medium-top]="mobile">
<search-download <search-download
*ngIf="( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'" *ngIf="( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'"
[isDisabled]="disabled" [isDisabled]="disabled"

View File

@ -1,4 +1,4 @@
<ul class="uk-list uk-list-xlarge uk-margin" [ngClass]="custom_class"> <ul class="uk-list uk-list-large uk-margin" [class.uk-list-xlarge]="!isMobile" [ngClass]="custom_class">
<errorMessages [status]="[status]" [type]="'results'"></errorMessages> <errorMessages [status]="[status]" [type]="'results'"></errorMessages>
<li *ngFor="let result of previewResults" [class.uk-border-bottom]="!isMobile"> <li *ngFor="let result of previewResults" [class.uk-border-bottom]="!isMobile">
<result-preview [properties]="properties" [showOrganizations]="showOrganizations" <result-preview [properties]="properties" [showOrganizations]="showOrganizations"

View File

@ -30,12 +30,27 @@ export interface Context {
} }
export interface Measure { export interface Measure {
downloads: string; /** @deprecated*/
views: string; downloads?: string;
influence: string; /** @deprecated*/
popularity: string; views?: string;
citations: string; /** @deprecated*/
impulse: string; influence?: string;
/** @deprecated*/
popularity?: string;
/** @deprecated*/
citations?: string;
/** @deprecated*/
impulse?: string;
bip?: Metric[]
counts?: Metric[]
}
export interface Metric {
name: string,
order: number,
icon: string,
value: any
} }
export class ResultLandingInfo { export class ResultLandingInfo {

View File

@ -1,5 +1,5 @@
import {Author, HostedByCollectedFrom, Organization, Project, ResultTitle} from "../result-preview/result-preview"; import {Author, HostedByCollectedFrom, Organization, Project, ResultTitle} from "../result-preview/result-preview";
import {Measure} from "./resultLandingInfo"; import {Measure, Metric} from "./resultLandingInfo";
export class SearchResult { export class SearchResult {
title: ResultTitle; title: ResultTitle;

View File

@ -15,15 +15,8 @@
</div> </div>
</div> </div>
<div class="uk-width-expand"> <div class="uk-width-expand">
<!-- 1st section (title, subtitle and deposit link) --> <!-- 1st section (title, metadata) -->
<div class="uk-margin-bottom"> <div class="uk-margin-small-bottom">
<!-- Deposit searchPage URL -->
<!-- <span class="uk-width-expand uk-flex-right">
<a *ngIf="result.websiteURL && promoteWebsiteURL" href="{{result.websiteURL}}" target="_blank" type="submit"
class=" uk-float-right uk-button uk-button-primary uk-padding uk-padding-remove-vertical uk-margin-small-left">
<span><span>Visit repository to deposit</span><span uk-icon="arrow-right"></span></span>
</a>
</span> -->
<!-- Title --> <!-- Title -->
<div> <div>
<h2 class="uk-margin-remove uk-text-break uk-inline-block uk-h6"> <h2 class="uk-margin-remove uk-text-break uk-inline-block uk-h6">
@ -69,25 +62,22 @@
[no title available] [no title available]
</div> </div>
</div> </div>
<!-- <hr class="uk-margin-remove-bottom" *ngIf="result.websiteURL && promoteWebsiteURL"> -->
</h2> </h2>
</div> </div>
<!-- Small subtitle above title --> <!-- Metadata -->
<div class="uk-text-small uk-margin-xsmall-bottom"> <div class="uk-margin-xsmall-top">
<span *ngIf="type" class="uk-text-capitalize type">{{type}}</span> <entity-metadata [entityType]="type" [types]="result.types" [startYear]="result.startYear?.toString()" [endYear]="result.endYear?.toString()"
<span *ngIf="type && beforeTitle.length > 0"> . </span> [year]="result.year?.toString()" [openAccessMandatePublications]="result.openAccessMandatePublications"
<span *ngIf="beforeTitle.length > 0" class="uk-text-capitalize"> [openAccessMandateDatasets]="result.openAccessMandateDatasets" [date]="" [embargoEndDate]="result.embargoEndDate"
{{beforeTitle.join(' . ')}} [publisher]="result.publisher" [countries]="result.countries"
</span> [languages]="result.languages" [programmingLanguages]="result.programmingLanguages"
<span *ngIf="result.embargoEndDate && result.embargoEndDate != ''"> [compatibility]="result.compatibility" [type]="type"
<span ></entity-metadata>
*ngIf="beforeTitle.length > 0"> . </span> Embargo End Date: {{result.embargoEndDate | date: 'dd MMM yyyy'}}
</span>
</div> </div>
</div> </div>
<!-- 2nd section (labels only) --> <!-- 2nd section (labels only) -->
<div class="uk-margin-bottom"> <!--<div class="uk-margin-bottom">
<!-- Labels --> &lt;!&ndash; Labels &ndash;&gt;
<div> <div>
<span <span
*ngIf="result.accessMode && result.accessMode.toLowerCase() !== 'not available'" *ngIf="result.accessMode && result.accessMode.toLowerCase() !== 'not available'"
@ -127,10 +117,10 @@
{{programmingLanguage}} {{programmingLanguage}}
</span>{{" "}} </span>{{" "}}
</span> </span>
<!-- <span --> &lt;!&ndash; <span &ndash;&gt;
<!-- *ngIf="result.sc39" class="uk-label" title="Special Clause 39">--> &lt;!&ndash; *ngIf="result.sc39" class="uk-label" title="Special Clause 39">&ndash;&gt;
<!-- Special Clause 39--> &lt;!&ndash; Special Clause 39&ndash;&gt;
<!-- </span>{{' '}}--> &lt;!&ndash; </span>{{' '}}&ndash;&gt;
<span <span
*ngIf="result.compatibility && result.compatibility != '' && result.compatibility.toLowerCase() != 'not yet registered'" *ngIf="result.compatibility && result.compatibility != '' && result.compatibility.toLowerCase() != 'not yet registered'"
class="uk-label" title="Compatibility"> class="uk-label" title="Compatibility">
@ -143,11 +133,11 @@
{{result.compatibility}} <span *ngIf="properties.adminToolsPortalType == 'eosc'">in OpenAIRE</span> {{result.compatibility}} <span *ngIf="properties.adminToolsPortalType == 'eosc'">in OpenAIRE</span>
</span>{{' '}} </span>{{' '}}
</div> </div>
</div> </div>-->
<!-- 3rd section (funders, budget, authors, PIDs, publisher etc.) --> <!-- 3rd section (funders, budget, authors, PIDs, publisher etc.) -->
<div class="section3 uk-text-small uk-margin-bottom"> <div class="uk-text-small uk-margin-small-bottom">
<!-- Funder --> <!-- Funder -->
<div *ngIf="result.funderShortname || result.code" class="uk-margin-small-bottom"> <div *ngIf="result.funderShortname || result.code" class="uk-margin-xsmall-bottom">
<span *ngIf="result.funderShortname"> <span *ngIf="result.funderShortname">
<span class="uk-text-meta">Funder: </span> <span class="uk-text-meta">Funder: </span>
{{result.funderShortname}} {{result.funderShortname}}
@ -163,7 +153,7 @@
<!-- </span>--> <!-- </span>-->
</div> </div>
<!-- Funder Budget --> <!-- Funder Budget -->
<div *ngIf="result.budget || result.contribution" class="uk-margin-small-bottom"> <div *ngIf="result.budget || result.contribution" class="uk-margin-xsmall-bottom">
<span *ngIf="result.budget"> <span *ngIf="result.budget">
<span class="uk-text-meta">Overall Budget: </span> <span class="uk-text-meta">Overall Budget: </span>
{{result.budget | number}} {{result.budget | number}}
@ -176,31 +166,16 @@
</span> </span>
</div> </div>
<!-- Authors --> <!-- Authors -->
<div *ngIf="result.authors" class="uk-flex uk-margin-small-bottom"> <div *ngIf="result.authors" class="uk-flex uk-margin-xsmall-bottom">
<span class="uk-text-meta">Authors:&nbsp;</span>
<showAuthors [authors]="result.authors" [authorsLimit]=10 [modal]="modal" <showAuthors [authors]="result.authors" [authorsLimit]=10 [modal]="modal"
[showAll]=false></showAuthors> [showAll]=false></showAuthors>
</div> </div>
<!-- Identifiers --> <!-- Identifiers -->
<div *ngIf="result.identifiers && result.identifiers.size > 0" class="uk-margin-small-bottom"> <div *ngIf="result.identifiers && result.identifiers.size > 0" class="uk-margin-xsmall-bottom">
<showIdentifiers [identifiers]="result.identifiers"></showIdentifiers> <showIdentifiers [identifiers]="result.identifiers"></showIdentifiers>
</div> </div>
<!-- Publisher -->
<div *ngIf="result.publisher && result.publisher != ''" class="uk-margin-small-bottom">
<span class="uk-text-meta">Publisher: </span>
{{result.publisher}}
</div>
<!-- Countries -->
<div *ngIf="result.countries && result.countries.length > 0"
class="uk-margin-small-bottom">
<span class="uk-text-meta">{{(result.countries.length == 1) ? 'Country' : 'Countries'}}: </span>
<span *ngFor="let country of result.countries.slice(0,10) let i = index">
{{country}}{{(i < (result.countries.slice(0, 10).length - 1)) ? ", " : ""}}
{{(i == result.countries.slice(0, 10).length - 1 && result.countries.length > 10) ? "..." : ""}}
</span>
</div>
<!-- Projects --> <!-- Projects -->
<div *ngIf="result.projects && result.projects.length > 0" class="uk-margin-small-bottom"> <div *ngIf="result.projects && result.projects.length > 0" class="uk-margin-xsmall-bottom">
<span class="uk-text-meta"> Project: </span> <span class="uk-text-meta"> Project: </span>
<span *ngFor="let project of result.projects.slice(0,10) let i=index"> <span *ngFor="let project of result.projects.slice(0,10) let i=index">
<span> <span>
@ -217,7 +192,7 @@
</div> </div>
<!-- Organizations --> <!-- Organizations -->
<div *ngIf="showOrganizations && result.organizations && result.organizations.length > 0" <div *ngIf="showOrganizations && result.organizations && result.organizations.length > 0"
class="uk-margin-small-bottom"> class="uk-margin-xsmall-bottom">
<span class="uk-text-meta">Partners: </span> <span class="uk-text-meta">Partners: </span>
<span *ngFor="let organization of result.organizations.slice(0,10) let i=index"> <span *ngFor="let organization of result.organizations.slice(0,10) let i=index">
<span>{{organization.name}}</span> <span>{{organization.name}}</span>
@ -227,7 +202,7 @@
</div> </div>
<!-- Website URL --> <!-- Website URL -->
<div *ngIf="result.websiteURL && result.websiteURL != '' && !promoteWebsiteURL" <div *ngIf="result.websiteURL && result.websiteURL != '' && !promoteWebsiteURL"
class="uk-margin-small-bottom"> class="uk-margin-xsmall-bottom">
<span class="uk-text-meta">Website URL: </span> <span class="uk-text-meta">Website URL: </span>
<span> <span>
<a href="{{result.websiteURL}}" target="_blank" class="custom-external"> <a href="{{result.websiteURL}}" target="_blank" class="custom-external">
@ -236,7 +211,7 @@
</span> </span>
</div> </div>
<!-- OAI-PMH URL--> <!-- OAI-PMH URL-->
<div *ngIf="result.OAIPMHURL && result.OAIPMHURL != ''" class="uk-margin-small-bottom"> <div *ngIf="result.OAIPMHURL && result.OAIPMHURL != ''" class="uk-margin-xsmall-bottom">
<span class="uk-text-meta">OAI-PMH URL: </span> <span class="uk-text-meta">OAI-PMH URL: </span>
<span> <span>
<a href="{{result.OAIPMHURL}}" target="_blank" class="custom-external"> <a href="{{result.OAIPMHURL}}" target="_blank" class="custom-external">
@ -246,7 +221,7 @@
</div> </div>
<!-- Subjects --> <!-- Subjects -->
<div *ngIf="showSubjects && result.subjects && result.subjects.length > 0" <div *ngIf="showSubjects && result.subjects && result.subjects.length > 0"
class="uk-margin-small-bottom"> class="uk-margin-xsmall-bottom">
<span class="uk-text-meta">Subject: </span> <span class="uk-text-meta">Subject: </span>
<span *ngFor="let subject of result.subjects.slice(0,10) let i = index"> <span *ngFor="let subject of result.subjects.slice(0,10) let i = index">
<span>{{subject}}</span> <span>{{subject}}</span>
@ -254,42 +229,9 @@
<span>{{(i == result.subjects.slice(0, 10).length - 1 && result.subjects.length > 10) ? "..." : ""}}</span> <span>{{(i == result.subjects.slice(0, 10).length - 1 && result.subjects.length > 10) ? "..." : ""}}</span>
</span> </span>
</div> </div>
<!-- Download from-->
<div *ngIf="result.hostedBy_collectedFrom && result.hostedBy_collectedFrom.length > 0"
class="uk-margin-small-bottom">
<div *ngFor="let from of result.hostedBy_collectedFrom"
[title]="from.accessRight ? from.accessRight : 'Not available'"
class="uk-flex uk-flex-middle">
<span
[class]="'uk-margin-small-right ' + (from.accessRightIcon == 'lock_open' ? 'uk-text-success' : 'uk-text-meta')">
<icon [name]="from.accessRightIcon" flex="true" type="outlined"></icon>
</span>
<span class="uk-width-expand">
<span class="uk-margin-right uk-display-inline-block">
<span class="uk-text-meta">Download from: </span>
<a *ngIf="from.downloadUrl"
[href]="from.downloadUrl" target="_blank" class="title">
<span class="custom-external">{{from.downloadNames.join("; ")}}</span>
</a>
<span *ngIf="!from.downloadUrl || from.downloadUrl.length === 0" class="title">
<span>{{from.downloadNames.join(", ")}}</span>
</span>
</span>
<span class="provider uk-display-inline-block">
<span class="uk-text-meta">Provider: </span>
<a *ngFor="let collectedName of from.collectedNamesAndIds.keys(); let i=index"
[routerLink]="dataProviderUrl"
[queryParams]="{datasourceId: from.collectedNamesAndIds.get(collectedName)}" (click)="onClick();">
{{collectedName}}
<ng-container *ngIf="(i !== (from.collectedNamesAndIds.size - 1))">; </ng-container>
</a>
</span>
</span>
</div>
</div>
</div> </div>
<!-- 4th section (description) --> <!-- 4th section (description) -->
<div class="section4 uk-text-small"> <div class="uk-text-small">
<!-- Description --> <!-- Description -->
<div *ngIf="result.description" class="multi-line-ellipsis lines-3"> <div *ngIf="result.description" class="multi-line-ellipsis lines-3">
<p class="uk-text-meta" [innerHTML]="result.description"></p> <p class="uk-text-meta" [innerHTML]="result.description"></p>
@ -297,7 +239,7 @@
</div> </div>
<!-- 5th section(deposit only) --> <!-- 5th section(deposit only) -->
<div> <div>
<span class="uk-width-expand uk-flex-right"> <span class="uk-flex uk-flex-right uk-margin-small-top">
<a *ngIf="result.websiteURL && promoteWebsiteURL" href="{{result.websiteURL}}" target="_blank" type="submit" <a *ngIf="result.websiteURL && promoteWebsiteURL" href="{{result.websiteURL}}" target="_blank" type="submit"
class="uk-float-right uk-margin-small-left uk-display-inline-block uk-text-uppercase uk-button uk-button-text"> class="uk-float-right uk-margin-small-left uk-display-inline-block uk-text-uppercase uk-button uk-button-text">
<span class="uk-flex uk-flex-middle"> <span class="uk-flex uk-flex-middle">
@ -311,120 +253,77 @@
</div> </div>
</div> </div>
<!--&& loggedIn (card footer)--> <!--&& loggedIn (card footer)-->
<div *ngIf="result.measure ||((properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'community' || properties.adminToolsPortalType == 'aggregator') <div *ngIf="result.hostedBy_collectedFrom || result.measure?.bip.length || result.measure?.counts.length"
&& ((showOrcid && result.identifiers && result.identifiers.size > 0 && isResultType) || result.orcidCreationDates?.length > 0))" class="uk-text-small" [class.uk-visible@m]="!result.measure?.bip.length && result.measure?.counts.length" [ngClass]="{'uk-card-footer': isCard}">
class="uk-text-small" <div class="uk-grid uk-grid-small uk-flex-between uk-flex-middle uk-grid-divider uk-margin-xsmall-bottom" uk-grid>
[ngClass]="{'uk-card-footer': isCard}"> <div *ngIf="result.hostedBy_collectedFrom" class="uk-width-auto uk-visible@m">
<!-- Impact Factors--> <availableOn [availableOn]="result.hostedBy_collectedFrom" [source]="false"></availableOn>
<span class="uk-flex uk-flex-top uk-flex-wrap" style="grid-gap: 10px;"> </div>
<ng-container *ngIf="result.measure?.length"> <div *ngIf="hasActions" class="uk-width-expand uk-visible@m">
<!--Popularity --> <span class="uk-grid uk-grid-small uk-child-width-auto uk-text-xsmall" uk-grid>
<a title="Popularity" <span *ngIf="orcid">
class="popularity-{{result.measure[0]}} uk-margin-right uk-flex uk-flex-middle uk-width-auto@s uk-width-1-1"> <orcid-work *ngIf="showOrcid && result.identifiers && result.identifiers.size > 0"
<svg xmlns="http://www.w3.org/2000/svg" width="10.749" height="14.33" viewBox="0 0 10.749 14.33"><defs><!--<style>.a{fill:#d51717;}</style>--></defs><path [resultId]="result.relcanId" [resultTitle]="result.title"
class="a" [type]="result.resultType" [pageType]="'search'"
d="M10.382.67a14.44,14.44,0,0,1,.5,3.225A2.331,2.331,0,0,1,8.589,6.4,2.445,2.445,0,0,1,6.15,3.895l.02-.242A9.25,9.25,0,0,0,4,9.625a5.375,5.375,0,0,0,10.749,0A11.5,11.5,0,0,0,10.382.67ZM9.18,12.985a2.134,2.134,0,0,1-2.163-2.11A2.1,2.1,0,0,1,8.9,8.779a5.181,5.181,0,0,0,3.1-1.733,9.374,9.374,0,0,1,.4,2.714A3.226,3.226,0,0,1,9.18,12.985Z" [putCodes]="result.orcidPutCodes" [givenPutCode]="true" [identifiers]="result.identifiers">
transform="translate(-4 -0.67)"/> </orcid-work>
</svg> </span>
<span class="uk-margin-small-left"> <span *ngIf="orcid" class="uk-width-expand uk-text-right">
{{" " + result.measure[2] + " popularity" }} <span *ngIf="result.orcidCreationDates?.length > 0" class="uk-display-inline-block">
</span> <span class="uk-text-meta">
</a> Added in ORCID:
<div class="default-dropdown uk-margin-remove-top uk-padding-small"
uk-dropdown="pos: bottom-left; mode:click" style="min-width: 70px !important;">
<span class="uk-flex uk-flex-middle">
<span class="popularity-{{result.measure[0]}}">
<svg xmlns="http://www.w3.org/2000/svg" width="20.234" height="26.974"
viewBox="0 0 20.234 26.974"><defs> </defs><path class="a"
d="M16.014.67a27.181,27.181,0,0,1,.936,6.07c0,2.605-1.707,4.717-4.312,4.717A4.6,4.6,0,0,1,8.047,6.74l.038-.455A17.411,17.411,0,0,0,4,17.527a10.117,10.117,0,0,0,20.234,0A21.643,21.643,0,0,0,16.014.67ZM13.75,23.85A4.016,4.016,0,0,1,9.678,19.88c0-2.049,1.328-3.49,3.554-3.946a9.753,9.753,0,0,0,5.843-3.263,17.645,17.645,0,0,1,.746,5.109,6.072,6.072,0,0,1-6.07,6.07Z"
transform="translate(-4 -0.67)"/>
</svg>
</span> </span>
<span class="uk-margin-small-left"> <span *ngFor="let date of result.orcidCreationDates; let i=index">
{{" " + result.measure[2] + " popularity" }} {{date | date: 'dd MMM yyyy'}}
</span> <span *ngIf="i < (result.orcidCreationDates.length - 1)">
<span class="uk-margin-small-left"> &
{{" " + (result.measure[0] == 'A' ? 'In top 0.01%' : '') + (result.measure[0] == 'B' ? 'In top 1%' : '') + (result.measure[0] == 'C' ? 'In bottom 99%' : '')}} </span>
</span>
</span>
<div class="uk-text-meta uk-margin">
Popularity: Citation-based measure reflecting the current impact.
</div>
<div>
<a title="Link to Bip!Finder" class="uk-float-right" target="_blank"
href="https://bip.imis.athena-innovation.gr/site/details?id={{result.objId}}">
View more details
</a>
</div>
</div>
<!--Influence -->
<a title="Influence"
class="influence-{{result.measure[1]}} uk-margin-right uk-flex uk-flex-middle uk-width-auto@s uk-width-1-1">
<svg xmlns="http://www.w3.org/2000/svg" width="12.667" height="14" viewBox="0 0 12.667 14">
<defs><!--<style>.a{fill:#e1920a;}</style>--></defs>
<path class="a"
d="M3.333,7v4.667h2V7Zm4,0v4.667h2V7ZM2,15H14.667V13H2Zm9.333-8v4.667h2V7Zm-3-6L2,4.333V5.667H14.667V4.333Z"
transform="translate(-2 -1)"/>
</svg>
<span class="uk-margin-small-left">
{{" " + result.measure[3] + " influence" }}
</span>
</a>
<div class="default-dropdown uk-margin-remove-top uk-padding-small"
uk-dropdown="pos: bottom-left; mode:click" style="min-width: 70px !important;">
<span class="uk-flex uk-flex-middle">
<span class="influence-{{result.measure[1]}}">
<svg xmlns="http://www.w3.org/2000/svg" width="24.299" height="26.857" viewBox="0 0 24.299 26.857"><defs><style>.a {
fill: #464646;
}</style></defs><path class="a"
d="M4.558,12.51v8.952H8.394V12.51Zm7.673,0v8.952h3.837V12.51ZM2,27.857H26.3V24.02H2ZM19.9,12.51v8.952h3.837V12.51ZM14.149,1,2,7.394V9.952H26.3V7.394Z"
transform="translate(-2 -1)"/>
</svg>
</span>
<span class=" uk-margin-small-left">
{{result.measure[3] + " influence" }}
</span>
<span class="uk-margin-small-left">
{{" " + (result.measure[1] == 'A' ? 'In top 0.01%' : '') + (result.measure[1] == 'B' ? 'In top 1%' : '') + (result.measure[1] == 'C' ? 'In bottom 99%' : '')}}
</span>
</span>
<div class="uk-text-meta uk-margin">
Influence: Citation-based measure reflecting the total impact.
</div>
<div>
<a title="Link to Bip!Finder" class=" uk-float-right" target="_blank"
href="https://bip.imis.athena-innovation.gr/site/details?id={{result.objId}}">
View more details
</a>
</div>
</div>
</ng-container>
<!-- && loggedIn -->
<!-- TODO: change colors/opacity and disabled attr for ORCID buttons -->
<span *ngIf="(properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'community' || properties.adminToolsPortalType == 'aggregator')
&& showOrcid && result.identifiers && result.identifiers.size > 0 && isResultType"
class="uk-margin-auto-left">
<orcid-work *ngIf="showOrcid && result.identifiers && result.identifiers.size > 0"
[resultId]="result.relcanId" [resultTitle]="result.title"
[type]="result.resultType" [pageType]="'search'"
[putCodes]="result.orcidPutCodes" [givenPutCode]="true" [identifiers]="result.identifiers">
</orcid-work>
</span>
<span
*ngIf="(properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'community') && result.orcidCreationDates?.length > 0"
class="uk-width-expand uk-text-right">
<span *ngIf="result.orcidCreationDates?.length > 0" class="uk-display-inline-block">
<span class="uk-text-meta">
Added in ORCID:
</span>
<span *ngFor="let date of result.orcidCreationDates; let i=index">
{{date | date: 'dd MMM yyyy'}}
<span *ngIf="i < (result.orcidCreationDates.length - 1)">
&
</span> </span>
</span> </span>
</span> </span>
</span> </span>
</span> </div>
<div *ngIf="result.measure?.bip.length || result.measure?.counts.length"
class="uk-text-xsmall uk-width-auto metrics uk-flex uk-flex-middle uk-flex-right uk-text-meta">
<ng-container *ngIf="result.measure?.bip.length">
<a class="uk-flex uk-flex-middle uk-link-reset">
<icon customClass="bip-icon-hover" [flex]="true" [ratio]="0.7" [name]="result.measure.bip[0].icon"></icon>
<span class="uk-margin-xsmall-left">{{result.measure.bip[0].value}}</span>
</a>
<div uk-drop="pos: top-left" class="uk-card uk-card-default uk-border uk-box-no-shadow uk-padding-small">
<table>
<tr *ngFor="let metric of result.measure.bip">
<td class="bip-icon"><icon [flex]="true" [ratio]="0.7" [name]="metric.icon"></icon></td>
<td class="uk-text-capitalize">{{metric.name}}</td>
<td class="uk-text-bolder">{{metric.value}}</td>
</tr>
</table>
<div class="uk-margin-top uk-flex uk-flex-middle uk-flex-center">
<img class="uk-margin-xsmall-right" width="15" src="assets/common-assets/bip-minimal.svg" loading="lazy" alt="BIP!">
<span class="uk-text-uppercase">Powered by <span class="uk-text-bolder">BIP!</span></span>
</div>
</div>
</ng-container>
<ng-container *ngIf="result.measure?.counts.length">
<a class="uk-flex uk-flex-middle uk-margin-small-left uk-link-reset">
<icon class="text-usage-counts-hover" [flex]="true" [ratio]="0.8" [name]="result.measure.counts[0].icon"></icon>
<span class="uk-margin-xsmall-left">{{result.measure.counts[0].value}}</span>
</a>
<div uk-drop="pos: top-left" class="uk-card uk-card-default uk-border uk-box-no-shadow uk-padding-small">
<table>
<tr *ngFor="let metric of result.measure.counts">
<td class="text-usage-counts"><icon [flex]="true" [ratio]="0.7" [name]="metric.icon"></icon></td>
<td class="uk-text-capitalize">{{metric.name}}</td>
<td class="uk-text-bolder">{{metric.value}}</td>
</tr>
</table>
<div class="uk-margin-top uk-flex uk-flex-middle uk-flex-center">
<span class="uk-text-uppercase">Powered by </span>
<img class="uk-margin-xsmall-left" width="15" src="assets/common-assets/logo-small-usage-counts.png" loading="lazy" alt="BIP!">
</div>
</div>
</ng-container>
</div>
</div>
</div> </div>
</div> </div>

View File

@ -14,4 +14,15 @@
.popularity-C, .popularity-C5, .influence-C, .influence-C5 { .popularity-C, .popularity-C5, .influence-C, .influence-C5 {
& svg a { & svg a {
fill: #444; fill: #444;
}} }
}
.metrics {
& .uk-drop {
max-width: 200px;
}
& table td {
padding: 2px 5px;
}
}

View File

@ -4,7 +4,6 @@ import {EnvProperties} from "../properties/env-properties";
import {RouterHelper} from "../routerHelper.class"; import {RouterHelper} from "../routerHelper.class";
import {AlertModal} from "../modal/alert"; import {AlertModal} from "../modal/alert";
import {properties} from "../../../../environments/environment"; import {properties} from "../../../../environments/environment";
import {Session} from "../../login/utils/helper.class";
import {Identifier, StringUtils} from "../string-utils.class"; import {Identifier, StringUtils} from "../string-utils.class";
import {OpenaireEntities} from "../properties/searchFields"; import {OpenaireEntities} from "../properties/searchFields";
import {HelperFunctions} from "../HelperFunctions.class"; import {HelperFunctions} from "../HelperFunctions.class";
@ -29,29 +28,43 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
public urlParam: string; public urlParam: string;
public url: string; public url: string;
@Input() externalUrl: string; @Input() externalUrl: string;
public type: string;
public beforeTitle: string[] = [];
public dataProviderUrl = properties.searchLinkToDataProvider.split('?')[0]; public dataProviderUrl = properties.searchLinkToDataProvider.split('?')[0];
@Input() showOrcid: boolean = true; @Input() showOrcid: boolean = true;
@Input() showEnermaps: boolean = false; @Input() showEnermaps: boolean = false;
@Input() deposit: boolean = false; @Input() deposit: boolean = false;
@Input() provenanceActionVocabulary = null; @Input() provenanceActionVocabulary = null;
@Input() relationsVocabulary = null; @Input() relationsVocabulary = null;
/* Metadata */
public type: string;
public types: string[];
public provenanceAction: string;
public relationName: string;
public linking: boolean = false;
public share: boolean = false;
public cite: boolean = false;
public orcid: boolean = false;
ngOnInit(): void { ngOnInit(): void {
if (this.hasLink) { if (this.hasLink) {
if (this.result.resultType === "publication") { if (this.result.resultType === "publication") {
this.urlParam = "articleId"; this.urlParam = "articleId";
this.url = properties.searchLinkToPublication.split('?')[0]; this.url = properties.searchLinkToPublication.split('?')[0];
this.resultActions();
} else if (this.result.resultType === "dataset") { } else if (this.result.resultType === "dataset") {
this.urlParam = "datasetId"; this.urlParam = "datasetId";
this.url = properties.searchLinkToDataset.split('?')[0]; this.url = properties.searchLinkToDataset.split('?')[0];
this.resultActions();
} else if (this.result.resultType === "software") { } else if (this.result.resultType === "software") {
this.urlParam = "softwareId"; this.urlParam = "softwareId";
this.url = properties.searchLinkToSoftwareLanding.split('?')[0]; this.url = properties.searchLinkToSoftwareLanding.split('?')[0];
this.resultActions();
} else if (this.result.resultType === "other") { } else if (this.result.resultType === "other") {
this.urlParam = "orpId"; this.urlParam = "orpId";
this.url = properties.searchLinkToOrp.split('?')[0]; this.url = properties.searchLinkToOrp.split('?')[0];
this.resultActions();
} else if (this.result.resultType == "project") { } else if (this.result.resultType == "project") {
if (this.result.id) { if (this.result.id) {
this.urlParam = "projectId"; this.urlParam = "projectId";
@ -80,7 +93,7 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
} }
this.checkPID(); this.checkPID();
} }
this.initBeforeTitle(); this.initMetadata();
if (this.result.languages) { if (this.result.languages) {
this.result.languages = this.removeUnknown(this.result.languages); this.result.languages = this.removeUnknown(this.result.languages);
} }
@ -89,6 +102,14 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
} }
} }
resultActions() {
this.linking = true;
this.share = true;
this.cite = true;
this.orcid = (this.properties.adminToolsPortalType == 'explore' || this.properties.adminToolsPortalType == 'community' || this.properties.adminToolsPortalType == 'aggregator') &&
this.showOrcid && this.result.identifiers && this.result.identifiers.size > 0;
}
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {
if (changes.result && this.hasLink) { if (changes.result && this.hasLink) {
this.checkPID(); this.checkPID();
@ -109,35 +130,28 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
return Identifier.getPIDFromIdentifiers(this.result.identifiers); return Identifier.getPIDFromIdentifiers(this.result.identifiers);
} }
public initBeforeTitle() { public initMetadata() {
if (this.result.resultType && this.result.resultType !== 'dataprovider') { if (this.result.resultType && this.result.resultType !== 'dataprovider') {
this.type = this.getTypeName(this.result.resultType); this.type = this.getTypeName(this.result.resultType);
} }
if (this.result.types) { if (this.result.types) {
this.removeUnknown(this.removeDuplicates(this.result.types)).forEach(type => { this.types = this.removeUnknown(this.removeDuplicates(this.result.types));
this.beforeTitle.push(type);
});
}
if (this.result.year) {
this.beforeTitle.push(this.result.year.toString());
}
if (this.result.startYear && this.result.endYear) {
this.beforeTitle.push(this.result.startYear.toString() + ' - ' + this.result.endYear.toString());
} }
if (this.result.provenanceAction) { if (this.result.provenanceAction) {
let value = HelperFunctions.getVocabularyLabel(this.result.provenanceAction, this.provenanceActionVocabulary, false); this.provenanceAction = HelperFunctions.getVocabularyLabel(this.result.provenanceAction, this.provenanceActionVocabulary, false);
if (value) {
this.beforeTitle.push(value);
}
} }
if (this.result.relationName) { if (this.result.relationName) {
this.beforeTitle.push(HelperFunctions.getVocabularyLabel(this.result.relationName, this.relationsVocabulary)); this.relationName = HelperFunctions.getVocabularyLabel(this.result.relationName, this.relationsVocabulary);
} }
// if(this.result.percentage) { // if(this.result.percentage) {
// this.beforeTitle.push((this.result.relation ? this.result.relation+": " : "") + this.result.percentage.toString() + "%"); // this.beforeTitle.push((this.result.relation ? this.result.relation+": " : "") + this.result.percentage.toString() + "%");
// } // }
} }
get hasActions() {
return this.linking || this.share || this.cite || this.orcid;
}
public getTypeName(type: string): string { public getTypeName(type: string): string {
return StringUtils.getEntityName(type, false); return StringUtils.getEntityName(type, false);
} }
@ -174,7 +188,7 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
return this.routerHelper.createQueryParam(this.urlParam, this.result.id) return this.routerHelper.createQueryParam(this.urlParam, this.result.id)
} }
public get isResultType() { public get isResultType() {
return this.result.resultType == "publication" || this.result.resultType == "dataset" || return this.result.resultType == "publication" || this.result.resultType == "dataset" ||
this.result.resultType == "software" || this.result.resultType == "other" || this.result.resultType == "result"; this.result.resultType == "software" || this.result.resultType == "other" || this.result.resultType == "result";

View File

@ -6,10 +6,16 @@ import {ShowAuthorsModule} from "../authors/showAuthors.module";
import {ResultLandingUtilsModule} from "../../landingPages/landing-utils/resultLandingUtils.module"; import {ResultLandingUtilsModule} from "../../landingPages/landing-utils/resultLandingUtils.module";
import {OrcidModule} from "../../orcid/orcid.module"; import {OrcidModule} from "../../orcid/orcid.module";
import {IconsModule} from "../icons/icons.module"; import {IconsModule} from "../icons/icons.module";
import {IconsService} from "../icons/icons.service";
import {cite, fire, graph, landmark, link, link_to, quotes, rocket, versions} from "../icons/icons";
@NgModule({ @NgModule({
imports: [CommonModule, RouterModule, ShowAuthorsModule, ResultLandingUtilsModule, OrcidModule, IconsModule], imports: [CommonModule, RouterModule, ShowAuthorsModule, ResultLandingUtilsModule, OrcidModule, IconsModule],
declarations: [ResultPreviewComponent], declarations: [ResultPreviewComponent],
exports: [ResultPreviewComponent] exports: [ResultPreviewComponent]
}) })
export class ResultPreviewModule {} export class ResultPreviewModule {
constructor(private iconsService: IconsService) {
this.iconsService.registerIcons([link, quotes, cite, link_to, rocket, fire, landmark])
}
}

View File

@ -1,5 +1,5 @@
import {SearchResult} from "../entities/searchResult"; import {SearchResult} from "../entities/searchResult";
import {Measure, ResultLandingInfo} from "../entities/resultLandingInfo"; import {Measure, Metric, ResultLandingInfo} from "../entities/resultLandingInfo";
import {OrganizationInfo} from "../entities/organizationInfo"; import {OrganizationInfo} from "../entities/organizationInfo";
export interface HostedByCollectedFrom { export interface HostedByCollectedFrom {
@ -199,6 +199,7 @@ export class ResultPreview {
resultPreview.identifiers = result.identifiers; resultPreview.identifiers = result.identifiers;
resultPreview.enermapsId = result.enermapsId; resultPreview.enermapsId = result.enermapsId;
resultPreview.measure = result.measure; resultPreview.measure = result.measure;
resultPreview.hostedBy_collectedFrom = result.hostedBy_collectedFrom;
return resultPreview; return resultPreview;
} }