diff --git a/landingPages/landing-utils/fundedBy.component.ts b/landingPages/landing-utils/fundedBy.component.ts index 23fd374f..663b163b 100644 --- a/landingPages/landing-utils/fundedBy.component.ts +++ b/landingPages/landing-utils/fundedBy.component.ts @@ -1,6 +1,7 @@ import {Component, EventEmitter, Input, Output} from '@angular/core'; import {Project} from "../../utils/result-preview/result-preview"; import {properties} from "../../../../environments/environment"; +import {HelperFunctions} from '../../utils/HelperFunctions.class'; @Component({ selector: 'fundedBy', @@ -60,7 +61,7 @@ import {properties} from "../../../../environments/environment";
Validated by funder | - {{item.provenanceAction}} + {{getVocabularyLabel(item.provenanceAction, provenanceActionVocabulary)}}
@@ -78,6 +79,7 @@ export class FundedByComponent { public threshold: number = 4; public url = properties.searchLinkToProject.split('?')[0]; public title: string = "Funded by"; + @Input() provenanceActionVocabulary = null; public viewAllClick() { if(this.fundedByProjects.length <= this.threshold*2) { @@ -93,4 +95,8 @@ export class FundedByComponent { this.viewAll = false; this.viewAllClicked.emit(""); } + + public getVocabularyLabel(value: any, vocabulary: any) { + return HelperFunctions.getVocabularyLabel(value, vocabulary); + } } diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index 74294251..262fc020 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -32,8 +32,7 @@ export class ParsingFunctions { public ngOnDestroy() { } - public parseFundingByProjects(fundedByProjects: Project[], relation: any, - provenanceActionVocabulary: any): Project[] { + public parseFundingByProjects(fundedByProjects: Project[], relation: any): Project[] { if (fundedByProjects == undefined) { fundedByProjects = []; } @@ -52,10 +51,7 @@ export class ParsingFunctions { if(relation.validated && relation.validated.date) { fundedByProject['validated'] = true; } - - if (provenanceActionVocabulary != null && relation.provenanceaction in provenanceActionVocabulary) { - fundedByProject['provenanceAction'] = provenanceActionVocabulary[relation.provenanceaction]; - } + fundedByProject['provenanceAction'] = relation.provenanceaction; } else { fundedByProject['id'] = ""; fundedByProject['acronym'] = ""; diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index c60ac428..17c91f2f 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -479,7 +479,7 @@
- +
@@ -567,7 +567,8 @@ diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index f7e081cb..e34ee52b 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -125,6 +125,9 @@ export class ResultLandingComponent { public relatedClassSelected: string = ""; public filteredRelatedResults: RelationResult[]; + public provenanceActionVocabulary = null; + public relationsVocabulary = null; + public offset: number; public stickyHeader: boolean = false; public graph_offset: number = 0; @@ -358,28 +361,32 @@ export class ResultLandingComponent { this.showLoading = true; if (typeof document !== 'undefined') { - let observables: Array> = []; - observables.push(this._vocabulariesService.getProvenanceActionVocabulary(this.properties)); - observables.push(this._vocabulariesService.getSubjectsVocabulary(this.properties)); - observables.push(this._vocabulariesService.getRelationsVocabulary(this.properties)); - // observables.push(this.indexInfoService.getLastIndexDate(properties)); - // observables.push(this.indexInfoService.getLastOrcidUpdateDate(properties)); - - this.subscriptions.push(forkJoin(observables) - .subscribe( - // this.subscriptions.push(forkJoin(observables).subscribe( - // this.subscriptions.push(this._vocabulariesService.getProvenanceActionVocabulary(this.properties).subscribe( - vocabularies => { - this.getResultLandingInfo(vocabularies[0], vocabularies[1], vocabularies[2]); - }, err => { - this.getResultLandingInfo(null, null); - this.handleError("Error getting provenance action vocabulary for " + this.type, err); - } - )); - } else { - this.getResultLandingInfo(null, null); - } - + this.subscriptions.push(this._vocabulariesService.getProvenanceActionVocabulary(this.properties).subscribe( + data => { + this.provenanceActionVocabulary = data; + }, error => { + this.handleError("Error getting provenance action vocabulary for " + this.type, error); + } + )); + this.subscriptions.push(this._vocabulariesService.getSubjectsVocabulary(this.properties).subscribe( + data => { + this.getResultLandingInfo(data); + }, error => { + this.getResultLandingInfo(null); + this.handleError("Error getting subjects vocabulary for " + this.type, error); + } + )); + this.subscriptions.push(this._vocabulariesService.getRelationsVocabulary(this.properties).subscribe( + data => { + this.relationsVocabulary = data; + }, error => { + this.handleError("Error getting relations vocabulary for " + this.type, error); + } + )); + } + else { + this.getResultLandingInfo(null); + } } private setActiveTab() { @@ -424,14 +431,14 @@ export class ResultLandingComponent { // return numberOfTabs; // } - private getResultLandingInfo(provenanceActionVocabulary: any, subjectsVocabulary?: any, relationsVocabulary?: any) { + private getResultLandingInfo(subjectsVocabulary?: any) { if(this.resultFromInput && this.resultLandingInfo){ this.showLoading = false; return; } this.resultLandingInfo = null; this.hasAltMetrics = false; - this.subscriptions.push(this._resultLandingService.getResultLandingInfo(this.id, this.identifier, this.type, provenanceActionVocabulary, subjectsVocabulary, relationsVocabulary, this.properties).subscribe( + this.subscriptions.push(this._resultLandingService.getResultLandingInfo(this.id, this.identifier, this.type, subjectsVocabulary, this.properties).subscribe( data => { this.resultLandingInfo = data; this.id = this.resultLandingInfo.objIdentifier; @@ -490,7 +497,7 @@ export class ResultLandingComponent { if(this.resultLandingInfo.relatedClassFilters.size > 1) { for (let relClass of this.resultLandingInfo.relatedClassFilters) { - this.relatedClassFilters.push({"label": relClass, "value": relClass}); + this.relatedClassFilters.push({"label": HelperFunctions.getVocabularyLabel(relClass, this.relationsVocabulary), "value": relClass}); } } else { this.relatedClassFilters.pop(); diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts index 5a1adcb7..3bb8d720 100644 --- a/landingPages/result/resultLanding.service.ts +++ b/landingPages/result/resultLanding.service.ts @@ -57,7 +57,7 @@ export class ResultLandingService { } getResultLandingInfo (id: string, identifier: Identifier, type: string, - provenanceActionVocabulary: any, subjectsVocabulary: any, relationsVocabulary: any, + subjectsVocabulary: any, properties: EnvProperties): any { let url: string = this.buildResultLandingInfoUrl(id, identifier, type); @@ -99,7 +99,7 @@ export class ResultLandingService { res[0], // 14 res[2], // 15 ])) - .pipe(map(res => this.parseResultLandingInfo(res, provenanceActionVocabulary, subjectsVocabulary, relationsVocabulary, properties))); + .pipe(map(res => this.parseResultLandingInfo(res, subjectsVocabulary, properties))); } // getProvenanceActionVocabulary (properties: EnvProperties): any { @@ -125,7 +125,7 @@ export class ResultLandingService { return throwError(error || 'Server error'); } - parseResultLandingInfo (data: any, provenanceActionVocabulary: any, subjectsVocabulary: any, relationsVocabulary: any, properties: EnvProperties): any { + parseResultLandingInfo (data: any, subjectsVocabulary: any, properties: EnvProperties): any { this.resultLandingInfo = new ResultLandingInfo(); // res @@ -184,23 +184,15 @@ export class ResultLandingService { relation = Array.isArray(data[2]) ? data[2][i] : data[2]; if(relation.hasOwnProperty("to")) { if(relation['to'].class && relation['to'].class.toLowerCase() == "isproducedby") { - this.resultLandingInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.resultLandingInfo.fundedByProjects, relation, provenanceActionVocabulary); + this.resultLandingInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.resultLandingInfo.fundedByProjects, relation); } if(relation['to'].scheme && relation['to'].scheme == "dnet:result_result_relations") { let relationName: string = relation.to.class; - if(relation.to.class) { - if(relationsVocabulary != null && relation.to.class in relationsVocabulary) { - relationName = relationsVocabulary[relation.to.class]; - } - } if(!this.resultLandingInfo.relatedClassFilters.has(relationName)) { this.resultLandingInfo.relatedClassFilters.add(relationName); } - let provenanceAction: string = ""; - if(provenanceActionVocabulary != null && relation.provenanceaction in provenanceActionVocabulary) { - provenanceAction = provenanceActionVocabulary[relation.provenanceaction]; - } + let provenanceAction: string = relation.provenanceaction; this.resultLandingInfo.relatedResults = this.parsingFunctions.parseResults(this.resultLandingInfo.relatedResults, relation, provenanceAction, relationName); } else if(relation['to'].class && relation['to'].class.toLowerCase() == "hasauthorinstitution") { diff --git a/monitor/indicators/indicator-themes.component.ts b/monitor/indicators/indicator-themes.component.ts index 63b88e0f..a583c0c6 100644 --- a/monitor/indicators/indicator-themes.component.ts +++ b/monitor/indicators/indicator-themes.component.ts @@ -59,6 +59,7 @@ export class IndicatorThemesComponent implements OnInit, OnDestroy { const title = "Monitor | Indicator Themes"; this.metaTags(title, description); this.breadcrumbs[0].route = '/' + (params['stakeholder']?params['stakeholder']:''); + this.breadcrumbs[0].name = (params['stakeholder']?'dashboard':'home'); })); } diff --git a/monitor/indicators/indicators.component.ts b/monitor/indicators/indicators.component.ts index 157299c4..2433d8c9 100644 --- a/monitor/indicators/indicators.component.ts +++ b/monitor/indicators/indicators.component.ts @@ -48,6 +48,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy { } } this.breadcrumbs[0].route = '/' + (params['stakeholder']?params['stakeholder']:''); + this.breadcrumbs[0].name = (params['stakeholder']?'dashboard':'home'); })); } diff --git a/monitor/methodology/see-how-it-works.component.ts b/monitor/methodology/see-how-it-works.component.ts index b69fd1b5..44434441 100644 --- a/monitor/methodology/see-how-it-works.component.ts +++ b/monitor/methodology/see-how-it-works.component.ts @@ -83,6 +83,7 @@ export class SeeHowItWorksComponent implements OnInit, OnDestroy { const title = "Monitor | See how it works"; this.metaTags(title, description); this.breadcrumbs[0].route = '/' + (params['stakeholder']?params['stakeholder']:''); + this.breadcrumbs[0].name = (params['stakeholder']?'dashboard':'home'); })); } diff --git a/monitor/methodology/terminology.component.ts b/monitor/methodology/terminology.component.ts index baab49f0..0c999908 100644 --- a/monitor/methodology/terminology.component.ts +++ b/monitor/methodology/terminology.component.ts @@ -464,6 +464,7 @@ export class TerminologyComponent implements OnInit, OnDestroy { const title = "Monitor | Terminology and construction"; this.metaTags(title, description); this.breadcrumbs[0].route = '/' + (params['stakeholder']?params['stakeholder']:''); + this.breadcrumbs[0].name = (params['stakeholder']?'dashboard':'home'); })); } diff --git a/orcid/orcid-work.component.ts b/orcid/orcid-work.component.ts index aefee71c..250bec59 100644 --- a/orcid/orcid-work.component.ts +++ b/orcid/orcid-work.component.ts @@ -438,7 +438,7 @@ export class OrcidWorkComponent { } private getResultLandingInfo(action: string) { - this.subscriptions.push(this.resultLandingService.getResultLandingInfo(this.resultId, null, this.type, null, null, null, properties).subscribe( + this.subscriptions.push(this.resultLandingService.getResultLandingInfo(this.resultId, null, this.type, null, properties).subscribe( resultLandingInfo => { this.resultLandingInfo = resultLandingInfo; if (this.resultLandingInfo && this.resultLandingInfo.identifiers) { diff --git a/orcid/orcidWork.ts b/orcid/orcidWork.ts index 83816617..9bceefae 100644 --- a/orcid/orcidWork.ts +++ b/orcid/orcidWork.ts @@ -25,13 +25,13 @@ export class WorkV3_0 { private static mapType(type: string): string { if(type == "Annotation") { return "annotation"; - } else if(type == "Article") { + } else if(type == "Article" || type == "publication") { return "journal-article"; } else if(type == "Book") { return "book"; } else if(type == "Clinical Trial") { return "test"; - } else if(type == "Dataset") { + } else if(type == "Dataset" || type == "dataset") { return "data-set"; } else if(type == "Doctoral thesis") { return "dissertation-thesis"; @@ -55,7 +55,7 @@ export class WorkV3_0 { return "working-paper"; } else if(type == "Review") { return "book-review"; - } else if(type == "Software") { + } else if(type == "Software" || type == "software") { return "software"; } return "other"; @@ -121,6 +121,9 @@ export class WorkV3_0 { } // work['type'] = this.mapType(resultLandingInfo.types[0]); } + if(!work['type']) { + work['type'] = this.mapType(resultLandingInfo.resultType); + } if(resultLandingInfo.date || resultLandingInfo.dateofacceptance) { if(resultLandingInfo.dateofacceptance) { diff --git a/searchPages/searchUtils/portal-search-result.component.html b/searchPages/searchUtils/portal-search-result.component.html index da1b8600..60975ab2 100644 --- a/searchPages/searchUtils/portal-search-result.component.html +++ b/searchPages/searchUtils/portal-search-result.component.html @@ -79,9 +79,7 @@
-

- {{result.description}} -

+

diff --git a/utils/HelperFunctions.class.ts b/utils/HelperFunctions.class.ts index 35b6cc7d..981fdf21 100644 --- a/utils/HelperFunctions.class.ts +++ b/utils/HelperFunctions.class.ts @@ -72,6 +72,13 @@ export class HelperFunctions { return Object.keys(value).map(key => value[key]); } + public static getVocabularyLabel(value: any, vocabulary: any) { + if(vocabulary && value in vocabulary) { + return vocabulary[value]; + } + return value; + } + public static sortSDGs(sgd1: string, sdg2: string): number { let splitA: string[] = sgd1.split("."); let numA: number; diff --git a/utils/icons/icons.ts b/utils/icons/icons.ts index 07e21dbd..1a6447dd 100644 --- a/utils/icons/icons.ts +++ b/utils/icons/icons.ts @@ -200,12 +200,12 @@ export const filters = { export const orcid_add = { name: 'orcid_add', - data: '' + data: '' } export const orcid_bin = { name: 'orcid_bin', - data: '' + data: '' } export const link = { diff --git a/utils/result-preview/result-preview.component.ts b/utils/result-preview/result-preview.component.ts index d8d66880..e613dc3b 100644 --- a/utils/result-preview/result-preview.component.ts +++ b/utils/result-preview/result-preview.component.ts @@ -7,6 +7,7 @@ import {properties} from "../../../../environments/environment"; import {Session} from "../../login/utils/helper.class"; import {Identifier, StringUtils} from "../string-utils.class"; import {OpenaireEntities} from "../properties/searchFields"; +import {HelperFunctions} from "../HelperFunctions.class"; @Component({ selector: 'result-preview', @@ -33,6 +34,8 @@ export class ResultPreviewComponent implements OnInit, OnChanges { @Input() showOrcid: boolean = true; @Input() showEnermaps: boolean = false; @Input() deposit: boolean = false; + @Input() provenanceActionVocabulary = null; + @Input() relationsVocabulary = null; ngOnInit(): void { if(this.hasLink) { @@ -119,11 +122,11 @@ export class ResultPreviewComponent implements OnInit, OnChanges { if(this.result.startYear && this.result.endYear) { this.beforeTitle.push(this.result.startYear.toString() + ' - ' + this.result.endYear.toString()); } - if(this.result.provenanceAction) { - this.beforeTitle.push(this.result.provenanceAction); - } + if(this.result.provenanceAction) { + this.beforeTitle.push(HelperFunctions.getVocabularyLabel(this.result.provenanceAction, this.provenanceActionVocabulary)); + } if(this.result.relationName) { - this.beforeTitle.push(this.result.relationName); + this.beforeTitle.push(HelperFunctions.getVocabularyLabel(this.result.relationName, this.relationsVocabulary)); } // if(this.result.percentage) { // this.beforeTitle.push((this.result.relation ? this.result.relation+": " : "") + this.result.percentage.toString() + "%");