[Library|Trunk]
Apply changes from Elixir branch r58296 add impact factors: parse DOI for search results make a call to bip finder API to get impact factors show impact factors in search results (for community elixir-gr & dev) git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58413 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
c6b5f6f517
commit
55c77ca0cb
|
@ -384,7 +384,8 @@
|
||||||
<search-result *ngIf="usedBy == 'search'" [results]="results"
|
<search-result *ngIf="usedBy == 'search'" [results]="results"
|
||||||
[status]=searchUtils.status
|
[status]=searchUtils.status
|
||||||
[type]="entityType"
|
[type]="entityType"
|
||||||
[showLoading]="true" [properties]=properties>
|
[showLoading]="true" [properties]=properties [showImpactFactors]="(customFilter &&
|
||||||
|
customFilter.queryFieldName == 'communityId' && customFilter.valueId == 'elixir-gr')" >
|
||||||
</search-result>
|
</search-result>
|
||||||
<deposit-result *ngIf="usedBy == 'deposit'"
|
<deposit-result *ngIf="usedBy == 'deposit'"
|
||||||
[results]="results"
|
[results]="results"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<ul [class]="'uk-list uk-margin uk-margin-top '+custom_class">
|
<ul [class]="'uk-list uk-margin uk-margin-top '+custom_class">
|
||||||
<errorMessages [status]="[status]" [type]="'results'"></errorMessages>
|
<errorMessages [status]="[status]" [type]="'results'"></errorMessages>
|
||||||
<li *ngFor="let result of results" class="uk-animation-fade">
|
<li *ngFor="let result of previewResults" class="uk-animation-fade">
|
||||||
<div class="uk-card uk-card-default uk-padding uk-card-hover">
|
<div class="uk-card uk-card-default uk-padding uk-card-hover">
|
||||||
<result-preview [properties]="properties" [showOrganizations]="showOrganizations"
|
<result-preview [properties]="properties" [showOrganizations]="showOrganizations"
|
||||||
[showSubjects]="showSubjects" [result]="getResultPreview(result)">
|
[showSubjects]="showSubjects" [result]="result">
|
||||||
</result-preview>
|
</result-preview>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
import {Component, Input, OnInit} from '@angular/core';
|
import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core';
|
||||||
import {SearchResult} from '../../utils/entities/searchResult';
|
import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
import {ErrorCodes} from '../../utils/properties/errorCodes';
|
|
||||||
import {RouterHelper} from '../../utils/routerHelper.class';
|
|
||||||
import {EnvProperties} from '../../utils/properties/env-properties';
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
||||||
import {Keyword} from "./highlight/highlight.component";
|
|
||||||
import {ResultPreview} from "../../utils/result-preview/result-preview";
|
import {ResultPreview} from "../../utils/result-preview/result-preview";
|
||||||
|
import {HttpClient} from "@angular/common/http";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-result',
|
selector: 'search-result',
|
||||||
templateUrl: 'searchResult.component.html'
|
templateUrl: 'searchResult.component.html'
|
||||||
})
|
})
|
||||||
export class SearchResultComponent implements OnInit {
|
export class SearchResultComponent implements OnInit, OnChanges {
|
||||||
@Input() results: SearchResult[];
|
@Input() results: SearchResult[];
|
||||||
|
previewResults:ResultPreview[];
|
||||||
@Input() status: number;
|
@Input() status: number;
|
||||||
@Input() type: string;
|
@Input() type: string;
|
||||||
@Input() showLoading: boolean = false;
|
@Input() showLoading: boolean = false;
|
||||||
|
@ -19,12 +18,50 @@ export class SearchResultComponent implements OnInit {
|
||||||
@Input() showOrganizations: boolean = true;
|
@Input() showOrganizations: boolean = true;
|
||||||
@Input() custom_class: string = "search-results";
|
@Input() custom_class: string = "search-results";
|
||||||
@Input() properties: EnvProperties;
|
@Input() properties: EnvProperties;
|
||||||
|
@Input() showImpactFactors: boolean = false;
|
||||||
|
|
||||||
constructor() {
|
constructor( private http: HttpClient/*ATHENA CODE*/) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {}
|
ngOnInit() {}
|
||||||
|
|
||||||
|
initialize(){
|
||||||
|
this.previewResults = [];
|
||||||
|
for(let result of this.results){
|
||||||
|
this.previewResults.push(this.getResultPreview(result));
|
||||||
|
}
|
||||||
|
/////////////////////// ATHENA CODE ///////////////////////
|
||||||
|
// console.log(data[1]);
|
||||||
|
let dois = encodeURIComponent(this.results.map((result) => result.DOI).join(","));
|
||||||
|
// console.log(dois);
|
||||||
|
if(dois.length > 0 && this.showImpactFactors && this.properties.environment == "development") {
|
||||||
|
let url = 'http://bip.imis.athena-innovation.gr:4000/paper/scores/batch/' + dois;
|
||||||
|
this.http.get(url).subscribe((data_received) => {
|
||||||
|
for (let i = 0; i < this.previewResults.length; i++) {
|
||||||
|
this.previewResults[i].pop_inf = new Array<string>();
|
||||||
|
// console.log(data[1][i].DOI,'inf: ',data_received[i].pop_class,'and pop: ',data_received[i].inf_class);
|
||||||
|
// researchResults[1].pop_inf[i].push(data[i].inf_class,data[i].pop_class);
|
||||||
|
console.log(this.previewResults[i].DOI)
|
||||||
|
if (this.previewResults[i].DOI != '' && this.previewResults[i].DOI != null) {
|
||||||
|
this.previewResults[i].pop_inf.push(data_received[i].pop_class, data_received[i].inf_class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(this.previewResults)
|
||||||
|
|
||||||
|
}, error1 => {
|
||||||
|
console.error("Failed to get Impact factors for elixir-gr")
|
||||||
|
});
|
||||||
|
// console.log(researchResults[1]);
|
||||||
|
|
||||||
|
}
|
||||||
|
/////////////////////// ATHENA CODE ///////////////////////
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
|
if (changes.results) {
|
||||||
|
this.initialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
public getResultPreview(result: SearchResult): ResultPreview {
|
public getResultPreview(result: SearchResult): ResultPreview {
|
||||||
return ResultPreview.searchResultConvert(result, (result.entityType)?result.entityType:this.type);
|
return ResultPreview.searchResultConvert(result, (result.entityType)?result.entityType:this.type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,7 +168,16 @@ export class SearchResearchResultsService {
|
||||||
instance = Array.isArray(resData['children']['instance']) ? resData['children']['instance'][i] : resData['children']['instance'];
|
instance = Array.isArray(resData['children']['instance']) ? resData['children']['instance'][i] : resData['children']['instance'];
|
||||||
this.parsingFunctions.parseTypes(result.types, types, instance);
|
this.parsingFunctions.parseTypes(result.types, types, instance);
|
||||||
}
|
}
|
||||||
|
/////////////////////////// Athena Code ///////////////////////////
|
||||||
|
for(let i=0; i<resData['pid'].length; i++){
|
||||||
|
if(resData['pid'][i].classid == 'doi'){
|
||||||
|
if(resData['pid'][i].content != '' && resData['pid'][i].content != null){
|
||||||
|
result.DOI = resData['pid'][i].content.replace("https://doi.org/","");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/////////////////////////// Athena Code ///////////////////////////
|
||||||
if(resData['programmingLanguage'] && resData['programmingLanguage'] != null) {
|
if(resData['programmingLanguage'] && resData['programmingLanguage'] != null) {
|
||||||
result.programmingLanguages = new Array<string>();
|
result.programmingLanguages = new Array<string>();
|
||||||
|
|
||||||
|
|
|
@ -271,3 +271,8 @@
|
||||||
{{result.description}}
|
{{result.description}}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div *ngIf="result.pop_inf && result.DOI">
|
||||||
|
<span title = "Popularity" id = "popularity-{{result.pop_inf[0]}}" class="fa fa-fire"></span> <!-- ATHENA CODE -->
|
||||||
|
<span title = "Influence" id = "influence-{{result.pop_inf[1]}}" class="fa fa-university"></span> <!-- ATHENA CODE -->
|
||||||
|
<span><a title ="Link to Bip!Finder" class="fas fa-external-link-alt" target="_blank" href = "https://bip.imis.athena-innovation.gr/site/details?id={{result.DOI}}"></a></span>
|
||||||
|
</div>
|
||||||
|
|
|
@ -74,7 +74,10 @@ export class ResultPreview {
|
||||||
accessMode: string;
|
accessMode: string;
|
||||||
sc39: string;
|
sc39: string;
|
||||||
countries: string[];
|
countries: string[];
|
||||||
|
|
||||||
|
//Impact factor
|
||||||
|
DOI:string;
|
||||||
|
pop_inf
|
||||||
//publications & datasets & orp & software & organizations:
|
//publications & datasets & orp & software & organizations:
|
||||||
projects: Project[];
|
projects: Project[];
|
||||||
|
|
||||||
|
@ -171,6 +174,8 @@ export class ResultPreview {
|
||||||
resultPreview.compatibilityUNKNOWN = result.compatibilityUNKNOWN;
|
resultPreview.compatibilityUNKNOWN = result.compatibilityUNKNOWN;
|
||||||
resultPreview.subjects = result.subjects;
|
resultPreview.subjects = result.subjects;
|
||||||
resultPreview.resultType = type;
|
resultPreview.resultType = type;
|
||||||
|
//impact factor;
|
||||||
|
resultPreview.DOI=result.DOI;
|
||||||
return resultPreview;
|
return resultPreview;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue