2019-07-23 14:23:41 +02:00
|
|
|
import {Component} from '@angular/core';
|
|
|
|
import {ActivatedRoute} from '@angular/router';
|
2018-07-09 14:13:38 +02:00
|
|
|
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
|
2019-08-02 16:56:03 +02:00
|
|
|
import {PiwikHelper} from "../../utils/piwikHelper";
|
2018-01-26 16:00:07 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'openaire-linking-generic',
|
2019-08-02 16:56:03 +02:00
|
|
|
template: `<linking-generic [communityId]=communityId [piwikSiteId]="piwikSiteId" title="Linking"></linking-generic>`
|
2018-01-26 16:00:07 +01:00
|
|
|
|
|
|
|
})
|
|
|
|
export class OpenaireLinkingComponent {
|
2018-07-09 14:13:38 +02:00
|
|
|
communityId:string;
|
2019-08-02 16:56:03 +02:00
|
|
|
public piwikSiteId = null;
|
|
|
|
|
2019-07-23 14:23:41 +02:00
|
|
|
constructor (private route: ActivatedRoute) {
|
2019-03-01 12:34:19 +01:00
|
|
|
this.route.data
|
|
|
|
.subscribe((data: { envSpecific: any }) => {
|
|
|
|
this.route.queryParams.subscribe(
|
|
|
|
communityId => {
|
2019-07-03 12:16:58 +02:00
|
|
|
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
|
|
|
|
if(!this.communityId) {
|
|
|
|
this.communityId = communityId['communityId'];
|
2019-03-01 12:34:19 +01:00
|
|
|
}
|
2019-08-02 16:56:03 +02:00
|
|
|
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,data.envSpecific.environment);
|
2019-03-01 12:34:19 +01:00
|
|
|
});
|
|
|
|
});
|
2018-07-09 14:13:38 +02:00
|
|
|
|
|
|
|
}
|
2018-01-26 16:00:07 +01:00
|
|
|
}
|