1
|
import {Component, Input} from '@angular/core';
|
2
|
import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo';
|
3
|
import {EnvProperties} from "../../openaireLibrary/utils/properties/env-properties";
|
4
|
import {SearchResult} from "../../openaireLibrary/utils/entities/searchResult";
|
5
|
|
6
|
@Component({
|
7
|
selector: 'results-comp',
|
8
|
template: `
|
9
|
<div class="uk-h5 uk-text-bold uk-margin-top uk-margin-remove-bottom">Recent research results</div>
|
10
|
<div *ngIf="!results && total != 0">
|
11
|
<div *ngIf="showLoading" class="uk-animation-fade uk-width-1-1" role="alert"><span class="loading-gif uk-align-center"></span></div>
|
12
|
</div>
|
13
|
<div *ngIf="results != null && results.length > 0">
|
14
|
<div class="uk-text-right">
|
15
|
<div>
|
16
|
<a class="el-content uk-button uk-button-text" [queryParams]=params routerLinkActive="router-link-active" [routerLink]="'/search/find/'+getresultTypeLink(resultType, true)">
|
17
|
View all
|
18
|
</a>
|
19
|
</div>
|
20
|
</div>
|
21
|
</div>
|
22
|
<div *ngIf="results != null && results.length > 0 && !showLoading">
|
23
|
<!--<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="">
|
24
|
<li *ngFor="let item of results; let i = index">
|
25
|
<div class="uk-first-column">
|
26
|
<div class="el-item uk-panel">
|
27
|
<h6 class="el-title uk-margin uk-h6 uk-text-primary uk-margin-remove-adjacent uk-margin-remove-bottom">
|
28
|
<div *ngIf=" community != null && community.communityId != null">
|
29
|
<a [queryParams]="getParamId(resultType,item.id)" routerLinkActive="router-link-active" [routerLink]="'/search/'+getresultTypeLink(resultType, false)" >
|
30
|
{{item.title}} </a>
|
31
|
</div>
|
32
|
|
33
|
</h6>
|
34
|
<div *ngIf="item.accessRights" class="el-content"><span class=" uk-label label-{{item.accessRights}}">{{item.accessRights}}</span><br></div>
|
35
|
<div>
|
36
|
<span *ngIf="item.authors != null">
|
37
|
<span class="el-meta uk-margin uk-text-meta" *ngFor='let author of item.authors; let i = index'>
|
38
|
<span *ngIf="i < 10">
|
39
|
<span>{{author}}<span *ngIf="i < (item.authors.length-1)">;</span></span>
|
40
|
</span>
|
41
|
<span *ngIf="i == 10">...</span>
|
42
|
</span>
|
43
|
</span>
|
44
|
<span *ngIf="item.year !=''" class="el-meta uk-text-meta"> ({{item.year}}) </span>
|
45
|
</div>
|
46
|
<div class="text-justify descriptionText"> {{item.description}} </div>
|
47
|
</div>
|
48
|
</div>
|
49
|
</li>
|
50
|
</div>-->
|
51
|
<search-result [results]="results"
|
52
|
[type]="resultType" [properties] = properties class="communityRecentResults">
|
53
|
</search-result>
|
54
|
</div>
|
55
|
|
56
|
<div *ngIf="results != null && results.length == 0 || total == 0" class=" uk-alert uk-alert-primary"> No results available </div>
|
57
|
|
58
|
`
|
59
|
|
60
|
})
|
61
|
|
62
|
export class ResultsComponent {
|
63
|
|
64
|
@Input() public results : SearchResult[];
|
65
|
@Input() public resultType: string;
|
66
|
@Input() public params: any;
|
67
|
@Input() public community: CommunityInfo;
|
68
|
@Input() public total: any;
|
69
|
@Input() showLoading: boolean = true;
|
70
|
@Input() properties: EnvProperties;
|
71
|
|
72
|
getresultTypeLink(type:string, plural:boolean){
|
73
|
if((type == "publication" || type == "dataset") && plural){
|
74
|
return type + "s";
|
75
|
}
|
76
|
return type;
|
77
|
}
|
78
|
/* getParamId(type:string){
|
79
|
let param ="";
|
80
|
if(type == "publication"){
|
81
|
param="article";
|
82
|
}else if(type == "other"){
|
83
|
param="other";
|
84
|
}else{
|
85
|
param=type;
|
86
|
}
|
87
|
return param+"Id";
|
88
|
}*/
|
89
|
}
|