[Trunk | Library]:

1. result-preview.ts: In interface "Author" add field "orcid_pending".
2. deletedByInference.service.ts, searchResearchResults.service.ts, resultLanding.service.ts:
	a. [Bug fix #6342]: On title parsing, set the title with classid = "main title" if exists.
	b. Add "orcid_pending" field to authors, to separate "orcid" from "orcid_pending".
	c. Only for resultLanding.service.ts: Add "orcid_pending" field to authors, to separate "orcid" from "orcid_pending".
3. open-aire-jsonld-converter.service.ts: [Bug fix #6342]: On title parsing, set the title with classid = "main title" if exists.
4. showAuthors.component.ts: Show black ORCID icon for authors with orcid_pending (and keep green icon for orcid).


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60464 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2021-02-20 09:20:05 +00:00
parent 5ee9ca6803
commit f592e7943f
6 changed files with 76 additions and 21 deletions

View File

@ -67,9 +67,22 @@ export class DeletedByInferenceService {
let title = _result['oaf:result']['title']; let title = _result['oaf:result']['title'];
if(Array.isArray(title)) { if(Array.isArray(title)) {
result.title = title[0].content; for(let i=0; i<title.length; i++) {
if(title[i] && title[i].content) {
if(!result.title || title[i].classid == "main title") {
result.title = String(title[i].content);
}
if(title[i].classid == "main title") {
break;
}
}
}
if(!result.title) {
result.title = "";
}
//result.title = title[0].content;
} else { } else {
result.title = title.content; result.title = String(title.content);
} }
} }
@ -121,7 +134,7 @@ export class DeletedByInferenceService {
if(_result['oaf:result'] && _result['oaf:result']['creator']) { if(_result['oaf:result'] && _result['oaf:result']['creator']) {
if(result.authors == undefined) { if(result.authors == undefined) {
result.authors = new Array<{"fullName": string, "orcid": string}>(); result.authors = new Array<{"fullName": string, "orcid": string, "orcid_pending": string}>();
} }
let authors = _result['oaf:result']['creator']; let authors = _result['oaf:result']['creator'];
@ -133,7 +146,7 @@ export class DeletedByInferenceService {
/*if (author.orcid && author.orcid.indexOf(properties.orcidURL) != -1) { /*if (author.orcid && author.orcid.indexOf(properties.orcidURL) != -1) {
author.orcid = author.orcid.substr(properties.orcidURL.length); author.orcid = author.orcid.substr(properties.orcidURL.length);
}*/ }*/
result['authors'][author.rank] = {"fullName": author.content, "orcid": author.orcid}; result['authors'][author.rank] = {"fullName": author.content, "orcid": author.orcid, "orcid_pending": author.orcid_pending};
} }
} }
result.authors = result.authors.filter(function (item) { result.authors = result.authors.filter(function (item) {

View File

@ -28,7 +28,7 @@ export class ResultLandingService {
url += 'datasets/'; url += 'datasets/';
} else if (type === 'software') { } else if (type === 'software') {
url += 'software/'; url += 'software/';
} else if (type === 'orp') { } else if (type === 'orp' || type === 'other') {
url += 'other/'; url += 'other/';
} else if (type === 'result') { } else if (type === 'result') {
url += 'results/'; url += 'results/';
@ -153,12 +153,17 @@ export class ResultLandingService {
if(Array.isArray(data[1])) { if(Array.isArray(data[1])) {
for(let i=0; i<data[1].length; i++) { for(let i=0; i<data[1].length; i++) {
if(data[1][i] && data[1][i].content) { if(data[1][i] && data[1][i].content) {
this.resultLandingInfo.title = data[1][i].content; if(!this.resultLandingInfo.title || data[1][i].classid == "main title") {
this.resultLandingInfo.title = String(data[1][i].content);
}
if(data[1][i].classid == "main title") { if(data[1][i].classid == "main title") {
break; break;
} }
} }
} }
if(!this.resultLandingInfo.title) {
this.resultLandingInfo.title = "";
}
// this.resultLandingInfo.title = (data[1][0] && data[1][0].content) ? String(data[1][0].content) : ""; // this.resultLandingInfo.title = (data[1][0] && data[1][0].content) ? String(data[1][0].content) : "";
if(data[1][1].classid === 'subtitle') { if(data[1][1].classid === 'subtitle') {
this.resultLandingInfo.subtitle = (data[1][1] && data[1][1].content) ? String(data[1][1].content) : ""; this.resultLandingInfo.subtitle = (data[1][1] && data[1][1].content) ? String(data[1][1].content) : "";
@ -334,7 +339,7 @@ export class ResultLandingService {
// res['result']['metadata']['oaf:entity']['oaf:result']['creator'] // res['result']['metadata']['oaf:entity']['oaf:result']['creator']
if(data[9] != null) { if(data[9] != null) {
if(this.resultLandingInfo.authors == undefined) { if(this.resultLandingInfo.authors == undefined) {
this.resultLandingInfo.authors = new Array<{"fullName": string, "orcid": string}>(); this.resultLandingInfo.authors = new Array<{"fullName": string, "orcid": string, "orcid_pending": string}>();
} }
let authors = data[9]; let authors = data[9];
@ -343,7 +348,7 @@ export class ResultLandingService {
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
let author = Array.isArray(authors) ? authors[i] : authors; let author = Array.isArray(authors) ? authors[i] : authors;
if(author) { if(author) {
this.resultLandingInfo['authors'][author.rank] = {"fullName": author.content, "orcid": author.orcid}; this.resultLandingInfo['authors'][author.rank] = {"fullName": author.content, "orcid": author.orcid, "orcid_pending": author.orcid_pending};
} }
} }
this.resultLandingInfo.authors = this.resultLandingInfo.authors.filter(function (item) { this.resultLandingInfo.authors = this.resultLandingInfo.authors.filter(function (item) {

View File

@ -265,7 +265,20 @@ export class SearchResearchResultsService {
result['title'] = {"name": '', "accessMode": '', "sc39": ''}; result['title'] = {"name": '', "accessMode": '', "sc39": ''};
if(Array.isArray(resData['title'])) { if(Array.isArray(resData['title'])) {
result['title'].name = (resData['title'][0] && resData['title'][0].content) ? String(resData['title'][0].content) : ""; for(let i=0; i<resData['title'].length; i++) {
if(resData['title'][i] && resData['title'][i].content) {
if(!result.title.name || resData['title'][i].classid == "main title") {
result['title'].name = String(resData['title'][i].content);
}
if(resData['title'][i].classid == "main title") {
break;
}
}
}
if(!result.title.name) {
result['title'].name = "";
}
// result['title'].name = (resData['title'][0] && resData['title'][0].content) ? String(resData['title'][0].content) : "";
} else { } else {
result['title'].name = (resData['title'] && resData['title'].content) ? String(resData['title'].content) : ""; result['title'].name = (resData['title'] && resData['title'].content) ? String(resData['title'].content) : "";
} }
@ -275,6 +288,8 @@ export class SearchResearchResultsService {
if(canId){ if(canId){
result['id'] = canId; result['id'] = canId;
} }
result['relcanId'] = result['id'];
if(resData['bestaccessright'] && resData['bestaccessright'].hasOwnProperty("classname")) { if(resData['bestaccessright'] && resData['bestaccessright'].hasOwnProperty("classname")) {
result['title'].accessMode = resData['bestaccessright'].classname; result['title'].accessMode = resData['bestaccessright'].classname;
} }
@ -294,7 +309,7 @@ export class SearchResearchResultsService {
if(resData.hasOwnProperty("creator") && resData['creator'] != null) { if(resData.hasOwnProperty("creator") && resData['creator'] != null) {
if(result['authors'] == undefined) { if(result['authors'] == undefined) {
result['authors'] = new Array<{"fullName": string, "orcid": string}>(); result['authors'] = new Array<{"fullName": string, "orcid": string, "orcid_pending": string}>();
} }
let authors = resData['creator']; let authors = resData['creator'];
@ -303,7 +318,7 @@ export class SearchResearchResultsService {
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
let author = Array.isArray(authors) ? authors[i] : authors; let author = Array.isArray(authors) ? authors[i] : authors;
if(author) { if(author) {
result['authors'][author.rank] = {"fullName": author.content, "orcid": author.orcid}; result['authors'][author.rank] = {"fullName": author.content, "orcid": author.orcid, "orcid_pending": author.orcid_pending};
} }
} }
result.authors = result.authors.filter(function (item) { result.authors = result.authors.filter(function (item) {

View File

@ -174,8 +174,23 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
private getTitle(result: any): String[] { private getTitle(result: any): String[] {
const title = _.get(result, "result.metadata.oaf:entity.oaf:result.title", null); const title = _.get(result, "result.metadata.oaf:entity.oaf:result.title", null);
let return_title;
if(title && Array.isArray(title) ){ if(title && Array.isArray(title) ){
return (title[0] && title[0].content)?title[0].content:""; for(let i=0; i<title.length; i++) {
if(title[i] && title[i].content) {
if(!return_title || title[i].classid == "main title") {
return_title = String(title[i].content);
}
if(title[i].classid == "main title") {
break;
}
}
}
if(!return_title) {
return_title = "";
}
return return_title;
// return (title[0] && title[0].content)?title[0].content:"";
}else{ }else{
return (title && title.content)?title.content:""; return (title && title.content)?title.content:"";
} }

View File

@ -13,17 +13,20 @@ import {properties} from "../../../../environments/environment";
template: ` template: `
<div *ngIf="authors" class="uk-height-max-medium uk-overflow-auto"> <div *ngIf="authors" class="uk-height-max-medium uk-overflow-auto">
<span *ngFor="let author of authors.slice(0,numberOfAuthors) let i=index"> <span *ngFor="let author of authors.slice(0,numberOfAuthors) let i=index">
<span *ngIf="!author.orcid || !testBrowser" <span *ngIf="(!author.orcid && !author.orcid_pending) || !testBrowser"
[class.uk-text-small]="small"> [class.uk-text-small]="small">
{{author.fullName + "; "}} {{author.fullName + "; "}}
</span> </span>
<a *ngIf="author.orcid && testBrowser"> <a *ngIf="(author.orcid || author.orcid_pending) && testBrowser" class="uk-display-inline-block space">
<img src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="">{{" "}} <span>
<img *ngIf="author.orcid" src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="">{{" "}}
<img *ngIf="author.orcid_pending" src="assets/common-assets/common/ORCIDiD_iconbw16x16.png" alt="">{{" "}}
<span [class.uk-text-small]="small"> <span [class.uk-text-small]="small">
{{author.fullName + "; "}} {{author.fullName + "; "}}
</span> </span>
</span>
</a> </a>
<div *ngIf="author.orcid && testBrowser" <div *ngIf="(author.orcid || author.orcid_pending) && testBrowser"
class="default-dropdown uk-margin-remove-top uk-padding-medium uk-dropdown" class="default-dropdown uk-margin-remove-top uk-padding-medium uk-dropdown"
uk-dropdown="pos: bottom-left; mode:click" style="min-width: 70px !important;"> uk-dropdown="pos: bottom-left; mode:click" style="min-width: 70px !important;">
<b class="uk-margin-top">{{author.fullName}}</b> <b class="uk-margin-top">{{author.fullName}}</b>
@ -31,19 +34,22 @@ import {properties} from "../../../../environments/environment";
<div class="uk-text-muted uk-margin-small-bottom uk-margin-small-top">ORCID</div> <div class="uk-text-muted uk-margin-small-bottom uk-margin-small-top">ORCID</div>
<div> <div>
<div class="orcid uk-display-inline-block"> <div class="orcid uk-display-inline-block">
<input #element class="uk-padding-small uk-padding-remove-vertical uk-disabled" style="min-height: 38px" name="code" [value]="author.orcid"> <input #element class="uk-padding-small uk-padding-remove-vertical uk-disabled"
style="min-height: 38px; min-width: 250px;" name="code" [value]="properties.orcidURL+(author.orcid ? author.orcid : author.orcid_pending)">
<button [class]="'uk-button uk-button-primary uk-button-small uk-icon copy orcid_clipboard_btn_auhtor_'+i" style="min-height: 40px" <button [class]="'uk-button uk-button-primary uk-button-small uk-icon copy orcid_clipboard_btn_auhtor_'+i" style="min-height: 40px"
(click)="copyToClipboard(element)" title="Copy to clipboard"> (click)="copyToClipboard(element)" title="Copy to clipboard">
<span class="custom-icon custom-copy-white"></span> <span class="custom-icon custom-copy-white"></span>
</button> </button>
</div> </div>
<a class="uk-button uk-button-primary custom-icon-button target uk-button-icon uk-margin-small-left" <a class="uk-button uk-button-primary custom-icon-button target uk-button-icon uk-margin-small-left"
title="Visit author in Orcid" [href]="properties.orcidURL+author.orcid" target="_blank"> title="Visit author in ORCID" [href]="properties.orcidURL+(author.orcid ? author.orcid : author.orcid_pending)" target="_blank">
<span class="custom-icon custom-external-white"></span> <span class="custom-icon custom-external-white"></span>
</a> </a>
</div> </div>
</div> </div>
<div *ngIf="author.orcid" class="uk-text-muted uk-text-small uk-margin-top">Harvested from ORCID Public Data File</div>
<hr> <hr>
<div class="uk-margin-top"> <div class="uk-margin-top">
Search <b>{{author.fullName}}</b> in OpenAIRE Search <b>{{author.fullName}}</b> in OpenAIRE
@ -51,7 +57,7 @@ import {properties} from "../../../../environments/environment";
<div class="uk-text-center uk-margin-top uk-margin-large-left uk-margin-large-right"> <div class="uk-text-center uk-margin-top uk-margin-large-left uk-margin-large-right">
<a class="uk-button uk-text-bold portal-button uk-padding-remove-top uk-padding-remove-bottom uk-width-1-1" <a class="uk-button uk-text-bold portal-button uk-padding-remove-top uk-padding-remove-bottom uk-width-1-1"
(click)="onClick()" (click)="onClick()"
[queryParams]="routerHelper.createQueryParams(['orcid','oc'],[author['orcid'],'and'])" [queryParams]="routerHelper.createQueryParams(['orcid','oc'],[(author['orcid'] ? author['orcid'] : author['orcid_pending']),'and'])"
routerLinkActive="router-link-active" [routerLink]="properties.searchLinkToAdvancedResults"> routerLinkActive="router-link-active" [routerLink]="properties.searchLinkToAdvancedResults">
<span class="space">Search</span> <span class="space">Search</span>
</a> </a>

View File

@ -52,6 +52,7 @@ export interface Project {
export interface Author { export interface Author {
fullName: string; fullName: string;
orcid: string; orcid: string;
orcid_pending: string;
} }
export interface ResultTitle { export interface ResultTitle {