Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { ProfileService } from '../profiles/profile.service';
import { Principal, LoginModalService, LoginService } from '../../shared';
import { VERSION } from '../../app.constants';
@Component({
selector: 'jhi-navbar',
templateUrl: './navbar.component.html',
styleUrls: [
'navbar.css'
]
})
export class NavbarComponent implements OnInit {
inProduction: boolean;
isNavbarCollapsed: boolean;
languages: any[];
swaggerEnabled: boolean;
modalRef: NgbModalRef;
version: string;
token: boolean;
constructor(
private loginService: LoginService,
private principal: Principal,
private loginModalService: LoginModalService,
private profileService: ProfileService,
private router: Router,
) {
this.version = VERSION ? 'v' + VERSION : '';
this.isNavbarCollapsed = true;
}
ngOnInit() {
// this.profileService.getProfileInfo().then((profileInfo) => {
// this.inProduction = profileInfo.inProduction;
// this.swaggerEnabled = profileInfo.swaggerEnabled;
// });
}
collapseNavbar() {
this.isNavbarCollapsed = true;
}
isAuthenticated() {
return this.principal.isAuthenticated();
}
login() {
this.modalRef = this.loginModalService.open();
}
logout() {
this.collapseNavbar();
this.loginService.logout();
}
toggleNavbar() {
this.isNavbarCollapsed = !this.isNavbarCollapsed;
}
getImageUrl() {
return this.isAuthenticated() ? this.principal.getImageUrl() : null;
}
}