212 lines
9.4 KiB
HTML
212 lines
9.4 KiB
HTML
|
|
<!--
|
||
|
|
|
||
|
|
Copyright © 2016-2024 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-toolbar color="primary">
|
||
|
|
<h2>{{ 'timewindow.timewindow-settings' | translate }}</h2>
|
||
|
|
<span fxFlex></span>
|
||
|
|
<!-- <div tb-help="#"></div>-->
|
||
|
|
<button mat-icon-button
|
||
|
|
(click)="cancel()"
|
||
|
|
type="button">
|
||
|
|
<mat-icon class="material-icons">close</mat-icon>
|
||
|
|
</button>
|
||
|
|
</mat-toolbar>
|
||
|
|
<form [formGroup]="timewindowForm" class="mat-content">
|
||
|
|
<mat-tab-group (selectedTabChange)="onTimewindowTypeChange()" [(selectedIndex)]="timewindow.selectedTab">
|
||
|
|
<mat-tab label="{{ 'timewindow.realtime' | translate }}">
|
||
|
|
<div class="tb-flex column">
|
||
|
|
<section class="tb-form-panel stroked">
|
||
|
|
<div class="tb-flex space-between"
|
||
|
|
[ngClass]="{'align-end': realtimeTypeSelectionAvailable, 'align-center': !realtimeTypeSelectionAvailable }">
|
||
|
|
<div class="tb-flex column no-flex flex-xs">
|
||
|
|
<div class="tb-form-panel-title">{{ 'timewindow.time-range' | translate }}</div>
|
||
|
|
<ng-container formGroupName="realtime" *ngIf="realtimeTypeSelectionAvailable">
|
||
|
|
<tb-toggle-select appearance="fill" [options]="realtimeTimewindowOptions" formControlName="realtimeType">
|
||
|
|
</tb-toggle-select>
|
||
|
|
</ng-container>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<ng-container *ngTemplateOutlet="timezoneSelection">
|
||
|
|
</ng-container>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<ng-container formGroupName="realtime">
|
||
|
|
<ng-container *ngIf="timewindowForm.get('realtime.realtimeType').value === realtimeTypes.LAST_INTERVAL">
|
||
|
|
<tb-timeinterval
|
||
|
|
formControlName="timewindowMs"
|
||
|
|
subscriptSizing="dynamic"
|
||
|
|
appearance="outline"
|
||
|
|
[required]="timewindow.selectedTab === timewindowTypes.REALTIME &&
|
||
|
|
timewindowForm.get('realtime.realtimeType').value === realtimeTypes.LAST_INTERVAL">
|
||
|
|
</tb-timeinterval>
|
||
|
|
</ng-container>
|
||
|
|
|
||
|
|
<ng-container *ngIf="timewindowForm.get('realtime.realtimeType').value === realtimeTypes.INTERVAL">
|
||
|
|
<tb-quick-time-interval
|
||
|
|
displayLabel="false"
|
||
|
|
formControlName="quickInterval"
|
||
|
|
onlyCurrentInterval="true"
|
||
|
|
subscriptSizing="dynamic"
|
||
|
|
appearance="outline"
|
||
|
|
[required]="timewindow.selectedTab === timewindowTypes.REALTIME &&
|
||
|
|
timewindowForm.get('realtime.realtimeType').value === realtimeTypes.INTERVAL">
|
||
|
|
</tb-quick-time-interval>
|
||
|
|
</ng-container>
|
||
|
|
</ng-container>
|
||
|
|
</section>
|
||
|
|
<ng-container *ngTemplateOutlet="aggregationConfig">
|
||
|
|
</ng-container>
|
||
|
|
</div>
|
||
|
|
</mat-tab>
|
||
|
|
<mat-tab label="{{ 'timewindow.history' | translate }}">
|
||
|
|
<div class="tb-flex column">
|
||
|
|
<section class="tb-form-panel stroked">
|
||
|
|
<div class="tb-flex space-between align-end">
|
||
|
|
<div class="tb-flex column no-flex flex-xs">
|
||
|
|
<div class="tb-form-panel-title">{{ 'timewindow.time-range' | translate }}</div>
|
||
|
|
<ng-container formGroupName="history">
|
||
|
|
<tb-toggle-select appearance="fill" [options]="historyTimewindowOptions" formControlName="historyType">
|
||
|
|
</tb-toggle-select>
|
||
|
|
</ng-container>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<ng-container *ngTemplateOutlet="timezoneSelection">
|
||
|
|
</ng-container>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<ng-container formGroupName="history">
|
||
|
|
<ng-container *ngIf="timewindowForm.get('history.historyType').value === historyTypes.LAST_INTERVAL">
|
||
|
|
<tb-timeinterval
|
||
|
|
formControlName="timewindowMs"
|
||
|
|
subscriptSizing="dynamic"
|
||
|
|
appearance="outline"
|
||
|
|
[required]="timewindow.selectedTab === timewindowTypes.HISTORY &&
|
||
|
|
timewindowForm.get('history.historyType').value === historyTypes.LAST_INTERVAL">
|
||
|
|
</tb-timeinterval>
|
||
|
|
</ng-container>
|
||
|
|
|
||
|
|
<ng-container *ngIf="timewindowForm.get('history.historyType').value === historyTypes.FIXED">
|
||
|
|
<tb-datetime-period
|
||
|
|
formControlName="fixedTimewindow"
|
||
|
|
subscriptSizing="dynamic"
|
||
|
|
appearance="outline"
|
||
|
|
class="history-time-input"
|
||
|
|
[required]="timewindow.selectedTab === timewindowTypes.HISTORY &&
|
||
|
|
timewindowForm.get('history.historyType').value === historyTypes.FIXED">
|
||
|
|
</tb-datetime-period>
|
||
|
|
</ng-container>
|
||
|
|
|
||
|
|
<ng-container *ngIf="timewindowForm.get('history.historyType').value === historyTypes.INTERVAL">
|
||
|
|
<tb-quick-time-interval
|
||
|
|
displayLabel="false"
|
||
|
|
formControlName="quickInterval"
|
||
|
|
subscriptSizing="dynamic"
|
||
|
|
appearance="outline"
|
||
|
|
[required]="timewindow.selectedTab === timewindowTypes.HISTORY &&
|
||
|
|
timewindowForm.get('history.historyType').value === historyTypes.INTERVAL">
|
||
|
|
</tb-quick-time-interval>
|
||
|
|
</ng-container>
|
||
|
|
</ng-container>
|
||
|
|
</section>
|
||
|
|
<ng-container *ngTemplateOutlet="aggregationConfig">
|
||
|
|
</ng-container>
|
||
|
|
</div>
|
||
|
|
</mat-tab>
|
||
|
|
</mat-tab-group>
|
||
|
|
<ng-template #aggregationConfig>
|
||
|
|
<div class="tb-flex column">
|
||
|
|
<ng-container formGroupName="aggregation">
|
||
|
|
<section class="tb-form-panel stroked">
|
||
|
|
<div class="tb-form-panel-title">{{ 'aggregation.aggregation' | translate }}</div>
|
||
|
|
<mat-form-field subscriptSizing="dynamic" appearance="outline">
|
||
|
|
<mat-select formControlName="type">
|
||
|
|
<mat-option *ngFor="let aggregation of aggregations" [value]="aggregation">
|
||
|
|
{{ aggregationTypesTranslations.get(aggregationTypes[aggregation]) | translate }}
|
||
|
|
</mat-option>
|
||
|
|
</mat-select>
|
||
|
|
</mat-form-field>
|
||
|
|
</section>
|
||
|
|
|
||
|
|
<section class="tb-form-panel stroked"
|
||
|
|
*ngIf="timewindowForm.get('aggregation.type').value === aggregationTypes.NONE">
|
||
|
|
<div class="tb-form-panel-title">{{ 'aggregation.limit' | translate }}</div>
|
||
|
|
<div class="limit-slider-container" fxLayout="row" fxLayoutAlign="start center"
|
||
|
|
fxLayout.xs="column" fxLayoutAlign.xs="stretch">
|
||
|
|
<div fxLayout="row" fxLayoutAlign="start center" fxFlex>
|
||
|
|
<mat-slider fxFlex
|
||
|
|
min="{{minDatapointsLimit()}}"
|
||
|
|
max="{{maxDatapointsLimit()}}">
|
||
|
|
<input matSliderThumb formControlName="limit"/>
|
||
|
|
</mat-slider>
|
||
|
|
<mat-form-field class="limit-slider-value" subscriptSizing="dynamic" appearance="outline">
|
||
|
|
<input matInput formControlName="limit" type="number" step="1"
|
||
|
|
[value]="timewindowForm.get('aggregation.limit').value"
|
||
|
|
min="{{minDatapointsLimit()}}"
|
||
|
|
max="{{maxDatapointsLimit()}}"/>
|
||
|
|
</mat-form-field>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
</ng-container>
|
||
|
|
|
||
|
|
<section class="tb-form-panel stroked" [fxShow]="timewindowForm.get('aggregation.type').value !== aggregationTypes.NONE">
|
||
|
|
<div class="tb-form-panel-title">{{ 'aggregation.group-interval' | translate }}</div>
|
||
|
|
<ng-container formGroupName="realtime" *ngIf="timewindow.selectedTab === timewindowTypes.REALTIME">
|
||
|
|
<tb-timeinterval
|
||
|
|
formControlName="interval"
|
||
|
|
[min]="minRealtimeAggInterval()" [max]="maxRealtimeAggInterval()"
|
||
|
|
useCalendarIntervals
|
||
|
|
subscriptSizing="dynamic"
|
||
|
|
appearance="outline">
|
||
|
|
</tb-timeinterval>
|
||
|
|
</ng-container>
|
||
|
|
<ng-container formGroupName="history" *ngIf="timewindow.selectedTab === timewindowTypes.HISTORY">
|
||
|
|
<tb-timeinterval
|
||
|
|
formControlName="interval"
|
||
|
|
[min]="minHistoryAggInterval()" [max]="maxHistoryAggInterval()"
|
||
|
|
useCalendarIntervals
|
||
|
|
subscriptSizing="dynamic"
|
||
|
|
appearance="outline">
|
||
|
|
</tb-timeinterval>
|
||
|
|
</ng-container>
|
||
|
|
</section>
|
||
|
|
</div>
|
||
|
|
</ng-template>
|
||
|
|
<ng-template #timezoneSelection>
|
||
|
|
<tb-timezone asButton strokedButton noMargin
|
||
|
|
localBrowserTimezonePlaceholderOnEmpty="true"
|
||
|
|
formControlName="timezone">
|
||
|
|
</tb-timezone>
|
||
|
|
</ng-template>
|
||
|
|
</form>
|
||
|
|
<mat-divider></mat-divider>
|
||
|
|
<div mat-dialog-actions class="tb-dialog-actions tb-flex flex-end no-gap">
|
||
|
|
<button type="button"
|
||
|
|
mat-button
|
||
|
|
[disabled]="(isLoading$ | async)"
|
||
|
|
(click)="cancel()">
|
||
|
|
{{ 'action.cancel' | translate }}
|
||
|
|
</button>
|
||
|
|
<button type="button"
|
||
|
|
mat-raised-button
|
||
|
|
color="primary"
|
||
|
|
(click)="update()"
|
||
|
|
[disabled]="(isLoading$ | async) || timewindowForm.invalid || !timewindowForm.dirty">
|
||
|
|
{{ 'action.apply' | translate }}
|
||
|
|
</button>
|
||
|
|
</div>
|