From 889a58cb37bbe4b540dc7f584ee3e62610d789c9 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Sat, 20 Feb 2021 09:23:59 +0000 Subject: [PATCH] [Trunk | Library]: 1. myOrcidLinks.component.ts: a. Added title "My ORCID links". b. Set page metadata (_meta, _title). 2. orcid.component.ts: Set page metadata (_meta, _title). 3. orcid-work.component.ts: move ORCID icon (iD), after word "ORCID". 4. orcidWork.ts: a. Do not map OpenAIRE type "Film" to ORCID type "artistic-performance". b. For each result, map first OpenAIRE type, which is not "other" (if exists). git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60466 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../my-orcid-links/myOrcidLinks.component.ts | 33 +++++++++++++++++-- orcid/orcid-work.component.ts | 29 ++++++++-------- orcid/orcid.component.ts | 24 +++++++++++++- orcid/orcidWork.ts | 12 +++++-- 4 files changed, 78 insertions(+), 20 deletions(-) diff --git a/orcid/my-orcid-links/myOrcidLinks.component.ts b/orcid/my-orcid-links/myOrcidLinks.component.ts index d079e791..17a6780e 100644 --- a/orcid/my-orcid-links/myOrcidLinks.component.ts +++ b/orcid/my-orcid-links/myOrcidLinks.component.ts @@ -15,6 +15,7 @@ import {LoginErrorCodes} from "../../login/utils/guardHelper.class"; import {SearchResult} from "../../utils/entities/searchResult"; import {ResultPreview} from "../../utils/result-preview/result-preview"; import {HttpClient} from "@angular/common/http"; +import {Meta, Title} from "@angular/platform-browser"; declare var UIkit: any; @@ -31,6 +32,9 @@ declare var UIkit: any;
+
+ My ORCID links +
@@ -166,7 +170,8 @@ export class MyOrcidLinksComponent { constructor (private route: ActivatedRoute, private router: Router, private _orcidService: OrcidService, - private _searchResearchResultsService: SearchResearchResultsService + private _searchResearchResultsService: SearchResearchResultsService, + private _meta: Meta, private _title: Title // ,private http: HttpClient/*ATHENA CODE*/ ) { this.errorCodes = new ErrorCodes(); @@ -222,9 +227,14 @@ export class MyOrcidLinksComponent { // this.typeQuery += "&type=results"; // } - this.typeQuery = "&type=results"; + // this.typeQuery = "&type=results"; // this.getLocalWorks(this.currentPage, this.resultsPerPage); // })); + var description = "Openaire, ORCID linking, publication, research data, software, other research product"; + this.updateTitle("My ORCID Links"); + this.updateDescription(description); + this.updateUrl( properties.domain + properties.baseLink + this.route.url); + this.typeQuery = "&type=results"; this.getLocalWorks(); } @@ -535,4 +545,23 @@ export class MyOrcidLinksComponent { } this.showLoading = false; } + + private updateTitle(title: string) { + var _prefix = ""; + // if(!this.communityId) { + // _prefix = "OpenAIRE | "; + // } + // var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title); + this._title.setTitle(title); + this._meta.updateTag({content: title}, "property='og:title'"); + } + + private updateDescription(description: string) { + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); + } + + private updateUrl(url: string) { + this._meta.updateTag({content: url}, "property='og:url'"); + } } diff --git a/orcid/orcid-work.component.ts b/orcid/orcid-work.component.ts index d52a6ef4..baa2315f 100644 --- a/orcid/orcid-work.component.ts +++ b/orcid/orcid-work.component.ts @@ -44,8 +44,8 @@ declare var UIkit: any; Add to - {{" "}} - ORCID + ORCID + {{" "}} @@ -76,8 +76,8 @@ declare var UIkit: any; Delete from - {{" "}} - ORCID + ORCID + {{" "}} @@ -166,21 +166,22 @@ declare var UIkit: any; Grant OpenAIRE - - - - - + + + + +
-
- {{" "}} - ORCID ACTIONS -
+ + ORCID + + ACTIONS +
- It seems than this result in OpenAIRE is the deduplication of multiple harvested results. + This result in OpenAIRE is the deduplication of multiple harvested results. You have already added {{this.putCodes?.length}} works in your ORCID record related to this result.
If you continue with delete action, all these works will be deleted. diff --git a/orcid/orcid.component.ts b/orcid/orcid.component.ts index 10763f73..afe60759 100644 --- a/orcid/orcid.component.ts +++ b/orcid/orcid.component.ts @@ -4,6 +4,7 @@ import {Subscriber, Subscription} from "rxjs"; import {OrcidService} from "./orcid.service"; import {properties} from "../../../environments/environment"; import {RouterHelper} from "../utils/routerHelper.class"; +import {Meta, Title} from "@angular/platform-browser"; @Component({ selector: 'orcid', @@ -31,9 +32,15 @@ export class OrcidComponent { constructor(private route: ActivatedRoute, private _router: Router, - private orcidService: OrcidService) {} + private orcidService: OrcidService, + private _meta: Meta, private _title: Title) {} ngOnInit() { + var description = "Openaire, ORCID"; + this.updateTitle("Connect with ORCID"); + this.updateDescription(description); + this.updateUrl( properties.domain + properties.baseLink + this.route.url); + this.subscriptions.push(this.route.queryParams.subscribe(params => { this.source = params['source']; if (params['code']) { @@ -123,4 +130,19 @@ export class OrcidComponent { } ) } + + + private updateTitle(title: string) { + this._title.setTitle(title); + this._meta.updateTag({content: title}, "property='og:title'"); + } + + private updateDescription(description: string) { + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); + } + + private updateUrl(url: string) { + this._meta.updateTag({content: url}, "property='og:url'"); + } } \ No newline at end of file diff --git a/orcid/orcidWork.ts b/orcid/orcidWork.ts index 6e6fc262..31be797b 100644 --- a/orcid/orcidWork.ts +++ b/orcid/orcidWork.ts @@ -35,8 +35,8 @@ export class WorkV3_0 { return "data-set"; } else if(type == "Doctoral thesis") { return "dissertation-thesis"; - } else if(type == "Film") { - return "artistic-performance"; + // } else if(type == "Film") { + // return "artistic-performance"; } else if(type == "Lecture") { return "lecture-speech"; } else if(type == "Newsletter") { @@ -111,7 +111,13 @@ export class WorkV3_0 { // citation (Citation, optional), if(resultLandingInfo.types) { - work['type'] = this.mapType(resultLandingInfo.types[0]); + for(let type of resultLandingInfo.types) { + work['type'] = this.mapType(type); + if(work['type'] != "other") { + break; + } + } + // work['type'] = this.mapType(resultLandingInfo.types[0]); } if(resultLandingInfo.date || resultLandingInfo.dateofacceptance) {