1 |
50169
|
argiro.kok
|
import {Component, Input} from '@angular/core';
|
2 |
|
|
import {SearchResult} from '../../utils/entities/searchResult';
|
3 |
50761
|
argiro.kok
|
import {ErrorCodes} from '../../utils/properties/errorCodes';
|
4 |
50169
|
argiro.kok
|
import {RouterHelper} from '../../utils/routerHelper.class';
|
5 |
50586
|
argiro.kok
|
import{EnvProperties} from '../../utils/properties/env-properties';
|
6 |
50169
|
argiro.kok
|
@Component({
|
7 |
|
|
selector: 'search-result',
|
8 |
|
|
templateUrl:'searchResult.component.html'
|
9 |
|
|
})
|
10 |
|
|
|
11 |
|
|
export class SearchResultComponent {
|
12 |
|
|
@Input() results: SearchResult[];
|
13 |
|
|
@Input() status: number;
|
14 |
|
|
@Input() type: string;
|
15 |
|
|
@Input() showLoading: boolean = false;
|
16 |
|
|
@Input() showSubjects: boolean = false;
|
17 |
|
|
@Input() showOrganizations: boolean = true;
|
18 |
|
|
@Input() custom_class: string = "search-results";
|
19 |
50586
|
argiro.kok
|
@Input() properties:EnvProperties;
|
20 |
50169
|
argiro.kok
|
|
21 |
50586
|
argiro.kok
|
|
22 |
50169
|
argiro.kok
|
public urlParam: string;
|
23 |
|
|
public linkToAdvancedSearchPage: string;
|
24 |
|
|
public errorCodes:ErrorCodes = new ErrorCodes();
|
25 |
|
|
public routerHelper:RouterHelper = new RouterHelper();
|
26 |
|
|
public errorMessage: string = "No results found";
|
27 |
|
|
constructor () {}
|
28 |
|
|
|
29 |
|
|
ngOnInit() {
|
30 |
50586
|
argiro.kok
|
|
31 |
|
|
if(this.type == "publication") {
|
32 |
|
|
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedPublications;
|
33 |
|
|
this.urlParam = "articleId";
|
34 |
|
|
} else if(this.type == "dataset") {
|
35 |
|
|
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedDatasets;
|
36 |
|
|
this.urlParam = "datasetId";
|
37 |
|
|
} else if(this.type == "software") {
|
38 |
|
|
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedSoftware;
|
39 |
|
|
this.urlParam = "softwareId";
|
40 |
52816
|
konstantin
|
} else if(this.type == "other") {
|
41 |
|
|
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedOrps;
|
42 |
|
|
this.urlParam = "orpId";
|
43 |
50586
|
argiro.kok
|
} else if(this.type == "project") {
|
44 |
|
|
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedProjects;
|
45 |
|
|
this.urlParam = "projectId";
|
46 |
|
|
} else if(this.type == "organization") {
|
47 |
|
|
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedOrganizations;
|
48 |
|
|
this.urlParam = "organizationId";
|
49 |
|
|
} else if(this.type == "dataprovider") {
|
50 |
|
|
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedDataProviders;
|
51 |
|
|
this.urlParam = "datasourceId";
|
52 |
|
|
}
|
53 |
|
|
|
54 |
|
|
|
55 |
50169
|
argiro.kok
|
}
|
56 |
|
|
|
57 |
|
|
public quote(params: string):string {
|
58 |
|
|
return '"'+params+'"';
|
59 |
|
|
}
|
60 |
|
|
}
|