2018-04-11 12:40:29 +02:00
|
|
|
import {Component, Input} from '@angular/core';
|
2019-03-01 12:34:19 +01:00
|
|
|
import {ActivatedRoute} from '@angular/router';
|
|
|
|
|
2018-04-11 12:40:29 +02:00
|
|
|
import {PiwikHelper} from '../../utils/piwikHelper';
|
|
|
|
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
|
2018-01-26 16:00:07 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'openaire-search-organizations',
|
|
|
|
template: `
|
|
|
|
|
|
|
|
<search-organizations>
|
|
|
|
</search-organizations>
|
|
|
|
|
|
|
|
`
|
|
|
|
|
|
|
|
})
|
|
|
|
export class OpenaireSearchOrganizationsComponent {
|
2018-04-11 12:40:29 +02:00
|
|
|
piwikSiteId = null;
|
2019-03-01 12:34:19 +01:00
|
|
|
constructor (private route: ActivatedRoute ) {
|
2018-04-11 12:40:29 +02:00
|
|
|
}
|
2019-03-01 12:34:19 +01:00
|
|
|
ngOnInit() {
|
|
|
|
|
|
|
|
this.route.data
|
|
|
|
.subscribe((data: { envSpecific: any }) => {
|
|
|
|
|
|
|
|
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
|
|
|
|
if(communityId){
|
2019-08-02 16:56:03 +02:00
|
|
|
this.piwikSiteId = PiwikHelper.getSiteId(communityId,data.envSpecific.environment);
|
2019-03-01 12:34:19 +01:00
|
|
|
}else{
|
2019-08-02 16:56:03 +02:00
|
|
|
this.route.queryParams.subscribe(params => {
|
|
|
|
if(params['communityId'] && params['communityId']!=""){
|
|
|
|
communityId = params['communityId'];
|
|
|
|
this.piwikSiteId = PiwikHelper.getSiteId(communityId,data.envSpecific.environment);
|
2019-03-01 12:34:19 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2018-01-26 16:00:07 +01:00
|
|
|
|
2019-03-01 12:34:19 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
}
|
2018-01-26 16:00:07 +01:00
|
|
|
}
|