/** * Created by stefania on 3/21/16. */ import {Component, ElementRef, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {CommunityService} from '../../openaireLibrary/connect/community/community.service'; import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties'; import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class"; import {Title} from '@angular/platform-browser'; import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; @Component({ selector: 'dashboard', templateUrl: 'dashboard.component.html', }) export class DashboardComponent implements OnInit { communityId: string = null; communityType = null; properties: EnvProperties; constructor( private element: ElementRef, private route: ActivatedRoute, private title: Title, private _communityService: CommunityService) {} ngOnInit() { this.route.data.subscribe((data: { envSpecific: EnvProperties }) => { this.title.setTitle('Administration Dashboard | Overview'); this.properties = data.envSpecific; this.route.queryParams.subscribe(data => { HelperFunctions.scroll(); this.communityId = ((data['communityId']) ? data['communityId'] : data['community']); ConnectHelper.setPortalTypeFromPid(this.communityId); this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe ( community => { this.communityType = community.type; }, error => { console.error('Server responded: ' + error); } ); }); }); } }