1
|
import {Component, OnInit} from '@angular/core';
|
2
|
import {MenuItem, RootMenuItem, SideMenuItem} from './openaireLibrary/sharedComponents/menu';
|
3
|
import {ActivatedRoute, NavigationStart, Router} from '@angular/router';
|
4
|
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
|
5
|
import {User} from './openaireLibrary/login/utils/helper.class';
|
6
|
import {UserManagementService} from './openaireLibrary/services/user-management.service';
|
7
|
import {properties} from "../environments/environment";
|
8
|
|
9
|
declare var UIkit: any;
|
10
|
|
11
|
@Component({
|
12
|
selector: 'app',
|
13
|
templateUrl: './app.component.html',
|
14
|
})
|
15
|
|
16
|
export class AppComponent implements OnInit {
|
17
|
title = 'Metadata Registry Service';
|
18
|
userMenuItems: MenuItem[] = [];
|
19
|
menuItems: RootMenuItem [] = [];
|
20
|
logInUrl = null;
|
21
|
logOutUrl = null;
|
22
|
properties: EnvProperties = properties;
|
23
|
showMenu: boolean = false;
|
24
|
user: User;
|
25
|
isHome: boolean = true;
|
26
|
|
27
|
constructor(private route: ActivatedRoute,
|
28
|
private router: Router,
|
29
|
private userManagementService: UserManagementService) {
|
30
|
this.router.events.subscribe(event => {
|
31
|
if(event instanceof NavigationStart) {
|
32
|
//this.isHome = event.url === '/';
|
33
|
}
|
34
|
})
|
35
|
}
|
36
|
|
37
|
ngOnInit() {
|
38
|
this.logInUrl = this.properties.loginUrl;
|
39
|
this.logOutUrl = this.properties.logoutUrl;
|
40
|
this.showMenu = true;
|
41
|
this.userManagementService.getUserInfo().subscribe(user => {
|
42
|
this.user = user;
|
43
|
this.menuItems = [];
|
44
|
this.userMenuItems = [];
|
45
|
});
|
46
|
}
|
47
|
}
|