51 lines
2.0 KiB
TypeScript
51 lines
2.0 KiB
TypeScript
import {Component, Input, ViewChild} from '@angular/core';
|
|
import {ActivatedRoute} from '@angular/router';
|
|
import {PiwikHelper} from '../../utils/piwikHelper';
|
|
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
|
|
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
|
|
|
@Component({
|
|
selector: 'openaire-search-datasets',
|
|
template: `
|
|
<search-research-results openaireLink="https://beta.explore.openaire.eu/search/find/datasets"
|
|
[customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false"
|
|
resultType="dataset">
|
|
</search-research-results>
|
|
`
|
|
})
|
|
|
|
export class OpenaireSearchDatasetsComponent {
|
|
advancedSearchParameters:any;
|
|
connectCommunityId:string;
|
|
piwikSiteId = null;
|
|
customFilter: SearchCustomFilter = null;
|
|
|
|
constructor ( private route: ActivatedRoute) {
|
|
}
|
|
ngOnInit() {
|
|
|
|
this.route.data
|
|
.subscribe((data: { envSpecific: any }) => {
|
|
|
|
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
|
|
if(communityId){
|
|
this.connectCommunityId = communityId;
|
|
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId,data.envSpecific.environment);
|
|
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
|
|
|
|
}else{
|
|
this.route.queryParams.subscribe(params => {
|
|
if(params['communityId'] && params['communityId']!=""){
|
|
this.connectCommunityId = params['communityId'];
|
|
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId,data.envSpecific.environment);
|
|
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
}
|