90 lines
3.9 KiB
TypeScript
90 lines
3.9 KiB
TypeScript
import {Component, Input} from '@angular/core';
|
|
import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo';
|
|
import {EnvProperties} from "../../openaireLibrary/utils/properties/env-properties";
|
|
import {SearchResult} from "../../openaireLibrary/utils/entities/searchResult";
|
|
|
|
@Component({
|
|
selector: 'results-comp',
|
|
template: `
|
|
<div class="uk-h5 uk-text-bold uk-margin-top uk-margin-remove-bottom">Recent research results</div>
|
|
<div *ngIf="!results && total != 0">
|
|
<div *ngIf="showLoading" class="uk-animation-fade uk-width-1-1" role="alert"><span class="loading-gif uk-align-center"></span></div>
|
|
</div>
|
|
<div *ngIf="results != null && results.length > 0">
|
|
<div class="uk-text-right">
|
|
<div>
|
|
<a class="el-content uk-button uk-button-text" [queryParams]="{type:getresultTypeLink(resultType, true), qf:false}" routerLinkActive="router-link-active" [routerLink]="properties.searchLinkToResults">
|
|
View all
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div *ngIf="results != null && results.length > 0 && !showLoading">
|
|
<!--<div class="uk-margin-remove-vertical uk-grid-match uk-child-width-1-1 uk-child-width-1-1@m uk-child-width-1-1@l uk-child-width-1-1@xl uk-grid-small uk-grid uk-grid-stack" uk-grid="">
|
|
<li *ngFor="let item of results; let i = index">
|
|
<div class="uk-first-column">
|
|
<div class="el-item uk-panel">
|
|
<h6 class="el-title uk-margin uk-h6 uk-text-primary uk-margin-remove-adjacent uk-margin-remove-bottom">
|
|
<div *ngIf=" community != null && community.communityId != null">
|
|
<a [queryParams]="getParamId(resultType,item.id)" routerLinkActive="router-link-active" [routerLink]="'/search/'+getresultTypeLink(resultType, false)" >
|
|
{{item.title}} </a>
|
|
</div>
|
|
|
|
</h6>
|
|
<div *ngIf="item.accessRights" class="el-content"><span class=" uk-label label-{{item.accessRights}}">{{item.accessRights}}</span><br></div>
|
|
<div>
|
|
<span *ngIf="item.authors != null">
|
|
<span class="el-meta uk-margin uk-text-meta" *ngFor='let author of item.authors; let i = index'>
|
|
<span *ngIf="i < 10">
|
|
<span>{{author}}<span *ngIf="i < (item.authors.length-1)">;</span></span>
|
|
</span>
|
|
<span *ngIf="i == 10">...</span>
|
|
</span>
|
|
</span>
|
|
<span *ngIf="item.year !=''" class="el-meta uk-text-meta"> ({{item.year}}) </span>
|
|
</div>
|
|
<div class="text-justify descriptionText"> {{item.description}} </div>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</div>-->
|
|
<search-result [results]="results"
|
|
[type]="resultType" [properties] = properties class="communityRecentResults" [showImpactFactors]="(community.communityId == 'elixir-gr')" >
|
|
</search-result>
|
|
</div>
|
|
|
|
<div *ngIf="results != null && results.length == 0 || total == 0" class=" uk-alert uk-alert-primary"> No results available </div>
|
|
|
|
`
|
|
|
|
})
|
|
|
|
export class ResultsComponent {
|
|
|
|
@Input() public results : SearchResult[];
|
|
@Input() public resultType: string;
|
|
@Input() public params: any;
|
|
@Input() public community: CommunityInfo;
|
|
@Input() public total: any;
|
|
@Input() showLoading: boolean = true;
|
|
@Input() properties: EnvProperties;
|
|
|
|
getresultTypeLink(type:string, plural:boolean){
|
|
if((type == "publication" || type == "dataset") && plural){
|
|
return type + "s";
|
|
}
|
|
return type;
|
|
}
|
|
/* getParamId(type:string){
|
|
let param ="";
|
|
if(type == "publication"){
|
|
param="article";
|
|
}else if(type == "other"){
|
|
param="other";
|
|
}else{
|
|
param=type;
|
|
}
|
|
return param+"Id";
|
|
}*/
|
|
}
|