New dashboard look & feel
[src/xds/xds-agent.git] / webapp / src / app / @theme / components / header / header.component.ts
1 import { Component, Input, OnInit } from '@angular/core';
2
3 import { NbMenuService, NbSidebarService } from '@nebular/theme';
4 // XDS_MODS
5 import { UserService } from '../../../@core-xds/services/users.service';
6 import { AnalyticsService } from '../../../@core/utils/analytics.service';
7
8 @Component({
9   selector: 'ngx-header',
10   styleUrls: ['./header.component.scss'],
11   templateUrl: './header.component.html',
12 })
13 export class HeaderComponent implements OnInit {
14
15
16   @Input() position = 'normal';
17
18   user: any;
19
20   userMenu = [{ title: 'Profile' }, { title: 'Log out' }];
21
22   constructor(private sidebarService: NbSidebarService,
23               private menuService: NbMenuService,
24               private userService: UserService,
25               private analyticsService: AnalyticsService) {
26   }
27
28   ngOnInit() {
29     // XDS_MODS
30     this.userService.getUsers()
31       .subscribe((users: any) => this.user = users.anonymous);
32   }
33
34   toggleSidebar(): boolean {
35     this.sidebarService.toggle(true, 'menu-sidebar');
36     return false;
37   }
38
39   toggleSettings(): boolean {
40     this.sidebarService.toggle(false, 'settings-sidebar');
41     return false;
42   }
43
44   goToHome() {
45     this.menuService.navigateHome();
46   }
47
48   startSearch() {
49     this.analyticsService.trackEvent('startSearch');
50   }
51 }