Project

General

Profile

1
import {Component, Input} from '@angular/core';
2
import {ActivatedRoute} from '@angular/router';
3

    
4
import {PiwikHelper} from '../../utils/piwikHelper';
5
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
6

    
7
@Component({
8
    selector: 'openaire-search-organizations',
9
    template: `
10

    
11
    <search-organizations>
12
    </search-organizations>
13

    
14
    `
15

    
16
})
17
export class OpenaireSearchOrganizationsComponent {
18
  piwikSiteId = null;
19
  constructor (private  route: ActivatedRoute  ) {
20
  }
21
  ngOnInit() {
22

    
23
    this.route.data
24
        .subscribe((data: { envSpecific: any }) => {
25

    
26
                var communityId =  ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
27
                if(communityId){
28
                  this.piwikSiteId = PiwikHelper.getSiteId(communityId,data.envSpecific.environment);
29
                }else{
30
                  this.route.queryParams.subscribe(params => {
31
                    if(params['communityId'] && params['communityId']!=""){
32
                      communityId = params['communityId'];
33
                      this.piwikSiteId = PiwikHelper.getSiteId(communityId,data.envSpecific.environment);
34
                    }
35
                  });
36
                }
37

    
38
    });
39

    
40
  }
41
}
(8-8/21)