39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import {Component, ViewChild, ElementRef} from '@angular/core';
|
|
import {ActivatedRoute} from '@angular/router';
|
|
import {PiwikHelper} from '../../utils/piwikHelper';
|
|
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
|
|
import {Subscriber} from "rxjs";
|
|
import {properties} from "../../../environments/environment";
|
|
@Component({
|
|
selector: 'openaire-htmlProjectReport',
|
|
template: `<htmlProjectReport [piwikSiteId]=piwikSiteId [communityId]="communityId"></htmlProjectReport>`,
|
|
})
|
|
export class OpenaireHtmlProjectReportComponent{
|
|
piwikSiteId = null;
|
|
communityId = null;
|
|
private sub;
|
|
|
|
constructor(private route: ActivatedRoute) {
|
|
this.sub = this.route.queryParams.subscribe(params => {
|
|
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
|
|
if (!this.communityId) {
|
|
this.communityId = params['communityId'];
|
|
}
|
|
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
|
|
});
|
|
|
|
}
|
|
|
|
ngOnInit() {
|
|
|
|
}
|
|
ngOnDestroy() {
|
|
if (this.sub instanceof Subscriber) {
|
|
this.sub.unsubscribe();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|