mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-03-08 06:32:35 +01:00
prepare for sit. (docker)
This commit is contained in:
parent
311885894f
commit
8a39954811
39 changed files with 4819 additions and 1152 deletions
|
|
@ -5,23 +5,19 @@
|
|||
</a>
|
||||
<a class="logo" href="#" (click)="navigateHome()">symfonia</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="header-container">
|
||||
<nb-select [selected]="currentTheme" (selectedChange)="changeTheme($event)" status="primary">
|
||||
<nb-option *ngFor="let theme of themes" [value]="theme.value"> {{ theme.name }}</nb-option>
|
||||
</nb-select>
|
||||
</div>
|
||||
|
||||
<div class="header-container">
|
||||
<nb-actions size="small">
|
||||
<nb-action class="control-item">
|
||||
<nb-search type="rotate-layout"></nb-search>
|
||||
</nb-action>
|
||||
<nb-action class="control-item" icon="bell-outline"></nb-action>
|
||||
<nb-action class="user-action" *nbIsGranted="['view', 'user']" >
|
||||
<nb-user [nbContextMenu]="userMenu"
|
||||
[onlyPicture]="userPictureOnly"
|
||||
[name]="user?.name"
|
||||
[picture]="user?.picture">
|
||||
<nb-action class="user-action" *nbIsGranted="['view', 'user']">
|
||||
<nb-user [nbContextMenu]="userMenu" [onlyPicture]="userPictureOnly" [name]="username">
|
||||
</nb-user>
|
||||
</nb-action>
|
||||
</nb-actions>
|
||||
</div>
|
||||
<button (click)="logout()" nbButton>
|
||||
Log Out
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -5,6 +5,9 @@ import { UserData } from '../../../@core/data/users';
|
|||
import { LayoutService } from '../../../@core/utils';
|
||||
import { map, takeUntil } from 'rxjs/operators';
|
||||
import { Subject } from 'rxjs';
|
||||
import { User } from '../../../@core/data/user';
|
||||
import { Router } from '@angular/router';
|
||||
import { LoginService } from '../../../auth/login.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ngx-header',
|
||||
|
|
@ -15,7 +18,9 @@ export class HeaderComponent implements OnInit, OnDestroy {
|
|||
|
||||
private destroy$: Subject<void> = new Subject<void>();
|
||||
userPictureOnly: boolean = false;
|
||||
user: any;
|
||||
username: any;
|
||||
roles: any;
|
||||
userpicture: any;
|
||||
|
||||
themes = [
|
||||
{
|
||||
|
|
@ -38,22 +43,30 @@ export class HeaderComponent implements OnInit, OnDestroy {
|
|||
|
||||
currentTheme = 'default';
|
||||
|
||||
userMenu = [ { title: 'Profile' }, { title: 'Log out' } ];
|
||||
userMenu = [{ title: 'User Role(s)' }];
|
||||
|
||||
constructor(private sidebarService: NbSidebarService,
|
||||
private menuService: NbMenuService,
|
||||
private themeService: NbThemeService,
|
||||
private userService: UserData,
|
||||
private layoutService: LayoutService,
|
||||
private breakpointService: NbMediaBreakpointsService) {
|
||||
private router: Router,
|
||||
private menuService: NbMenuService,
|
||||
private themeService: NbThemeService,
|
||||
private layoutService: LayoutService,
|
||||
private loginService: LoginService,
|
||||
private breakpointService: NbMediaBreakpointsService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.currentTheme = this.themeService.currentTheme;
|
||||
|
||||
this.userService.getUsers()
|
||||
.pipe(takeUntil(this.destroy$))
|
||||
.subscribe((users: any) => this.user = users.nick);
|
||||
this.username = localStorage.getItem('username');
|
||||
this.roles = localStorage.getItem('roles');
|
||||
this.userpicture = 'assets/images/eva.png';
|
||||
|
||||
if (this.username == null) {
|
||||
this.router.navigate(['/auth/login']);
|
||||
}
|
||||
|
||||
this.username = this.username.replace(/['"]+/g, '');
|
||||
|
||||
this.currentTheme = this.themeService.currentTheme;
|
||||
|
||||
const { xl } = this.breakpointService.getBreakpointsMap();
|
||||
this.themeService.onMediaQueryChange()
|
||||
|
|
@ -71,6 +84,10 @@ export class HeaderComponent implements OnInit, OnDestroy {
|
|||
.subscribe(themeName => this.currentTheme = themeName);
|
||||
}
|
||||
|
||||
logout(){
|
||||
this.loginService.logout();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue