1
|
import {Component, Input, ViewChild} from '@angular/core';
|
2
|
import {ActivatedRoute} from '@angular/router';
|
3
|
import {PiwikHelper} from '../../utils/piwikHelper';
|
4
|
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
|
5
|
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
6
|
|
7
|
@Component({
|
8
|
selector: 'openaire-search-datasets',
|
9
|
template: `
|
10
|
<search-research-results openaireLink="https://beta.explore.openaire.eu/search/find/datasets"
|
11
|
[customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false"
|
12
|
resultType="dataset">
|
13
|
</search-research-results>
|
14
|
`
|
15
|
})
|
16
|
|
17
|
export class OpenaireSearchDatasetsComponent {
|
18
|
advancedSearchParameters:any;
|
19
|
connectCommunityId:string;
|
20
|
piwikSiteId = null;
|
21
|
customFilter: SearchCustomFilter = null;
|
22
|
|
23
|
constructor ( private route: ActivatedRoute) {
|
24
|
}
|
25
|
ngOnInit() {
|
26
|
|
27
|
this.route.data
|
28
|
.subscribe((data: { envSpecific: any }) => {
|
29
|
|
30
|
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
|
31
|
if(communityId){
|
32
|
this.connectCommunityId = communityId;
|
33
|
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId,data.envSpecific.environment);
|
34
|
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
|
35
|
|
36
|
}else{
|
37
|
this.route.queryParams.subscribe(params => {
|
38
|
if(params['communityId'] && params['communityId']!=""){
|
39
|
this.connectCommunityId = params['communityId'];
|
40
|
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId,data.envSpecific.environment);
|
41
|
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
|
42
|
|
43
|
}
|
44
|
});
|
45
|
}
|
46
|
|
47
|
});
|
48
|
|
49
|
}
|
50
|
}
|