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: ` ` }) 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, ""); } }); } }); } }