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">
|
|
|
|
|
<mat-tab-group [ngClass]="{'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">
|
|
|
|
|
<section class="tb-form-panel stroked" [fxShow]="isEdit || !timewindow.hideInterval">
|
|
|
|
|
<div class="tb-form-panel-title">{{ 'timewindow.time-range' | translate }}</div>
|
|
|
|
|
<div class="tb-flex align-center space-between">
|
|
|
|
|
<ng-container formGroupName="realtime">
|
|
|
|
|
<tb-toggle-select *ngIf="!quickIntervalOnly"
|
|
|
|
|
[fxShow]="isEdit || (!timewindow.hideLastInterval && !timewindow.hideQuickInterval)"
|
|
|
|
|
appearance="fill" [options]="realtimeTimewindowOptions" formControlName="realtimeType"
|
|
|
|
|
style="max-width: 100%">
|
|
|
|
|
</tb-toggle-select>
|
|
|
|
|
</ng-container>
|
|
|
|
|
|
|
|
|
|
<tb-timezone-select fxFlex [fxShow]="!timewindow.hideTimezone"
|
|
|
|
|
localBrowserTimezonePlaceholderOnEmpty="true"
|
|
|
|
|
formControlName="timezone"
|
|
|
|
|
subscriptSizing="dynamic"
|
|
|
|
|
appearance="outline">
|
|
|
|
|
</tb-timezone-select>
|
2023-03-10 12:55:53 +02:00
|
|
|
</div>
|
2024-06-14 19:01:39 +03:00
|
|
|
|
|
|
|
|
<ng-container formGroupName="realtime">
|
|
|
|
|
<ng-container *ngIf="isEdit || !timewindow.hideLastInterval &&
|
|
|
|
|
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="!timewindow.hideQuickInterval &&
|
|
|
|
|
timewindowForm.get('realtime.realtimeType').value === realtimeTypes.INTERVAL">
|
|
|
|
|
<tb-quick-time-interval
|
|
|
|
|
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>
|
2023-03-10 12:55:53 +02:00
|
|
|
</mat-tab>
|
|
|
|
|
<mat-tab label="{{ 'timewindow.history' | translate }}">
|
|
|
|
|
<section fxLayout="row">
|
|
|
|
|
<section *ngIf="isEdit" fxLayout="column" fxLayoutAlign="start center"
|
|
|
|
|
style="padding-top: 8px; padding-left: 16px;">
|
|
|
|
|
<label class="tb-small hide-label" translate>timewindow.hide</label>
|
|
|
|
|
<mat-checkbox [ngModelOptions]="{standalone: true}" [(ngModel)]="timewindow.hideInterval"
|
|
|
|
|
(ngModelChange)="onHideIntervalChanged()"></mat-checkbox>
|
|
|
|
|
</section>
|
|
|
|
|
<section fxLayout="column" fxFlex [fxShow]="isEdit || !timewindow.hideInterval">
|
|
|
|
|
<div formGroupName="history" class="mat-content mat-padding" style="padding-top: 8px;">
|
|
|
|
|
<mat-radio-group formControlName="historyType">
|
2023-04-21 18:00:56 +03:00
|
|
|
<mat-radio-button *ngIf="forAllTimeEnabled" [value]="historyTypes.FOR_ALL_TIME" color="primary">
|
|
|
|
|
<section fxLayout="column">
|
|
|
|
|
<span translate>timewindow.for-all-time</span>
|
|
|
|
|
</section>
|
|
|
|
|
</mat-radio-button>
|
2023-03-10 12:55:53 +02:00
|
|
|
<mat-radio-button [value]="historyTypes.LAST_INTERVAL" color="primary">
|
|
|
|
|
<section fxLayout="column">
|
|
|
|
|
<span translate>timewindow.last</span>
|
|
|
|
|
<tb-timeinterval
|
|
|
|
|
formControlName="timewindowMs"
|
|
|
|
|
predefinedName="timewindow.last"
|
|
|
|
|
class="history-time-input"
|
2024-06-14 19:01:39 +03:00
|
|
|
subscriptSizing="dynamic"
|
|
|
|
|
appearance="outline"
|
2023-03-10 12:55:53 +02:00
|
|
|
[fxShow]="timewindowForm.get('history.historyType').value === historyTypes.LAST_INTERVAL"
|
|
|
|
|
[required]="timewindow.selectedTab === timewindowTypes.HISTORY &&
|
|
|
|
|
timewindowForm.get('history.historyType').value === historyTypes.LAST_INTERVAL"
|
|
|
|
|
style="padding-top: 8px;"></tb-timeinterval>
|
|
|
|
|
</section>
|
|
|
|
|
</mat-radio-button>
|
|
|
|
|
<mat-radio-button [value]="historyTypes.FIXED" color="primary">
|
|
|
|
|
<section fxLayout="column">
|
|
|
|
|
<span translate>timewindow.time-period</span>
|
|
|
|
|
<tb-datetime-period
|
|
|
|
|
formControlName="fixedTimewindow"
|
|
|
|
|
class="history-time-input"
|
|
|
|
|
[fxShow]="timewindowForm.get('history.historyType').value === historyTypes.FIXED"
|
|
|
|
|
[required]="timewindow.selectedTab === timewindowTypes.HISTORY &&
|
|
|
|
|
timewindowForm.get('history.historyType').value === historyTypes.FIXED"
|
|
|
|
|
style="padding-top: 8px;"></tb-datetime-period>
|
|
|
|
|
</section>
|
|
|
|
|
</mat-radio-button>
|
|
|
|
|
<mat-radio-button [value]="historyTypes.INTERVAL" color="primary">
|
|
|
|
|
<section fxLayout="column">
|
|
|
|
|
<span translate>timewindow.interval</span>
|
|
|
|
|
<tb-quick-time-interval
|
|
|
|
|
formControlName="quickInterval"
|
|
|
|
|
class="history-time-input"
|
2024-06-14 19:01:39 +03:00
|
|
|
subscriptSizing="dynamic"
|
|
|
|
|
appearance="outline"
|
2023-03-10 12:55:53 +02:00
|
|
|
[fxShow]="timewindowForm.get('history.historyType').value === historyTypes.INTERVAL"
|
|
|
|
|
[required]="timewindow.selectedTab === timewindowTypes.HISTORY &&
|
|
|
|
|
timewindowForm.get('history.historyType').value === historyTypes.INTERVAL"
|
|
|
|
|
style="padding-top: 8px"></tb-quick-time-interval>
|
|
|
|
|
</section>
|
|
|
|
|
</mat-radio-button>
|
|
|
|
|
</mat-radio-group>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
</section>
|
2024-06-14 19:01:39 +03:00
|
|
|
<ng-container *ngTemplateOutlet="aggregationConfig">
|
2023-03-10 12:55:53 +02:00
|
|
|
</ng-container>
|
|
|
|
|
</mat-tab>
|
|
|
|
|
</mat-tab-group>
|
2024-06-14 19:01:39 +03:00
|
|
|
<ng-template #aggregationConfig>
|
|
|
|
|
<div *ngIf="aggregation" formGroupName="aggregation" class="tb-flex column">
|
|
|
|
|
<section class="tb-form-panel stroked" [fxShow]="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>
|
2023-03-10 12:55:53 +02:00
|
|
|
</section>
|
2024-06-14 19:01:39 +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
|
|
|
|
|
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>
|
2023-03-10 12:55:53 +02:00
|
|
|
</div>
|
2024-06-14 19:01:39 +03:00
|
|
|
</div>
|
2023-03-10 12:55:53 +02:00
|
|
|
</section>
|
|
|
|
|
</div>
|
|
|
|
|
<div formGroupName="realtime"
|
|
|
|
|
*ngIf="aggregation && timewindowForm.get('aggregation.type').value !== aggregationTypes.NONE &&
|
|
|
|
|
timewindow.selectedTab === timewindowTypes.REALTIME" class="mat-content mat-padding" fxLayout="column">
|
|
|
|
|
<tb-timeinterval
|
|
|
|
|
formControlName="interval"
|
|
|
|
|
[isEdit]="isEdit"
|
|
|
|
|
[(hideFlag)]="timewindow.hideAggInterval"
|
|
|
|
|
(hideFlagChange)="onHideAggIntervalChanged()"
|
|
|
|
|
[min]="minRealtimeAggInterval()" [max]="maxRealtimeAggInterval()"
|
2024-01-12 15:04:05 +02:00
|
|
|
useCalendarIntervals
|
2024-06-14 19:01:39 +03:00
|
|
|
subscriptSizing="dynamic"
|
|
|
|
|
appearance="outline"
|
2023-03-10 12:55:53 +02:00
|
|
|
predefinedName="aggregation.group-interval">
|
|
|
|
|
</tb-timeinterval>
|
|
|
|
|
</div>
|
|
|
|
|
<div formGroupName="history"
|
|
|
|
|
*ngIf="aggregation && timewindowForm.get('aggregation.type').value !== aggregationTypes.NONE &&
|
|
|
|
|
timewindow.selectedTab === timewindowTypes.HISTORY" class="mat-content mat-padding" fxLayout="column">
|
|
|
|
|
<tb-timeinterval
|
|
|
|
|
formControlName="interval"
|
|
|
|
|
[isEdit]="isEdit"
|
|
|
|
|
[(hideFlag)]="timewindow.hideAggInterval"
|
|
|
|
|
(hideFlagChange)="onHideAggIntervalChanged()"
|
|
|
|
|
[min]="minHistoryAggInterval()" [max]="maxHistoryAggInterval()"
|
2024-01-12 15:04:05 +02:00
|
|
|
useCalendarIntervals
|
2024-06-14 19:01:39 +03:00
|
|
|
subscriptSizing="dynamic"
|
|
|
|
|
appearance="outline"
|
2023-03-10 12:55:53 +02:00
|
|
|
predefinedName="aggregation.group-interval">
|
|
|
|
|
</tb-timeinterval>
|
|
|
|
|
</div>
|
|
|
|
|
<div *ngIf="timezone" class="mat-content mat-padding" fxLayout="row">
|
|
|
|
|
<section fxLayout="column" fxLayoutAlign="start center" [fxShow]="isEdit">
|
|
|
|
|
<label class="tb-small hide-label" translate>timewindow.hide</label>
|
|
|
|
|
<mat-checkbox [ngModelOptions]="{standalone: true}" [(ngModel)]="timewindow.hideTimezone"
|
|
|
|
|
(ngModelChange)="onHideTimezoneChanged()"></mat-checkbox>
|
|
|
|
|
</section>
|
2024-06-14 19:01:39 +03:00
|
|
|
<!-- <tb-timezone-select fxFlex [fxShow]="isEdit || !timewindow.hideTimezone"-->
|
|
|
|
|
<!-- localBrowserTimezonePlaceholderOnEmpty="true"-->
|
|
|
|
|
<!-- formControlName="timezone"-->
|
|
|
|
|
<!-- appearance="outline">-->
|
|
|
|
|
<!-- </tb-timezone-select>-->
|
2019-08-12 19:34:23 +03:00
|
|
|
</div>
|
2023-03-10 12:55:53 +02:00
|
|
|
</ng-template>
|
2019-08-12 19:34:23 +03:00
|
|
|
</form>
|
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>
|