[Trunk | Library]:

1. src/app/openaireLibrary/orcid/orcid-work.component.ts: [Bug fix] On ngOnInit() method, call getPutCode, only if(!this.givenPutCode && this.isLoggedIn).
2. src/app/openaireLibrary/utils/properties/env-properties.ts: Added field "enermapsAPIURL?: string".
3. src/app/openaireLibrary/utils/tabs/contents/search-tab.component.ts: Added <ng-content></ng-content> on top of <search-result>.
4. src/app/openaireLibrary/landingPages/project/project.component.html: Moved alert inside <search-tab> (was before it).
5. src/app/openaireLibrary/landingPages/result/resultLanding.service.ts: Added methods "getEnermapsDetails()" and "parseEnermapsDetails()" (hide "shared_id").
6. src/app/openaireLibrary/landingPages/result/resultLanding.component.ts: Added fields and methods to get enermpas details (only when properties.enermapsAPIURL is set).
7. src/app/openaireLibrary/landingPages/result/resultLanding.component.html: 
	a. [Bug fix] Capitalize first letter of title in "References" tab (in small tabs).
	b. When clicking on tab, call (selectedActiveTab)="onSelectActiveTab($event)".
	c. If available, show uk-list with enermaps details (key-value pairs).


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@61021 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2021-05-19 09:36:09 +00:00
parent eee822bdeb
commit ac8381b004
7 changed files with 69 additions and 9 deletions

View File

@ -571,14 +571,14 @@
</ng-template>
<ng-template #dmps_tab>
<div class="uk-padding">
<div class="uk-alert uk-alert-primary uk-margin-top">
<span *ngIf="fetchDmps.searchUtils.totalResults == 0">No Data Management Plans (DMPs) available. </span>
<span>Link existing DMPs with this project or start a new DMP in <a href="https://argos.openaire.eu/splash/" target="_blank">Argos</a>.</span>
</div>
<search-tab [fetch]="fetchDmps" customTitle="Data Management Plans"
[params]="getParamsForSearchLink('publications', 'Data Management Plan')"
[searchLinkToAdvancedPage]="properties.searchLinkToAdvancedResults"
[properties]="properties">
<div class="uk-alert uk-alert-primary uk-margin-top">
<span *ngIf="fetchDmps.searchUtils.totalResults == 0">No Data Management Plans (DMPs) available. </span>
<span>Link existing DMPs with this project or start a new DMP in <a href="https://argos.openaire.eu/splash/" target="_blank">Argos</a>.</span>
</div>
</search-tab>
</div>
</ng-template>

View File

@ -431,11 +431,19 @@
Enermaps tool <span class="custom-external custom-icon space"></span>
</a></p>
</div>
</div>
<ul *ngIf="enermapsDetails?.length > 0" class="uk-list">
<ng-container *ngFor="let detail of enermapsDetails">
<li *ngIf="detail[0] && detail[1]">
<span class="uk-text-muted">{{detail[0]}}: </span>
<span>{{detail[1]}}</span>
</li>
</ng-container>
</ul>
</div>
</div>
</ng-template>
<my-tabs>
<my-tabs (selectedActiveTab)="onSelectActiveTab($event)">
<!-- *ngIf="hasPrimaryInfo || hasSecondaryInfo"-->
<!-- [class]="(activeTab === 'summary')?'uk-active':''"-->
<my-tab tabTitle="Summary"
@ -444,7 +452,7 @@
</my-tab>
<!-- [class]="(activeTab === 'references')?'uk-active':''"-->
<my-tab *ngIf="resultLandingInfo.references && resultLandingInfo.references.length > 0"
[tabTitle]="'references'" [tabId]="'references'"
[tabTitle]="'References'" [tabId]="'references'"
[tabNumber]="resultLandingInfo.references.length">
<ng-container *ngTemplateOutlet="references_tab;"></ng-container>
</my-tab>
@ -473,7 +481,7 @@
<ng-container *ngTemplateOutlet="enermaps_tab;"></ng-container>
</my-tab>
</my-tabs>
<my-small-tabs>
<my-small-tabs (selectedActiveTab)="onSelectActiveTab($event)">
<!-- *ngIf="hasPrimaryInfo || hasSecondaryInfo"-->
<!-- [class]="(activeTab === 'summary')?'uk-active':''"-->
<my-tab tabTitle="Summary"

View File

@ -91,6 +91,9 @@ export class ResultLandingComponent {
public routerHelper: RouterHelper = new RouterHelper();
public activeTab: string = null;
private reloadEnermapsDetails: boolean = true;
public enermapsDetails: any;
private doi: string;
subscriptions = [];
properties: EnvProperties = properties;
@ -318,6 +321,8 @@ export class ResultLandingComponent {
this.activeTab = 'related';
} else if (this.resultLandingInfo.bioentities && this.bioentitiesNum > 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);
}
))
}
}
}

View File

@ -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;
}
}

View File

@ -373,7 +373,7 @@ export class OrcidWorkComponent {
}
ngOnInit() {
if(!this.givenPutCode) {
if(!this.givenPutCode && this.isLoggedIn) {
this.getPutCode();
}
}

View File

@ -24,6 +24,7 @@ export interface EnvProperties {
statisticsAPIURL?: string;
impactFactorsAPIURL?: string;
enermapsURL?: string;
enermapsAPIURL?: string;
claimsAPIURL?: string;
searchAPIURLLAst?: string;
searchResourcesAPIURL?: string;

View File

@ -23,6 +23,8 @@ import {ErrorCodes} from "../../properties/errorCodes";
</a>
</div>
<ng-content></ng-content>
<search-result [properties]="properties"
[results]="fetch.results"
[status]="fetch.searchUtils.status"