diff --git a/connect/connectHelper.ts b/connect/connectHelper.ts index 5990419c..2fcdf3c3 100644 --- a/connect/connectHelper.ts +++ b/connect/connectHelper.ts @@ -4,7 +4,7 @@ import {properties} from "../../../environments/environment"; export class ConnectHelper { public static getCommunityFromDomain(domain: string): string{ - domain = "beta.egi.openaire.eu"; //for testing + domain = "beta.enermaps.openaire.eu"; //for testing domain = domain.indexOf("//") != -1? domain.split("//")[1]:domain; //remove https:// prefix if (domain.indexOf('openaire.eu') === -1) { return null; diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index db11c467..6f1b8dfa 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -614,7 +614,10 @@ export class ParsingFunctions { } return contexts; } - + public static getEnermapsConceptId(contexts: any): string{ + let enermapsconcepts = contexts.filter(c=> {return c.idCategory == "enermaps::selection" && c.idConcept}); + return enermapsconcepts && enermapsconcepts.length > 0?enermapsconcepts[0].idConcept.split("enermaps::selection::")[1]:null; + } parseTypes(types: string[], uniqueTypes: Set, instance: any) { if (instance && instance.hasOwnProperty("instancetype") && instance['instancetype'].classname) { if (!uniqueTypes.has(instance['instancetype'].classname)) { diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index b884bbe6..66887691 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -210,6 +210,11 @@ View less +
+ Enermaps tool preview + +
+ [showSubjects]="showSubjects" [result]="result" [showEnermaps]="showEnermaps">
diff --git a/searchPages/searchUtils/searchResult.component.ts b/searchPages/searchUtils/searchResult.component.ts index c8548756..47c3c4e3 100644 --- a/searchPages/searchUtils/searchResult.component.ts +++ b/searchPages/searchUtils/searchResult.component.ts @@ -22,7 +22,7 @@ export class SearchResultComponent implements OnInit, OnChanges { @Input() custom_class: string = "search-results"; @Input() properties: EnvProperties; @Input() showImpactFactors: boolean = false; - @Input() showImage: boolean; + @Input() showEnermaps: boolean; constructor( private http: HttpClient/*ATHENA CODE*/ , private orcidService: OrcidService) { diff --git a/services/searchResearchResults.service.ts b/services/searchResearchResults.service.ts index e2b48bd8..9872d559 100644 --- a/services/searchResearchResults.service.ts +++ b/services/searchResearchResults.service.ts @@ -366,7 +366,9 @@ export class SearchResearchResultsService { } } } - + if(resData['context'] != null) { + result.enermapsId = ParsingFunctions.getEnermapsConceptId(this.parsingFunctions.parseContexts(resData['context'])); + } results.push(result); } diff --git a/utils/entities/searchResult.ts b/utils/entities/searchResult.ts index abb1afbd..d88b6731 100644 --- a/utils/entities/searchResult.ts +++ b/utils/entities/searchResult.ts @@ -57,7 +57,7 @@ export class SearchResult { entityType: string; types: string[]; - + enermapsId:string; constructor() { } diff --git a/utils/fetchEntitiesClasses/fetchResearchResults.class.ts b/utils/fetchEntitiesClasses/fetchResearchResults.class.ts index 42c1ca58..1262c3f9 100644 --- a/utils/fetchEntitiesClasses/fetchResearchResults.class.ts +++ b/utils/fetchEntitiesClasses/fetchResearchResults.class.ts @@ -83,7 +83,25 @@ export class FetchResearchResults { } )); } + public getAllResultsForCommunity(resultType:string, communityId: string, page: number, size: number, properties:EnvProperties, contextId = null) { + this.searchUtils.status = this.errorCodes.LOADING; + this.subscriptions.push(this._searchResearchResultsService.advancedSearchResults(resultType, "", page, size, "resultdateofacceptance,descending", properties, "&type=results&fq=communityid=" + communityId +(contextId?'&fq=categoryid=' + encodeURIComponent(contextId):'')).subscribe( + data => { + this.searchUtils.totalResults = data[0]; + this.results = data[1]; + + this.searchUtils.status = this.errorCodes.DONE; + if(this.searchUtils.totalResults == 0 ){ + this.searchUtils.status = this.errorCodes.NONE; + } + }, + err => { + this.handleError("Error getting "+this.getEntityName(resultType,true)+" for community: "+communityId, err); + this.searchUtils.status = this.errorMessages.getErrorCode(err.status); + } + )); + } public getResultsByKeyword(resultType:string, keyword:string, page: number, size: number, properties:EnvProperties, customFilter:SearchCustomFilter=null){ var parameters = ""; if(keyword.length > 0){ diff --git a/utils/properties/env-properties.ts b/utils/properties/env-properties.ts index 394c2f7f..d3f2472c 100644 --- a/utils/properties/env-properties.ts +++ b/utils/properties/env-properties.ts @@ -23,6 +23,7 @@ export interface EnvProperties { disableFrameLoad?:boolean statisticsAPIURL?: string; impactFactorsAPIURL?: string; + enermapsURL?: string; claimsAPIURL?: string; searchAPIURLLAst?: string; searchResourcesAPIURL?: string; diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index f5fddb06..a1f0c643 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -282,9 +282,10 @@
-
- tool preview +
+ Enermaps tool preview +
diff --git a/utils/result-preview/result-preview.component.ts b/utils/result-preview/result-preview.component.ts index 80939def..1267cdd5 100644 --- a/utils/result-preview/result-preview.component.ts +++ b/utils/result-preview/result-preview.component.ts @@ -27,7 +27,7 @@ export class ResultPreviewComponent implements OnInit, OnChanges { public beforeTitle: string[] = []; public dataProviderUrl = properties.searchLinkToDataProvider.split('?')[0]; @Input() showOrcid: boolean = true; - @Input() showImage: boolean = false; + @Input() showEnermaps: boolean = false; ngOnInit(): void { if(this.hasLink) { diff --git a/utils/result-preview/result-preview.ts b/utils/result-preview/result-preview.ts index 68295bf8..dd7b5baf 100644 --- a/utils/result-preview/result-preview.ts +++ b/utils/result-preview/result-preview.ts @@ -136,7 +136,9 @@ export class ResultPreview { relation: string; percentage: number; provenanceAction: string; - + + //enermaps id - image + enermapsId:string; public static searchResultConvert(result: SearchResult, type: string): ResultPreview { let resultPreview: ResultPreview = new ResultPreview(); resultPreview.id = result.id; @@ -189,6 +191,7 @@ export class ResultPreview { // resultPreview.identifiers.set("doi", result.DOIs); // } resultPreview.identifiers = result.identifiers; + resultPreview.enermapsId = result.enermapsId; return resultPreview; } diff --git a/utils/tabs/contents/search-tab.component.ts b/utils/tabs/contents/search-tab.component.ts index 695ce02f..efa89ef2 100644 --- a/utils/tabs/contents/search-tab.component.ts +++ b/utils/tabs/contents/search-tab.component.ts @@ -26,7 +26,7 @@ import {ErrorCodes} from "../../properties/errorCodes"; + [type]="resultType" [showImpactFactors]="showImpactFactors" [showEnermaps]="showEnermaps">
@@ -49,7 +49,7 @@ export class SearchTabComponent { @Input() properties: EnvProperties; @Input() showImpactFactors; @Input() customTitle; - @Input() showImage: boolean; + @Input() showEnermaps: boolean; public errorCodes: ErrorCodes = new ErrorCodes();