2019-08-29 20:04:59 +03:00
|
|
|
<!--
|
|
|
|
|
|
2023-01-31 10:43:56 +02:00
|
|
|
Copyright © 2016-2023 The Thingsboard Authors
|
2019-08-29 20:04:59 +03: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.
|
|
|
|
|
|
|
|
|
|
-->
|
2021-12-14 12:40:18 +02:00
|
|
|
<div class="mat-padding tb-entity-table tb-absolute-fill">
|
2023-03-21 13:09:20 +02:00
|
|
|
<div fxFlex fxLayout="column" class="tb-entity-table-content tb-outlined-border">
|
2023-02-17 19:24:01 +02:00
|
|
|
<mat-toolbar class="mat-mdc-table-toolbar" [fxShow]="mode === 'default' && !textSearchMode && dataSource.selection.isEmpty()">
|
2019-08-29 20:04:59 +03:00
|
|
|
<div class="mat-toolbar-tools">
|
2020-04-09 17:53:24 +03:00
|
|
|
<div fxLayout="row" fxLayoutAlign="start center" fxLayout.xs="column" fxLayoutAlign.xs="center start" class="title-container">
|
|
|
|
|
<span class="tb-entity-table-title">{{telemetryTypeTranslationsMap.get(attributeScope) | translate}}</span>
|
2023-02-09 19:13:44 +02:00
|
|
|
<mat-form-field class="mat-block tb-attribute-scope" *ngIf="!disableAttributeScopeSelection && !attributeScopeSelectionReadonly">
|
2020-04-09 17:53:24 +03:00
|
|
|
<mat-label translate>attribute.attributes-scope</mat-label>
|
2023-02-09 19:13:44 +02:00
|
|
|
<mat-select [disabled]="(isLoading$ | async)"
|
2020-04-09 17:53:24 +03:00
|
|
|
[ngModel]="attributeScope"
|
|
|
|
|
(ngModelChange)="attributeScopeChanged($event)">
|
|
|
|
|
<mat-option *ngFor="let scope of attributeScopes" [value]="scope">
|
|
|
|
|
{{ telemetryTypeTranslationsMap.get(toTelemetryTypeFunc(scope)) | translate }}
|
|
|
|
|
</mat-option>
|
|
|
|
|
</mat-select>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
2019-08-29 20:04:59 +03:00
|
|
|
<span fxFlex></span>
|
2020-04-09 17:53:24 +03:00
|
|
|
<button mat-icon-button
|
|
|
|
|
*ngIf="!isClientSideTelemetryTypeMap.get(attributeScope)"
|
2019-08-29 20:04:59 +03:00
|
|
|
[disabled]="isLoading$ | async"
|
|
|
|
|
(click)="addAttribute($event)"
|
|
|
|
|
matTooltip="{{ 'action.add' | translate }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<mat-icon>add</mat-icon>
|
|
|
|
|
</button>
|
2020-04-09 17:53:24 +03:00
|
|
|
<button mat-icon-button
|
|
|
|
|
*ngIf="!isClientSideTelemetryTypeMap.get(attributeScope)"
|
2019-08-29 20:04:59 +03:00
|
|
|
[disabled]="isLoading$ | async"
|
|
|
|
|
(click)="reloadAttributes()"
|
|
|
|
|
matTooltip="{{ 'action.refresh' | translate }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<mat-icon>refresh</mat-icon>
|
|
|
|
|
</button>
|
2020-04-09 17:53:24 +03:00
|
|
|
<button mat-icon-button
|
2019-08-29 20:04:59 +03:00
|
|
|
[disabled]="isLoading$ | async"
|
|
|
|
|
(click)="enterFilterMode()"
|
|
|
|
|
matTooltip="{{ 'action.search' | translate }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<mat-icon>search</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</mat-toolbar>
|
2023-02-17 19:24:01 +02:00
|
|
|
<mat-toolbar class="mat-mdc-table-toolbar" [fxShow]="mode === 'default' && textSearchMode && dataSource.selection.isEmpty()">
|
2019-08-29 20:04:59 +03:00
|
|
|
<div class="mat-toolbar-tools">
|
2020-04-09 17:53:24 +03:00
|
|
|
<button mat-icon-button
|
2019-08-29 20:04:59 +03:00
|
|
|
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="{{ 'common.enter-search' | translate }}"/>
|
|
|
|
|
</mat-form-field>
|
2020-04-09 17:53:24 +03:00
|
|
|
<button mat-icon-button (click)="exitFilterMode()"
|
2019-08-29 20:04:59 +03:00
|
|
|
matTooltip="{{ 'action.close' | translate }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<mat-icon>close</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</mat-toolbar>
|
2023-02-17 19:24:01 +02:00
|
|
|
<mat-toolbar class="mat-mdc-table-toolbar" color="primary" [fxShow]="mode === 'default' && !dataSource.selection.isEmpty()">
|
2020-04-09 17:53:24 +03:00
|
|
|
<div class="mat-toolbar-tools" fxLayout.xs="row wrap">
|
|
|
|
|
<span class="tb-entity-table-info">
|
|
|
|
|
{{ (attributeScope === latestTelemetryTypes.LATEST_TELEMETRY ?
|
|
|
|
|
'attribute.selected-telemetry' : 'attribute.selected-attributes') | translate:{count: dataSource.selection.selected.length} }}
|
|
|
|
|
</span>
|
2019-08-29 20:04:59 +03:00
|
|
|
<span fxFlex></span>
|
2019-08-30 19:19:45 +03:00
|
|
|
<button [fxShow]="!isClientSideTelemetryTypeMap.get(attributeScope)"
|
2020-04-09 17:53:24 +03:00
|
|
|
class="button-widget-action"
|
|
|
|
|
mat-icon-button [disabled]="isLoading$ | async"
|
2019-08-29 20:04:59 +03:00
|
|
|
matTooltip="{{ 'action.delete' | translate }}"
|
|
|
|
|
matTooltipPosition="above"
|
|
|
|
|
(click)="deleteAttributes($event)">
|
|
|
|
|
<mat-icon>delete</mat-icon>
|
|
|
|
|
</button>
|
2023-07-14 12:37:40 +03:00
|
|
|
<button [fxShow]="attributeScope === latestTelemetryTypes.LATEST_TELEMETRY"
|
2023-07-13 15:24:45 +03:00
|
|
|
class="button-widget-action"
|
|
|
|
|
mat-icon-button [disabled]="isLoading$ | async"
|
|
|
|
|
matTooltip="{{ 'action.delete' | translate }}"
|
|
|
|
|
matTooltipPosition="above"
|
|
|
|
|
(click)="deleteTimeseries($event)">
|
|
|
|
|
<mat-icon>delete</mat-icon>
|
|
|
|
|
</button>
|
2020-04-09 17:53:24 +03:00
|
|
|
<button mat-raised-button color="accent"
|
|
|
|
|
class="button-widget-action"
|
2019-08-29 20:04:59 +03:00
|
|
|
[disabled]="isLoading$ | async"
|
|
|
|
|
matTooltip="{{ 'attribute.show-on-widget' | translate }}"
|
|
|
|
|
matTooltipPosition="above"
|
|
|
|
|
(click)="enterWidgetMode()">
|
|
|
|
|
<mat-icon>now_widgets</mat-icon>
|
|
|
|
|
<span translate>attribute.show-on-widget</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</mat-toolbar>
|
2023-02-17 19:24:01 +02:00
|
|
|
<mat-toolbar class="mat-mdc-table-toolbar" color="primary" [fxShow]="mode === 'widget'">
|
2020-04-09 17:53:24 +03:00
|
|
|
<div class="mat-toolbar-tools" fxLayoutGap="8px" fxLayout.xs="row wrap">
|
2019-08-29 20:04:59 +03:00
|
|
|
<div fxFlex fxLayout="row" fxLayoutAlign="start">
|
|
|
|
|
<span class="tb-details-subtitle">{{ 'widgets-bundle.current' | translate }}</span>
|
2019-11-15 12:22:14 +02:00
|
|
|
<tb-widgets-bundle-select fxFlexOffset="5"
|
|
|
|
|
fxFlex
|
|
|
|
|
[selectFirstBundle]="false"
|
|
|
|
|
[selectBundleAlias]="selectedWidgetsBundleAlias"
|
2021-08-31 18:57:07 +03:00
|
|
|
[ngModel]="null"
|
|
|
|
|
(ngModelChange)="onWidgetsBundleChanged($event)">
|
2019-11-15 12:22:14 +02:00
|
|
|
</tb-widgets-bundle-select>
|
2019-08-29 20:04:59 +03:00
|
|
|
</div>
|
2020-04-09 17:53:24 +03:00
|
|
|
<button mat-raised-button [fxShow]="widgetsList.length > 0"
|
2019-08-29 20:04:59 +03:00
|
|
|
color="accent"
|
2020-04-09 17:53:24 +03:00
|
|
|
class="button-widget-action"
|
2019-08-29 20:04:59 +03:00
|
|
|
[disabled]="isLoading$ | async"
|
2019-11-15 12:22:14 +02:00
|
|
|
matTooltip="{{ 'attribute.add-to-dashboard' | translate }}"
|
2019-08-29 20:04:59 +03:00
|
|
|
matTooltipPosition="above"
|
2019-11-15 12:22:14 +02:00
|
|
|
(click)="addWidgetToDashboard()">
|
|
|
|
|
<mat-icon>dashboard</mat-icon>
|
|
|
|
|
<span translate>attribute.add-to-dashboard</span>
|
|
|
|
|
</button>
|
2020-04-09 17:53:24 +03:00
|
|
|
<button mat-icon-button
|
2019-08-29 20:04:59 +03:00
|
|
|
[disabled]="isLoading$ | async"
|
|
|
|
|
matTooltip="{{ 'action.close' | translate }}"
|
|
|
|
|
matTooltipPosition="above"
|
|
|
|
|
(click)="exitWidgetMode()">
|
|
|
|
|
<mat-icon>close</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</mat-toolbar>
|
|
|
|
|
<div fxFlex class="table-container" [fxShow]="mode !== 'widget'">
|
2020-04-09 17:53:24 +03:00
|
|
|
<table mat-table [dataSource]="dataSource"
|
2020-02-04 15:14:17 +02:00
|
|
|
matSort [matSortActive]="pageLink.sortOrder.property" [matSortDirection]="pageLink.sortDirection()" matSortDisableClear>
|
2019-08-29 20:04:59 +03:00
|
|
|
<ng-container matColumnDef="select" sticky>
|
2023-05-19 11:45:41 +03:00
|
|
|
<mat-header-cell *matHeaderCellDef style="width: 40px;">
|
2019-08-29 20:04:59 +03:00
|
|
|
<mat-checkbox (change)="$event ? dataSource.masterToggle() : null"
|
|
|
|
|
[checked]="dataSource.selection.hasValue() && (dataSource.isAllSelected() | async)"
|
|
|
|
|
[indeterminate]="dataSource.selection.hasValue() && !(dataSource.isAllSelected() | async)">
|
|
|
|
|
</mat-checkbox>
|
|
|
|
|
</mat-header-cell>
|
|
|
|
|
<mat-cell *matCellDef="let attribute">
|
|
|
|
|
<mat-checkbox (click)="$event.stopPropagation()"
|
|
|
|
|
(change)="$event ? dataSource.selection.toggle(attribute) : null"
|
|
|
|
|
[checked]="dataSource.selection.isSelected(attribute)">
|
|
|
|
|
</mat-checkbox>
|
|
|
|
|
</mat-cell>
|
|
|
|
|
</ng-container>
|
|
|
|
|
<ng-container matColumnDef="lastUpdateTs">
|
2020-02-04 19:50:18 +02:00
|
|
|
<mat-header-cell *matHeaderCellDef mat-sort-header style="min-width: 150px; max-width: 150px; width: 150px;"> {{ 'attribute.last-update-time' | translate }} </mat-header-cell>
|
2019-08-29 20:04:59 +03:00
|
|
|
<mat-cell *matCellDef="let attribute">
|
|
|
|
|
{{ attribute.lastUpdateTs | date:'yyyy-MM-dd HH:mm:ss' }}
|
|
|
|
|
</mat-cell>
|
|
|
|
|
</ng-container>
|
|
|
|
|
<ng-container matColumnDef="key">
|
2020-02-04 19:50:18 +02:00
|
|
|
<mat-header-cell *matHeaderCellDef mat-sort-header style="width: 40%"> {{ 'attribute.key' | translate }} </mat-header-cell>
|
2023-05-02 09:19:53 +03:00
|
|
|
<mat-cell *matCellDef="let attribute" class="attribute">
|
|
|
|
|
<div fxLayout="row" style="align-items: center">
|
2023-04-28 17:53:59 +03:00
|
|
|
<span class="ellipsis">{{ attribute.key }}</span>
|
2023-04-28 14:42:08 +03:00
|
|
|
<tb-copy-button
|
2023-05-01 16:26:49 +03:00
|
|
|
class="attribute-copy"
|
2023-04-28 14:42:08 +03:00
|
|
|
[disabled]="isLoading$ | async"
|
|
|
|
|
[copyText]="attribute.key"
|
|
|
|
|
tooltipText="{{ 'attribute.copy-key' | translate }}"
|
|
|
|
|
tooltipPosition="above"
|
|
|
|
|
icon="content_copy"
|
|
|
|
|
[style]="{padding: '4px', 'font-size': '16px', color: 'rgba(0,0,0,.87)'}"
|
|
|
|
|
>
|
|
|
|
|
</tb-copy-button>
|
|
|
|
|
</div>
|
2019-08-29 20:04:59 +03:00
|
|
|
</mat-cell>
|
|
|
|
|
</ng-container>
|
|
|
|
|
<ng-container matColumnDef="value">
|
2020-02-04 19:50:18 +02:00
|
|
|
<mat-header-cell *matHeaderCellDef style="width: 60%"> {{ 'attribute.value' | translate }} </mat-header-cell>
|
2019-08-29 20:04:59 +03:00
|
|
|
<mat-cell *matCellDef="let attribute"
|
2023-05-02 09:19:53 +03:00
|
|
|
class="tb-value-cell attribute"
|
2019-08-29 20:04:59 +03:00
|
|
|
(click)="editAttribute($event, attribute)">
|
2023-04-28 17:53:59 +03:00
|
|
|
<div fxFlex fxLayout="row" style="align-items: center">
|
2023-05-02 09:19:53 +03:00
|
|
|
<div fxFlex fxLayout="row" style="overflow: hidden; align-items: center;">
|
2023-04-28 17:53:59 +03:00
|
|
|
<span class="ellipsis">{{attribute.value | tbJson}}</span>
|
2023-04-28 14:42:08 +03:00
|
|
|
<tb-copy-button
|
2023-05-01 16:26:49 +03:00
|
|
|
class="attribute-copy"
|
2023-04-28 14:42:08 +03:00
|
|
|
[disabled]="isLoading$ | async"
|
|
|
|
|
[copyText]="attribute.value | tbJson"
|
|
|
|
|
tooltipText="{{ 'attribute.copy-value' | translate }}"
|
|
|
|
|
tooltipPosition="above"
|
|
|
|
|
icon="content_copy"
|
|
|
|
|
[style]="{padding: '4px', 'font-size': '16px', color: 'rgba(0,0,0,.87)'}"
|
|
|
|
|
>
|
|
|
|
|
</tb-copy-button>
|
|
|
|
|
</div>
|
2020-02-04 19:50:18 +02:00
|
|
|
<span [fxShow]="!isClientSideTelemetryTypeMap.get(attributeScope)">
|
|
|
|
|
<mat-icon>edit</mat-icon>
|
|
|
|
|
</span>
|
2023-07-13 15:24:45 +03:00
|
|
|
<button mat-icon-button [fxShow]="attributeScope === latestTelemetryTypes.LATEST_TELEMETRY"
|
|
|
|
|
(click)="deleteTimeseries($event, attribute)">
|
|
|
|
|
<mat-icon>delete</mat-icon>
|
|
|
|
|
</button>
|
2020-02-04 19:50:18 +02:00
|
|
|
</div>
|
2019-08-29 20:04:59 +03:00
|
|
|
</mat-cell>
|
|
|
|
|
</ng-container>
|
|
|
|
|
<mat-header-row [ngClass]="{'mat-row-select': true}" *matHeaderRowDef="displayedColumns; sticky: true"></mat-header-row>
|
|
|
|
|
<mat-row [ngClass]="{'mat-row-select': true,
|
|
|
|
|
'mat-selected': dataSource.selection.isSelected(attribute)}"
|
|
|
|
|
*matRowDef="let attribute; columns: displayedColumns;" (click)="dataSource.selection.toggle(attribute)"></mat-row>
|
2020-04-09 17:53:24 +03:00
|
|
|
</table>
|
2019-08-29 20:04:59 +03:00
|
|
|
<span [fxShow]="dataSource.isEmpty() | async"
|
|
|
|
|
fxLayoutAlign="center center"
|
|
|
|
|
class="no-data-found" translate>{{
|
|
|
|
|
attributeScope === latestTelemetryTypes.LATEST_TELEMETRY
|
|
|
|
|
? 'attribute.no-telemetry-text'
|
|
|
|
|
: 'attribute.no-attributes-text'
|
|
|
|
|
}}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<mat-divider [fxShow]="mode !== 'widget'"></mat-divider>
|
|
|
|
|
<mat-paginator [fxShow]="mode !== 'widget'"
|
|
|
|
|
[length]="dataSource.total() | async"
|
|
|
|
|
[pageIndex]="pageLink.page"
|
|
|
|
|
[pageSize]="pageLink.pageSize"
|
2021-02-01 17:19:00 +02:00
|
|
|
[pageSizeOptions]="[10, 20, 30]"
|
2021-12-01 11:32:32 +02:00
|
|
|
[hidePageSize]="hidePageSize"
|
2021-02-01 17:19:00 +02:00
|
|
|
showFirstLastButtons></mat-paginator>
|
2019-11-15 12:22:14 +02:00
|
|
|
<ngx-hm-carousel fxFlex *ngIf="mode === 'widget' && widgetsList.length > 0"
|
|
|
|
|
#carousel
|
|
|
|
|
[(ngModel)]="widgetsCarouselIndex"
|
2019-12-23 14:36:44 +02:00
|
|
|
(ngModelChange)="onWidgetsCarouselIndexChanged()"
|
2019-11-15 12:22:14 +02:00
|
|
|
[data]="widgetsList"
|
|
|
|
|
[infinite]="false"
|
|
|
|
|
class="carousel c-accent">
|
|
|
|
|
<section ngx-hm-carousel-container class="content">
|
|
|
|
|
<article class="item cursor-pointer"
|
|
|
|
|
ngx-hm-carousel-item
|
|
|
|
|
*ngFor="let widgets of widgetsList">
|
|
|
|
|
<tb-dashboard class="tb-absolute-fill"
|
|
|
|
|
[aliasController]="aliasController"
|
|
|
|
|
[widgets]="widgets"
|
|
|
|
|
[columns]="20"
|
|
|
|
|
[isEdit]="false"
|
|
|
|
|
[isMobileDisabled]="true"
|
|
|
|
|
[isEditActionEnabled]="false"
|
|
|
|
|
[isRemoveActionEnabled]="false">
|
|
|
|
|
</tb-dashboard>
|
|
|
|
|
</article>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<ng-template #carouselPrev>
|
2020-04-09 17:53:24 +03:00
|
|
|
<button mat-icon-button
|
|
|
|
|
*ngIf="widgetsCarouselIndex > 0"
|
2019-11-15 12:22:14 +02:00
|
|
|
matTooltip="{{ 'attribute.prev-widget' | translate }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<mat-icon>keyboard_arrow_left</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
</ng-template>
|
|
|
|
|
<ng-template #carouselNext>
|
2020-04-09 17:53:24 +03:00
|
|
|
<button mat-icon-button
|
|
|
|
|
*ngIf="widgetsCarouselIndex < widgetsList.length - 1"
|
2019-11-15 12:22:14 +02:00
|
|
|
matTooltip="{{ 'attribute.next-widget' | translate }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<mat-icon>keyboard_arrow_right</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
</ng-template>
|
|
|
|
|
|
|
|
|
|
<ng-template #carouselDot let-model>
|
|
|
|
|
<div class="ball"
|
|
|
|
|
[class.visible]="model.index === model.currentIndex"></div>
|
|
|
|
|
</ng-template>
|
|
|
|
|
|
|
|
|
|
</ngx-hm-carousel>
|
|
|
|
|
<span translate *ngIf="mode === 'widget' && widgetsLoaded &&
|
|
|
|
|
widgetsList.length === 0 &&
|
2021-08-31 18:57:07 +03:00
|
|
|
widgetBundleSet"
|
2020-04-09 17:53:24 +03:00
|
|
|
fxFlex fxLayoutAlign="center center"
|
2020-10-07 11:58:43 +03:00
|
|
|
style="display: flex;"
|
2023-02-17 19:24:01 +02:00
|
|
|
class="mat-headline-5">widgets-bundle.empty</span>
|
2021-08-31 18:57:07 +03:00
|
|
|
<span translate *ngIf="mode === 'widget' && !widgetBundleSet"
|
2020-04-09 17:53:24 +03:00
|
|
|
fxFlex fxLayoutAlign="center center"
|
2020-10-07 11:58:43 +03:00
|
|
|
style="display: flex;"
|
2023-02-17 19:24:01 +02:00
|
|
|
class="mat-headline-5">widget.select-widgets-bundle</span>
|
2019-08-29 20:04:59 +03:00
|
|
|
</div>
|
|
|
|
|
</div>
|