2020-01-22 20:05:30 +02:00
|
|
|
<!--
|
|
|
|
|
|
2021-01-11 13:42:16 +02:00
|
|
|
Copyright © 2016-2021 The Thingsboard Authors
|
2020-01-22 20:05:30 +02:00
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
-->
|
2020-01-24 19:05:41 +02:00
|
|
|
<div class="tb-table-widget tb-absolute-fill">
|
2020-01-22 20:05:30 +02:00
|
|
|
<div fxFlex fxLayout="column" class="tb-absolute-fill">
|
|
|
|
|
<mat-toolbar class="mat-table-toolbar" [fxShow]="textSearchMode">
|
|
|
|
|
<div class="mat-toolbar-tools">
|
|
|
|
|
<button mat-button mat-icon-button
|
|
|
|
|
matTooltip="{{ 'action.search' | translate }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<mat-icon>search</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
<mat-form-field fxFlex>
|
|
|
|
|
<mat-label> </mat-label>
|
|
|
|
|
<input #searchInput matInput
|
|
|
|
|
[(ngModel)]="pageLink.textSearch"
|
|
|
|
|
placeholder="{{ 'entity.search' | translate }}"/>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<button mat-button mat-icon-button (click)="exitFilterMode()"
|
|
|
|
|
matTooltip="{{ 'action.close' | translate }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<mat-icon>close</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</mat-toolbar>
|
|
|
|
|
<div fxFlex class="table-container">
|
2020-12-01 10:16:58 +02:00
|
|
|
<table mat-table [dataSource]="entityDatasource" [trackBy]="trackByEntityId"
|
2020-06-22 18:55:15 +03:00
|
|
|
matSort [matSortActive]="sortOrderProperty" [matSortDirection]="pageLinkSortDirection()" matSortDisableClear>
|
2020-01-24 19:05:41 +02:00
|
|
|
<ng-container [matColumnDef]="column.def" *ngFor="let column of columns; trackBy: trackByColumnDef;">
|
2020-01-22 20:05:30 +02:00
|
|
|
<mat-header-cell [ngStyle]="headerStyle(column)" *matHeaderCellDef mat-sort-header> {{ column.title }} </mat-header-cell>
|
|
|
|
|
<mat-cell *matCellDef="let entity;"
|
|
|
|
|
[innerHTML]="cellContent(entity, column)"
|
|
|
|
|
[ngStyle]="cellStyle(entity, column)">
|
|
|
|
|
</mat-cell>
|
|
|
|
|
</ng-container>
|
2021-03-12 12:15:35 +02:00
|
|
|
<ng-container matColumnDef="actions" [stickyEnd]="enableStickyAction">
|
2020-02-04 19:50:18 +02:00
|
|
|
<mat-header-cell *matHeaderCellDef [ngStyle.gt-md]="{ minWidth: (actionCellDescriptors.length * 40) + 'px',
|
|
|
|
|
maxWidth: (actionCellDescriptors.length * 40) + 'px',
|
|
|
|
|
width: (actionCellDescriptors.length * 40) + 'px' }">
|
2020-01-22 20:05:30 +02:00
|
|
|
</mat-header-cell>
|
2020-02-04 19:50:18 +02:00
|
|
|
<mat-cell *matCellDef="let entity" [ngStyle.gt-md]="{ minWidth: (actionCellDescriptors.length * 40) + 'px',
|
|
|
|
|
maxWidth: (actionCellDescriptors.length * 40) + 'px',
|
|
|
|
|
width: (actionCellDescriptors.length * 40) + 'px' }">
|
2020-01-22 20:05:30 +02:00
|
|
|
<div fxHide fxShow.gt-md fxFlex fxLayout="row" fxLayoutAlign="end">
|
|
|
|
|
<button mat-button mat-icon-button [disabled]="isLoading$ | async"
|
2020-12-01 10:16:58 +02:00
|
|
|
*ngFor="let actionDescriptor of actionCellDescriptors; trackBy: trackByActionCellDescriptionId"
|
2020-01-22 20:05:30 +02:00
|
|
|
matTooltip="{{ actionDescriptor.displayName }}"
|
|
|
|
|
matTooltipPosition="above"
|
|
|
|
|
(click)="onActionButtonClick($event, entity, actionDescriptor)">
|
|
|
|
|
<mat-icon>{{actionDescriptor.icon}}</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2020-05-07 13:07:11 +03:00
|
|
|
<div fxHide fxShow.lt-lg *ngIf="actionCellDescriptors.length">
|
2020-01-22 20:05:30 +02:00
|
|
|
<button mat-button mat-icon-button
|
|
|
|
|
(click)="$event.stopPropagation(); ctx.detectChanges();"
|
|
|
|
|
[matMenuTriggerFor]="cellActionsMenu">
|
|
|
|
|
<mat-icon class="material-icons">more_vert</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
<mat-menu #cellActionsMenu="matMenu" xPosition="before">
|
2020-12-01 10:16:58 +02:00
|
|
|
<button mat-menu-item *ngFor="let actionDescriptor of actionCellDescriptors; trackBy: trackByActionCellDescriptionId"
|
2020-01-22 20:05:30 +02:00
|
|
|
[disabled]="isLoading$ | async"
|
|
|
|
|
(click)="onActionButtonClick($event, entity, actionDescriptor)">
|
|
|
|
|
<mat-icon>{{actionDescriptor.icon}}</mat-icon>
|
|
|
|
|
<span>{{ actionDescriptor.displayName }}</span>
|
|
|
|
|
</button>
|
|
|
|
|
</mat-menu>
|
|
|
|
|
</div>
|
|
|
|
|
</mat-cell>
|
|
|
|
|
</ng-container>
|
2021-03-12 12:15:35 +02:00
|
|
|
<mat-header-row *matHeaderRowDef="displayedColumns; sticky: enableStickyHeader"></mat-header-row>
|
2020-08-07 10:38:51 +03:00
|
|
|
<mat-row [ngClass]="{'tb-current-entity': entityDatasource.isCurrentEntity(entity),
|
|
|
|
|
'invisible': entityDatasource.dataLoading}"
|
2020-01-22 20:05:30 +02:00
|
|
|
*matRowDef="let entity; columns: displayedColumns;"
|
2021-03-12 12:15:35 +02:00
|
|
|
[ngStyle]="rowStyle(entity)"
|
2020-02-26 18:15:04 +02:00
|
|
|
(click)="onRowClick($event, entity)" (dblclick)="onRowClick($event, entity, true)"></mat-row>
|
2020-04-21 11:53:26 +03:00
|
|
|
</table>
|
2020-06-25 20:08:07 +03:00
|
|
|
<span [fxShow]="(entityDatasource.isEmpty() | async) && !entityDatasource.dataLoading"
|
2020-01-22 20:05:30 +02:00
|
|
|
fxLayoutAlign="center center"
|
|
|
|
|
class="no-data-found" translate>entity.no-entities-prompt</span>
|
2020-06-25 20:08:07 +03:00
|
|
|
<span [fxShow]="entityDatasource.dataLoading"
|
|
|
|
|
fxLayoutAlign="center center"
|
|
|
|
|
class="no-data-found">{{ 'common.loading' | translate }}</span>
|
2020-01-22 20:05:30 +02:00
|
|
|
</div>
|
|
|
|
|
<mat-divider *ngIf="displayPagination"></mat-divider>
|
|
|
|
|
<mat-paginator *ngIf="displayPagination"
|
|
|
|
|
[length]="entityDatasource.total() | async"
|
|
|
|
|
[pageIndex]="pageLink.page"
|
|
|
|
|
[pageSize]="pageLink.pageSize"
|
2021-02-01 17:19:00 +02:00
|
|
|
[pageSizeOptions]="pageSizeOptions"
|
|
|
|
|
showFirstLastButtons></mat-paginator>
|
2020-01-22 20:05:30 +02:00
|
|
|
</div>
|
|
|
|
|
</div>
|