diff --git a/landingPages/project/project.component.html b/landingPages/project/project.component.html index 087181b8..4b0d79f9 100644 --- a/landingPages/project/project.component.html +++ b/landingPages/project/project.component.html @@ -571,14 +571,14 @@
-
- No Data Management Plans (DMPs) available. - Link existing DMPs with this project or start a new DMP in Argos. -
+
+ No Data Management Plans (DMPs) available. + Link existing DMPs with this project or start a new DMP in Argos. +
diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index 7f7448e9..cb7d6edb 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -431,11 +431,19 @@ Enermaps tool

+ + - - + @@ -473,7 +481,7 @@ - + 0) { this.activeTab = 'bioentities'; + } else if(this.enermapsId && this.properties.enermapsURL && this.properties.enermapsAPIURL) { + this.activeTab = "enermaps"; } } @@ -689,4 +694,27 @@ export class ResultLandingComponent { private isKeyword(value:string, words:string[]){ return value?words.filter( word => { return value.toLowerCase() == word}).length > 0:0; } + + public onSelectActiveTab(activeTabId) { + if (this.activeTab != activeTabId) { // tab really changed + this.activeTab = activeTabId; + if (activeTabId == 'enermaps' && this.properties.enermapsAPIURL) { + this.getEnermapsDetails(this.enermapsId); + } + } + } + + private getEnermapsDetails(id: string) { + if (this.reloadEnermapsDetails) { + this.subscriptions.push(this._resultLandingService.getEnermapsDetails(id).subscribe( + data => { + this.enermapsDetails = data; + this.reloadEnermapsDetails = false; + }, + error => { + console.error("Error in fetching enermaps details ",error); + } + )) + } + } } diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts index a428142a..c1b16b14 100644 --- a/landingPages/result/resultLanding.service.ts +++ b/landingPages/result/resultLanding.service.ts @@ -482,4 +482,25 @@ export class ResultLandingService { } return citations; } + + getEnermapsDetails(id: string) { + let url = properties.enermapsAPIURL+id; + return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)): url) + // return this.http.get(url) + .pipe(map(res => this.parseEnermapsDetails(res))); + } + + parseEnermapsDetails(response: any) { + let details = Array.isArray(response) ? response[0] : response; + let metadata = (details && details.metadata) ? details.metadata : null; + + let entries = []; + let keys = metadata ? Object.keys(metadata) : null; + for(let key of keys) { + if(key != "shared_id" && key && metadata[key]) { + entries.push([key, metadata[key]]); + } + } + return entries; + } } diff --git a/orcid/orcid-work.component.ts b/orcid/orcid-work.component.ts index 142106af..d41b87ef 100644 --- a/orcid/orcid-work.component.ts +++ b/orcid/orcid-work.component.ts @@ -373,7 +373,7 @@ export class OrcidWorkComponent { } ngOnInit() { - if(!this.givenPutCode) { + if(!this.givenPutCode && this.isLoggedIn) { this.getPutCode(); } } diff --git a/utils/properties/env-properties.ts b/utils/properties/env-properties.ts index 9ac9bca1..53768d58 100644 --- a/utils/properties/env-properties.ts +++ b/utils/properties/env-properties.ts @@ -24,6 +24,7 @@ export interface EnvProperties { statisticsAPIURL?: string; impactFactorsAPIURL?: string; enermapsURL?: string; + enermapsAPIURL?: string; claimsAPIURL?: string; searchAPIURLLAst?: string; searchResourcesAPIURL?: string; diff --git a/utils/tabs/contents/search-tab.component.ts b/utils/tabs/contents/search-tab.component.ts index efa89ef2..6ab6520e 100644 --- a/utils/tabs/contents/search-tab.component.ts +++ b/utils/tabs/contents/search-tab.component.ts @@ -23,6 +23,8 @@ import {ErrorCodes} from "../../properties/errorCodes"; + +