/** * 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'; @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']); this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe ( community => { this.communityType = community.type; }, error => { console.error('Server responded: ' + error); } ); }); }); } }