connect/src/app/landingPages/htmlProjectReport/htmlProjectReport.component.ts

32 lines
1.0 KiB
TypeScript
Raw Normal View History

import {Component, ViewChild, ElementRef} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@Component({
selector: 'openaire-htmlProjectReport',
template: `<htmlProjectReport [piwikSiteId]=piwikSiteId [communityId]="communityId"></htmlProjectReport>`,
})
export class OpenaireHtmlProjectReportComponent{
piwikSiteId = null;
communityId = null;
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, data.envSpecific.environment);
});
});
}
ngOnInit() {
}
}