File

core/header/header-bar/header-bar.component.ts

Implements

AfterViewInit

Metadata

Index

Properties
Methods
Inputs

Constructor

constructor(headerService: HeaderService, actionService: ActionService, breadcrumbService: BreadcrumbService, searchService: SearchService, appState: AppStateService, userMenuService: UserMenuService, docs: DocsService, apiService: ApiService)
Parameters :
Name Type Optional
headerService HeaderService No
actionService ActionService No
breadcrumbService BreadcrumbService No
searchService SearchService No
appState AppStateService No
userMenuService UserMenuService No
docs DocsService No
apiService ApiService No

Inputs

simple
Type : boolean
Default value : false

Can be set to show an header bar with only title, app-switcher and user-menu

Methods

closeDrawer
closeDrawer()
Returns : void
ngAfterViewInit
ngAfterViewInit()
Returns : void
toggleDrawer
toggleDrawer()
Returns : void

Properties

Public actionService
Type : ActionService
Public apiService
Type : ApiService
app$
Type : Observable<IApplication>
Public appState
Type : AppStateService
appState$
Type : unknown
Default value : this.appState.state$.asObservable()
Public breadcrumbService
Type : BreadcrumbService
canToggle$
Type : Observable<boolean>
Default value : this.headerService.canToggleNavigator$
Public docs
Type : DocsService
headerOpen
Type : unknown
Default value : false
Public headerService
Type : HeaderService
loadingClass$
Type : unknown
Default value : new Observable<{ active: boolean }>()
Public searchService
Type : SearchService
showNotification$
Type : unknown
Default value : this.headerService.showNotification$
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"
  >
    @if ((headerService.canToggleNavigator$ | async) && !simple) {
      <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()"
      >
        @if (!(headerService.navigatorOpen$ | async)) {
          <i [c8yIcon]="'outdent'"></i>
        }
        @if (headerService.navigatorOpen$ | async) {
          <i [c8yIcon]="'dedent-right'"></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>
        @if (!simple) {
          <c8y-breadcrumb-outlet
            class="app-breadcrumbs"
            [breadcrumbs]="breadcrumbService.items$ | async"
          ></c8y-breadcrumb-outlet>
        }
      </span>
    </div>
    @if (!simple) {
      <c8y-search-outlet
        class="main-header-item"
        [search]="searchService.items$ | async"
      ></c8y-search-outlet>
    }
    @if (!simple) {
      <c8y-action-outlet [items]="actionService.items$ | async"></c8y-action-outlet>
    }
    @if (appState.currentUser.value) {
      <c8y-app-switcher
        class="main-header-item"
        title="{{ 'Application switcher' | translate }}"
      ></c8y-app-switcher>
    }
    @if (showNotification$ | async) {
      <button
        class="main-header-button drawer-toggle"
        [attr.aria-label]="appState.currentUser | async | shortenUserName"
        tooltip="{{ appState.currentUser | async | shortenUserName }}
{{ 'New features available' | translate }}"
        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'"
      >
        @if (appState.currentUser | async) {
          <span
            class="user-dot user-dot-notification"
            data-cy="header-bar--user-dot"
          >
            {{ appState.currentUser | async | userNameInitials }}
          </span>
        }
        <span class="close-dot">&times;</span>
      </button>
      @if (!(headerService.rightDrawerOpen$ | async)) {
        <div class="p-relative a-s-stretch no-pointer">
          @if (showNotification$ | async) {
            <span class="c8y-pulse c8y-pulse--md active"></span>
          }
        </div>
      }
    } @else {
      <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'"
      >
        @if (appState.currentUser | async) {
          <span
            class="user-dot user-dot-notification"
            data-cy="header-bar--user-dot"
          >
            {{ appState.currentUser | async | userNameInitials }}
          </span>
        }
        <span class="close-dot">&times;</span>
      </button>
    }
  </div>
  <div class="head-toggler">
    <button
      title="{{ 'Toggle' | translate }}"
      type="button"
      data-cy="header-bar--toggle"
      (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>

results matching ""

    No results matching ""