home.component.html 3.7 KB
<!--

    Copyright © 2016-2020 The Thingsboard Authors

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<mat-sidenav-container>
  <mat-sidenav #sidenav class="tb-site-sidenav mat-elevation-z2"
               (click)="sidenavClicked()"
               [mode]="sidenavMode"
               [opened]="sidenavOpened && !forceFullscreen">
    <header class="tb-nav-header">
      <mat-toolbar color="primary" class="tb-nav-header-toolbar">
        <div fxFlex="auto" fxLayout="row">
          <img [src]="logo"
               aria-label="logo" class="tb-logo-title"/>
        </div>
      </mat-toolbar>
    </header>
    <mat-toolbar color="primary" fxFlex="0%" class="tb-side-menu-toolbar" fxLayout="column" role="navigation">
      <tb-side-menu></tb-side-menu>
    </mat-toolbar>
  </mat-sidenav>
  <mat-sidenav-content>
    <div fxLayout="column" role="main" style="height: 100%;">
      <mat-toolbar fxLayout="row" color="primary" class="mat-elevation-z1 tb-primary-toolbar">
        <button [fxShow]="!forceFullscreen" mat-icon-button id="main"
                [ngClass]="{'tb-invisible': displaySearchMode()}"
                fxHide.gt-sm (click)="sidenav.toggle()">
          <mat-icon class="material-icons">menu</mat-icon>
        </button>
        <button [fxShow]="forceFullscreen" mat-icon-button
                [ngClass]="{'tb-invisible': displaySearchMode()}"
                (click)="goBack()">
          <mat-icon class="material-icons">arrow_back</mat-icon>
        </button>
        <button mat-icon-button
                [ngClass]="{'tb-invisible': !displaySearchMode()}"
                (click)="closeSearch()">
          <mat-icon class="material-icons">arrow_back</mat-icon>
        </button>
        <tb-breadcrumb [fxShow]="!displaySearchMode()"
             fxFlex [activeComponent]="activeComponent" class="mat-toolbar-tools">
        </tb-breadcrumb>
        <div [fxShow]="displaySearchMode()" fxFlex fxLayout="row" class="tb-dark">
          <mat-form-field fxFlex floatLabel="always">
            <mat-label></mat-label>
            <input #searchInput matInput
                   [(ngModel)]="searchText"
                   placeholder="{{ 'common.enter-search' | translate }}"/>
          </mat-form-field>
        </div>
        <button [fxShow]="searchEnabled"
                mat-icon-button (click)="openSearch()">
          <mat-icon class="material-icons">search</mat-icon>
        </button>
        <button *ngIf="fullscreenEnabled" [fxShow]="!displaySearchMode()"
                mat-icon-button fxHide.lt-md (click)="toggleFullscreen()">
          <mat-icon class="material-icons">{{ isFullscreen() ? 'fullscreen_exit' : 'fullscreen' }}</mat-icon>
        </button>
        <tb-user-menu [displayUserInfo]="!displaySearchMode()"></tb-user-menu>
      </mat-toolbar>
      <mat-progress-bar color="warn" style="z-index: 10; margin-bottom: -4px; width: 100%;" mode="indeterminate"
                        *ngIf="isLoading$ | async">
      </mat-progress-bar>
      <div fxFlex fxLayout="column" tb-toast class="tb-main-content">
        <router-outlet (activate)="activeComponentChanged($event)"></router-outlet>
      </div>
    </div>
  </mat-sidenav-content>
</mat-sidenav-container>