2018-10-30 16:31:16 +01:00
|
|
|
/**
|
|
|
|
* Created by stefania on 3/21/16.
|
|
|
|
*/
|
|
|
|
|
2019-03-04 15:32:58 +01:00
|
|
|
import {Component, ElementRef, OnInit} from '@angular/core';
|
2018-10-30 16:31:16 +01:00
|
|
|
import {ActivatedRoute} from '@angular/router';
|
2019-03-04 15:32:58 +01:00
|
|
|
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
|
|
|
|
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
2019-04-24 13:44:46 +02:00
|
|
|
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
2018-10-30 16:31:16 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'dashboard',
|
|
|
|
templateUrl: 'dashboard.component.html',
|
|
|
|
})
|
2019-03-04 15:32:58 +01:00
|
|
|
export class DashboardComponent implements OnInit {
|
|
|
|
communityId: string = null;
|
2018-10-30 16:31:16 +01:00
|
|
|
communityType = null;
|
2019-03-04 15:32:58 +01:00
|
|
|
properties: EnvProperties;
|
2018-10-30 16:31:16 +01:00
|
|
|
|
2019-03-07 16:43:10 +01:00
|
|
|
constructor( private element: ElementRef,
|
|
|
|
private route: ActivatedRoute,
|
|
|
|
private _communityService: CommunityService) {}
|
2018-10-30 16:31:16 +01:00
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
|
|
|
|
this.properties = data.envSpecific;
|
|
|
|
this.route.queryParams.subscribe(data => {
|
2019-04-24 13:44:46 +02:00
|
|
|
HelperFunctions.scroll();
|
2019-03-04 15:32:58 +01:00
|
|
|
this.communityId = ((data['communityId']) ? data['communityId'] : data['community']);
|
|
|
|
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe (
|
2018-10-30 16:31:16 +01:00
|
|
|
community => {
|
|
|
|
this.communityType = community.type;
|
|
|
|
},
|
|
|
|
error => {
|
|
|
|
console.error('Server responded: ' + error);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|