1
|
/**
|
2
|
* Created by stefania on 3/21/16.
|
3
|
*/
|
4
|
|
5
|
import { Component } from '@angular/core';
|
6
|
import {ActivatedRoute} from '@angular/router';
|
7
|
import {CommunityService} from "./openaireLibrary/connect/community/community.service";
|
8
|
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
|
9
|
|
10
|
@Component({
|
11
|
selector: 'dashboard',
|
12
|
templateUrl: 'dashboard.component.html',
|
13
|
})
|
14
|
|
15
|
export class DashboardComponent {
|
16
|
communityId:string= null;
|
17
|
communityType = null;
|
18
|
properties:EnvProperties;
|
19
|
|
20
|
constructor( private route: ActivatedRoute, private _communityService:CommunityService) {}
|
21
|
|
22
|
ngOnInit() {
|
23
|
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
|
24
|
this.properties = data.envSpecific;
|
25
|
this.route.queryParams.subscribe(data => {
|
26
|
this.communityId = ((data['communityId'])?data['communityId']:data['community']);
|
27
|
this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe (
|
28
|
community => {
|
29
|
this.communityType = community.type;
|
30
|
},
|
31
|
error => {
|
32
|
console.error('Server responded: ' + error);
|
33
|
}
|
34
|
);
|
35
|
});
|
36
|
});
|
37
|
|
38
|
}
|
39
|
|
40
|
}
|