48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import {Component, OnInit} from '@angular/core';
|
|
import {MenuItem, RootMenuItem, SideMenuItem} from './openaireLibrary/sharedComponents/menu';
|
|
import {ActivatedRoute, NavigationStart, Router} from '@angular/router';
|
|
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
|
|
import {User} from './openaireLibrary/login/utils/helper.class';
|
|
import {UserManagementService} from './openaireLibrary/services/user-management.service';
|
|
import {properties} from "../environments/environment";
|
|
|
|
declare var UIkit: any;
|
|
|
|
@Component({
|
|
selector: 'app',
|
|
templateUrl: './app.component.html',
|
|
})
|
|
|
|
export class AppComponent implements OnInit {
|
|
title = 'Metadata Registry Service';
|
|
userMenuItems: MenuItem[] = [];
|
|
menuItems: RootMenuItem [] = [];
|
|
logInUrl = null;
|
|
logOutUrl = null;
|
|
properties: EnvProperties = properties;
|
|
showMenu: boolean = false;
|
|
user: User;
|
|
isHome: boolean = true;
|
|
|
|
constructor(private route: ActivatedRoute,
|
|
private router: Router,
|
|
private userManagementService: UserManagementService) {
|
|
this.router.events.subscribe(event => {
|
|
if(event instanceof NavigationStart) {
|
|
//this.isHome = event.url === '/';
|
|
}
|
|
})
|
|
}
|
|
|
|
ngOnInit() {
|
|
this.logInUrl = this.properties.loginUrl;
|
|
this.logOutUrl = this.properties.logoutUrl;
|
|
this.showMenu = true;
|
|
this.userManagementService.getUserInfo().subscribe(user => {
|
|
this.user = user;
|
|
this.menuItems = [];
|
|
this.userMenuItems = [];
|
|
});
|
|
}
|
|
}
|