core/header/header-bar/header-bar.component.ts
AfterViewInit
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, apiService: ApiService)
|
|||||||||||||||||||||||||||
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 apiService |
Type : ApiService
|
app$ |
Type : Observable<IApplication>
|
Public appState |
Type : AppStateService
|
appState$ |
Default value : this.appState.state$.asObservable()
|
Public breadcrumbService |
Type : BreadcrumbService
|
canToggle$ |
Type : Observable<boolean>
|
Default value : this.headerService.canToggleNavigator$
|
Public docs |
Type : DocsService
|
headerOpen |
Default value : false
|
Public headerService |
Type : HeaderService
|
loadingClass$ |
Default value : new Observable<{ active: boolean }>()
|
Public searchService |
Type : SearchService
|
Public userMenuService |
Type : UserMenuService
|
<div
class="app-main-header"
[ngClass]="{
open: (headerService.navigatorOpen$ | async) && !simple,
drawerOpen: headerService.rightDrawerOpen$ | async
}"
>
<div
class="header-bar"
role="banner"
>
<button
class="navigator-toggle main-header-button"
title="{{ 'Toggle navigation bar' | translate }}"
[attr.aria-expanded]="headerService.navigatorOpen$ | async"
[attr.aria-controls]="'navigator'"
type="button"
data-cy="header-bar--main-header-button"
(click)="headerService.toggleNavigator()"
*ngIf="(headerService.canToggleNavigator$ | async) && !simple"
>
<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"
[app]="(app$ | async) || (appState$ | async).app"
></c8y-app-icon>
<span class="page-header">
<c8y-title-outlet></c8y-title-outlet>
<c8y-breadcrumb-outlet
class="app-breadcrumbs"
*ngIf="!simple"
[breadcrumbs]="breadcrumbService.items$ | async"
></c8y-breadcrumb-outlet>
</span>
</div>
<c8y-search-outlet
class="main-header-item"
title="{{ 'Search' | translate }}"
*ngIf="!simple"
[search]="searchService.items$ | async"
></c8y-search-outlet>
<c8y-action-outlet
*ngIf="!simple"
[items]="actionService.items$ | async"
></c8y-action-outlet>
<c8y-app-switcher
class="main-header-item"
title="{{ 'Application switcher' | translate }}"
*ngIf="appState.currentUser.value"
></c8y-app-switcher>
<button
class="main-header-button drawer-toggle"
[attr.aria-label]="appState.currentUser | async | shortenUserName"
tooltip="{{ appState.currentUser | async | shortenUserName }}"
placement="left"
[attr.aria-expanded]="headerService.rightDrawerOpen$ | async"
[attr.aria-controls]="'right-drawer'"
type="button"
[delay]="500"
(click)="toggleDrawer()"
[attr.data-cy]="'right-drawer-toggle-button'"
>
<span
class="user-dot"
title="{{ appState.currentUser | async | shortenUserName }}"
*ngIf="appState.currentUser | async"
data-cy="header-bar--user-dot"
>
{{ 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-drawer-outlet
id="right-drawer"
[tabindex]="(headerService.rightDrawerOpen$ | async) ? '0' : '-1'"
[attr.aria-hidden]="!(headerService.rightDrawerOpen$ | async)"
position="right"
[open]="headerService.rightDrawerOpen$ | async"
></c8y-drawer-outlet>
<div
class="loading-bar"
[ngClass]="loadingClass$ | async"
></div>
</div>