core/header/header-bar/header-bar.component.ts
selector | c8y-header-bar |
templateUrl | ./header-bar.component.html |
Properties |
|
Methods |
Inputs |
constructor(headerService: HeaderService, actionService: ActionService, breadcrumbService: BreadcrumbService, searchService: SearchService, appState: AppStateService, userMenuService: UserMenuService, docs: DocsService)
|
||||||||||||||||||||||||
Parameters :
|
simple |
Type : boolean
|
Default value : false
|
Can be set to show an header bar with only title, app-switcher and user-menu |
closeDrawer |
closeDrawer()
|
Returns :
void
|
ngAfterViewInit |
ngAfterViewInit()
|
Returns :
void
|
toggleDrawer |
toggleDrawer()
|
Returns :
void
|
Public actionService |
Type : ActionService
|
Public appState |
Type : AppStateService
|
appState$ |
Type : Observable<any>
|
Default value : this.appState.state$
|
Public breadcrumbService |
Type : BreadcrumbService
|
canToggle$ |
Type : Observable<boolean>
|
Default value : this.headerService.hasItemsInNavigator$
|
Public docs |
Type : DocsService
|
drawerOpen |
Default value : false
|
headerOpen |
Default value : false
|
Public headerService |
Type : HeaderService
|
Public searchService |
Type : SearchService
|
Public userMenuService |
Type : UserMenuService
|
<div
class="app-main-header"
role="banner"
[ngClass]="{
open: (headerService.navigatorOpen$ | async) && !simple,
drawerOpen: drawerOpen
}"
>
<div class="header-bar">
<button
*ngIf="(canToggle$ | async) && !simple"
type="button"
class="navigator-toggle main-header-button"
title="{{ 'Toggle navigation bar' | translate }}"
(click)="headerService.toggleNavigator()"
[attr.aria-expanded]="(headerService.navigatorOpen$ | async)"
[attr.aria-controls]="'navigator'"
>
<i [c8yIcon]="'outdent'" *ngIf="!(headerService.navigatorOpen$ | async)"></i>
<i [c8yIcon]="'dedent-right'" *ngIf="headerService.navigatorOpen$ | async"></i>
</button>
<div class="app-view">
<c8y-app-icon
[name]="(appState$ | async).app.name"
[contextPath]="(appState$ | async).app.contextPath"
></c8y-app-icon>
<span class="page-header">
<c8y-title-outlet></c8y-title-outlet>
<c8y-breadcrumb-outlet
*ngIf="!simple"
[breadcrumbs]="breadcrumbService.items$ | async"
class="app-breadcrumbs"
></c8y-breadcrumb-outlet>
</span>
</div>
<c8y-search-outlet
*ngIf="!simple"
title="{{ 'Search' | translate }}"
[search]="searchService.items$ | async"
class="main-header-item"
></c8y-search-outlet>
<c8y-action-outlet
*ngIf="!simple"
[items]="actionService.items$ | async"
></c8y-action-outlet>
<c8y-app-switcher
*ngIf="appState.currentUser.value"
title="{{ 'Application switcher' | translate }}"
class="main-header-item"
></c8y-app-switcher>
<button
class="main-header-button drawer-toggle"
type="button"
tooltip="{{ appState.currentUser | async | shortenUserName }}"
[delay]="500"
position="left"
(click)="toggleDrawer()"
[attr.aria-expanded]="drawerOpen"
[attr.aria-controls]="'right-drawer'"
[attr.data-cy]="'right-drawer-toggle-button'"
>
<span
*ngIf="appState.currentUser | async"
class="user-dot"
title="{{appState.currentUser | async | shortenUserName}}"
>
{{appState.currentUser | async | userNameInitials}}
</span>
<span class="close-dot">×</span>
</button>
</div>
<div class="head-toggler">
<button title="{{ 'Toggle' | translate }}" type="button" (click)="headerService.toggle()">
<i [c8yIcon]="'angle-right'"></i>
</button>
</div>
<c8y-right-drawer
[app]="(appState$ | async).app"
[quickLinks]="docs.items$ | async"
[helpAndSupport]="docs.items$ | async"
[attr.aria-hidden]="!drawerOpen"
[drawerOpen]="drawerOpen"
(closeDrawer)="closeDrawer()"
id="right-drawer"
></c8y-right-drawer>
<div class="loading-bar" [ngClass]="{ active: (appState$ | async).isLoading }"></div>
</div>