2019-08-12 19:34:23 +03:00
|
|
|
<!--
|
|
|
|
|
|
2024-01-09 10:46:16 +02:00
|
|
|
Copyright © 2016-2024 The Thingsboard Authors
|
2019-08-12 19:34:23 +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.
|
|
|
|
|
|
|
|
|
|
-->
|
2023-03-10 12:55:53 +02:00
|
|
|
<form [formGroup]="timewindowForm" class="mat-content">
|
2024-06-28 18:29:47 +03:00
|
|
|
<mat-tab-group [class.tb-headless]="historyOnly"
|
2023-09-27 13:02:56 +03:00
|
|
|
(selectedTabChange)="onTimewindowTypeChange()" [(selectedIndex)]="timewindow.selectedTab">
|
2023-03-10 12:55:53 +02:00
|
|
|
<mat-tab label="{{ 'timewindow.realtime' | translate }}">
|
2024-06-14 19:01:39 +03:00
|
|
|
<div class="tb-flex column">
|
2024-07-18 17:59:04 +03:00
|
|
|
<section class="tb-form-panel stroked"
|
|
|
|
|
*ngIf="isEdit || !(timewindow.hideInterval || (timewindow.hideLastInterval && timewindow.hideQuickInterval))">
|
2024-06-14 19:01:39 +03:00
|
|
|
<div class="tb-form-panel-title">{{ 'timewindow.time-range' | translate }}</div>
|
|
|
|
|
<div class="tb-flex align-center space-between">
|
|
|
|
|
<ng-container formGroupName="realtime">
|
2024-06-28 18:29:47 +03:00
|
|
|
<tb-toggle-select *ngIf="!quickIntervalOnly || isEdit || (!timewindow.hideLastInterval && !timewindow.hideQuickInterval)"
|
2024-06-14 19:01:39 +03:00
|
|
|
appearance="fill" [options]="realtimeTimewindowOptions" formControlName="realtimeType"
|
|
|
|
|
style="max-width: 100%">
|
|
|
|
|
</tb-toggle-select>
|
|
|
|
|
</ng-container>
|
|
|
|
|
|
2024-06-28 18:29:47 +03:00
|
|
|
<ng-container *ngTemplateOutlet="timezoneSelection">
|
|
|
|
|
</ng-container>
|
2023-03-10 12:55:53 +02:00
|
|
|
</div>
|
2024-06-14 19:01:39 +03:00
|
|
|
|
|
|
|
|
<ng-container formGroupName="realtime">
|
2024-06-28 18:29:47 +03:00
|
|
|
<ng-container *ngIf="timewindowForm.get('realtime.realtimeType').value === realtimeTypes.LAST_INTERVAL">
|
2024-06-14 19:01:39 +03:00
|
|
|
<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>
|
|
|
|
|
|
2024-06-28 18:29:47 +03:00
|
|
|
<ng-container *ngIf="timewindowForm.get('realtime.realtimeType').value === realtimeTypes.INTERVAL">
|
2024-06-14 19:01:39 +03:00
|
|
|
<tb-quick-time-interval
|
2024-06-28 18:29:47 +03:00
|
|
|
displayLabel="false"
|
2024-06-14 19:01:39 +03:00
|
|
|
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>
|
2024-07-18 17:59:04 +03:00
|
|
|
<ng-container *ngIf="!isEdit && (timewindow.hideInterval || (timewindow.hideLastInterval && timewindow.hideQuickInterval))">
|
2024-07-18 12:22:46 +03:00
|
|
|
<ng-container *ngTemplateOutlet="timezoneSelection">
|
|
|
|
|
</ng-container>
|
|
|
|
|
</ng-container>
|
2024-06-14 19:01:39 +03:00
|
|
|
<ng-container *ngTemplateOutlet="aggregationConfig">
|
|
|
|
|
</ng-container>
|
|
|
|
|
</div>
|
2023-03-10 12:55:53 +02:00
|
|
|
</mat-tab>
|
|
|
|
|
<mat-tab label="{{ 'timewindow.history' | translate }}">
|
2024-06-28 18:29:47 +03:00
|
|
|
<div class="tb-flex column">
|
2024-07-18 12:22:46 +03:00
|
|
|
<section class="tb-form-panel stroked" *ngIf="isEdit || !timewindow.hideInterval">
|
2024-06-28 18:29:47 +03:00
|
|
|
<div class="tb-form-panel-title">{{ 'timewindow.time-range' | translate }}</div>
|
|
|
|
|
<div class="tb-flex align-center space-between">
|
|
|
|
|
<ng-container formGroupName="history">
|
|
|
|
|
<tb-toggle-select appearance="fill" [options]="historyTimewindowOptions" formControlName="historyType"
|
|
|
|
|
style="max-width: 100%">
|
|
|
|
|
</tb-toggle-select>
|
|
|
|
|
</ng-container>
|
|
|
|
|
|
|
|
|
|
<ng-container *ngTemplateOutlet="timezoneSelection">
|
|
|
|
|
</ng-container>
|
2023-03-10 12:55:53 +02:00
|
|
|
</div>
|
2024-06-28 18:29:47 +03:00
|
|
|
|
|
|
|
|
<ng-container formGroupName="history" *ngIf="isEdit || !timewindow.hideInterval &&
|
|
|
|
|
timewindowForm.get('history.historyType').value !== historyTypes.FOR_ALL_TIME">
|
|
|
|
|
<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"
|
|
|
|
|
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>
|
2023-03-10 12:55:53 +02:00
|
|
|
</section>
|
2024-07-18 12:22:46 +03:00
|
|
|
<ng-container *ngIf="!isEdit && timewindow.hideInterval">
|
|
|
|
|
<ng-container *ngTemplateOutlet="timezoneSelection">
|
|
|
|
|
</ng-container>
|
|
|
|
|
</ng-container>
|
2024-06-28 18:29:47 +03:00
|
|
|
<ng-container *ngTemplateOutlet="aggregationConfig">
|
|
|
|
|
</ng-container>
|
|
|
|
|
</div>
|
2023-03-10 12:55:53 +02:00
|
|
|
</mat-tab>
|
|
|
|
|
</mat-tab-group>
|
2024-06-14 19:01:39 +03:00
|
|
|
<ng-template #aggregationConfig>
|
2024-06-28 18:29:47 +03:00
|
|
|
<div *ngIf="aggregation" class="tb-flex column">
|
|
|
|
|
<ng-container formGroupName="aggregation">
|
|
|
|
|
<section class="tb-form-panel stroked" *ngIf="isEdit || !timewindow.hideAggregation">
|
|
|
|
|
<div class="tb-form-panel-title">{{ 'aggregation.aggregation' | translate }}</div>
|
|
|
|
|
<mat-form-field subscriptSizing="dynamic" appearance="outline">
|
|
|
|
|
<mat-select formControlName="type" style="min-width: 150px;">
|
|
|
|
|
<mat-option *ngFor="let aggregation of aggregations" [value]="aggregation">
|
|
|
|
|
{{ aggregationTypesTranslations.get(aggregationTypes[aggregation]) | translate }}
|
|
|
|
|
</mat-option>
|
|
|
|
|
</mat-select>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</section>
|
2024-06-14 19:01:39 +03:00
|
|
|
|
2024-06-28 18:29:47 +03:00
|
|
|
<section class="tb-form-panel stroked"
|
|
|
|
|
*ngIf="timewindowForm.get('aggregation.type').value === aggregationTypes.NONE && (isEdit || !timewindow.hideAggInterval)">
|
|
|
|
|
<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
|
|
|
|
|
discrete
|
|
|
|
|
showTickMarks
|
|
|
|
|
step="{{datapointsLimitSliderStep()}}"
|
|
|
|
|
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>
|
2023-03-10 12:55:53 +02:00
|
|
|
</div>
|
2024-06-28 18:29:47 +03:00
|
|
|
</section>
|
|
|
|
|
</ng-container>
|
|
|
|
|
|
2024-07-18 12:22:46 +03:00
|
|
|
<section class="tb-form-panel stroked" *ngIf="(isEdit || !timewindow.hideAggInterval)
|
2024-06-28 18:29:47 +03:00
|
|
|
&& 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>
|
2023-03-10 12:55:53 +02:00
|
|
|
</section>
|
2019-08-12 19:34:23 +03:00
|
|
|
</div>
|
2023-03-10 12:55:53 +02:00
|
|
|
</ng-template>
|
2024-06-28 18:29:47 +03:00
|
|
|
<ng-template #timezoneSelection>
|
|
|
|
|
<ng-container *ngIf="timezone && (isEdit || !timewindow.hideTimezone)">
|
2024-07-18 17:59:04 +03:00
|
|
|
<tb-timezone asButton strokedButton displayTimezoneValue="false" formControlName="timezone"></tb-timezone>
|
2024-06-28 18:29:47 +03:00
|
|
|
</ng-container>
|
|
|
|
|
</ng-template>
|
2019-08-12 19:34:23 +03:00
|
|
|
</form>
|
2024-06-28 18:29:47 +03:00
|
|
|
<mat-divider></mat-divider>
|
2023-03-10 12:55:53 +02:00
|
|
|
<div fxLayout="row" class="tb-panel-actions" fxLayoutAlign="end center">
|
|
|
|
|
<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.update' | translate }}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|