From 826de9f3938df9ee98956c51913caa48862163fb Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Wed, 4 Mar 2020 14:29:50 +0000 Subject: [PATCH] [Explore|Trunk] Result Landing page: add type "result" add query for type result update result info with resulttype update urls when the result type is returned git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58176 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../result/resultLanding.component.ts | 28 +++++++++++++++++++ landingPages/result/resultLanding.service.ts | 3 ++ utils/entities/resultLandingInfo.ts | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index 7f8b0974..e770a3a1 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -134,6 +134,12 @@ export class ResultLandingComponent { this.linkToSearchPage = this.properties.searchLinkToOrps; this.id = data['orpId']; this.title = "Other Research Product"; + }else if(this.type == "result"){ + this.id = data["id"]; + this.updateTitle("Research Result"); + this.linkToLandingPage = this.properties.searchLinkToOrp; + this.linkToSearchPage = this.properties.searchLinkToResults; + this.title = "Research Result"; } this.updateDescription(""); @@ -223,6 +229,9 @@ export class ResultLandingComponent { this.infoSub = this._resultLaningService.getResultLandingInfo(this.id, this.type, provenanceActionVocabulary, this.properties).subscribe( data => { this.resultLandingInfo = data; + if(this.type == "result"){ // no type was specified - update URL based this.resultLandingInfo.resultType + this.updateUrlWithType(); + } this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.linkToLandingPage + this.resultLandingInfo.record["result"]["header"]["dri:objIdentifier"]); if ((this.type == "publication") && (this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) { this.getOpenCitations(this.id); @@ -442,4 +451,23 @@ export class ResultLandingComponent { window.scroll(0, scrolledY - offsetHeight - 50); } } + updateUrlWithType(){ + this.type = this.resultLandingInfo.resultType; + if(this.type == "publication") { + this._location.go("test"); + this.linkToLandingPage = this.properties.searchLinkToPublication; + this.linkToSearchPage = this.properties.searchLinkToPublications; + } else if(this.type == "dataset") { + this.linkToLandingPage = this.properties.searchLinkToDataset; + this.linkToSearchPage = this.properties.searchLinkToDatasets; + } else if(this.type == "software") { + this.linkToLandingPage = this.properties.searchLinkToSoftware; + this.linkToSearchPage = this.properties.searchLinkToSoftwareLanding; + } else if(this.type == "other") { + this.type="orp"; + this.linkToLandingPage = this.properties.searchLinkToOrp; + this.linkToSearchPage = this.properties.searchLinkToOrps; + } + this._location.go(this.linkToLandingPage + this.id); + } } diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts index 9c2ab73a..591bbf8c 100644 --- a/landingPages/result/resultLanding.service.ts +++ b/landingPages/result/resultLanding.service.ts @@ -26,6 +26,8 @@ export class ResultLandingService { url += 'software/'; } else if (type === 'orp') { url += 'other/'; + } else if (type === 'result') { + url += 'results/'; } url += id + '?format=json'; @@ -81,6 +83,7 @@ export class ResultLandingService { // res this.resultLandingInfo.record = data[14]; + this.resultLandingInfo.resultType = data[0].resulttype.classid; // res['result']['metadata']['oaf:entity']['oaf:result'] if (data[0] != null) { diff --git a/utils/entities/resultLandingInfo.ts b/utils/entities/resultLandingInfo.ts index 2c6567ee..5f5cf815 100644 --- a/utils/entities/resultLandingInfo.ts +++ b/utils/entities/resultLandingInfo.ts @@ -1,7 +1,7 @@ export class ResultLandingInfo { // PUBLICATION, DATASET, SOFTWARE, ORP record; - + resultType: "publication"|"dataset"|"other"|"software"; // PUBLICATION, DATASET, SOFTWARE, ORP, DELETED_BY_INFERENCE title: string; accessMode: string;