128 lines
6.4 KiB
HTML
128 lines
6.4 KiB
HTML
|
|
<!--
|
||
|
|
|
||
|
|
Copyright © 2016-2019 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.
|
||
|
|
|
||
|
|
-->
|
||
|
|
<form [formGroup]="timewindowForm" (ngSubmit)="update()">
|
||
|
|
<fieldset [disabled]="(isLoading$ | async)">
|
||
|
|
<div class="mat-content" style="height: 100%;" fxFlex fxLayout="column">
|
||
|
|
<section fxLayout="column">
|
||
|
|
<mat-tab-group dynamicHeight [ngClass]="{'tb-headless': historyOnly}"
|
||
|
|
(selectedIndexChange)="timewindowForm.markAsDirty()" [(selectedIndex)]="timewindow.selectedTab">
|
||
|
|
<mat-tab label="{{ 'timewindow.realtime' | translate }}">
|
||
|
|
<div formGroupName="realtime" class="mat-content mat-padding" fxLayout="column">
|
||
|
|
<tb-timeinterval
|
||
|
|
formControlName="timewindowMs"
|
||
|
|
predefinedName="timewindow.last"
|
||
|
|
[required]="timewindow.selectedTab === timewindowTypes.REALTIME"
|
||
|
|
style="padding-top: 8px;"></tb-timeinterval>
|
||
|
|
</div>
|
||
|
|
</mat-tab>
|
||
|
|
<mat-tab label="{{ 'timewindow.history' | translate }}">
|
||
|
|
<div formGroupName="history" class="mat-content mat-padding" style="padding-top: 8px;">
|
||
|
|
<mat-radio-group formControlName="historyType">
|
||
|
|
<mat-radio-button [value]="historyTypes.LAST_INTERVAL" color="primary">
|
||
|
|
<section fxLayout="column">
|
||
|
|
<tb-timeinterval
|
||
|
|
formControlName="timewindowMs"
|
||
|
|
predefinedName="timewindow.last"
|
||
|
|
[fxShow]="timewindowForm.get('history').get('historyType').value === historyTypes.LAST_INTERVAL"
|
||
|
|
[required]="timewindow.selectedTab === timewindowTypes.HISTORY &&
|
||
|
|
timewindowForm.get('history').get('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"
|
||
|
|
[fxShow]="timewindowForm.get('history').get('historyType').value === historyTypes.FIXED"
|
||
|
|
[required]="timewindow.selectedTab === timewindowTypes.HISTORY &&
|
||
|
|
timewindowForm.get('history').get('historyType').value === historyTypes.FIXED"
|
||
|
|
style="padding-top: 8px;"></tb-datetime-period>
|
||
|
|
</section>
|
||
|
|
</mat-radio-button>
|
||
|
|
</mat-radio-group>
|
||
|
|
</div>
|
||
|
|
</mat-tab>
|
||
|
|
</mat-tab-group>
|
||
|
|
<div *ngIf="aggregation" formGroupName="aggregation" class="mat-content mat-padding" fxLayout="column">
|
||
|
|
<mat-form-field>
|
||
|
|
<mat-label translate>aggregation.function</mat-label>
|
||
|
|
<mat-select matInput formControlName="type" style="min-width: 150px;">
|
||
|
|
<mat-option *ngFor="let aggregation of aggregations" [value]="aggregation">
|
||
|
|
{{ aggregationTypesTranslations.get(aggregation) | translate }}
|
||
|
|
</mat-option>
|
||
|
|
</mat-select>
|
||
|
|
</mat-form-field>
|
||
|
|
<div *ngIf="timewindowForm.get('aggregation').get('type').value === aggregationTypes.NONE"
|
||
|
|
class="limit-slider-container"
|
||
|
|
fxLayout="row" fxLayoutAlign="start center">
|
||
|
|
<span translate>aggregation.limit</span>
|
||
|
|
<mat-slider fxFlex formControlName="limit"
|
||
|
|
thumbLabel
|
||
|
|
[value]="timewindowForm.get('aggregation').get('limit').value"
|
||
|
|
min="{{minDatapointsLimit()}}"
|
||
|
|
max="{{maxDatapointsLimit()}}">
|
||
|
|
</mat-slider>
|
||
|
|
<mat-form-field style="max-width: 80px;">
|
||
|
|
<input matInput formControlName="limit" type="number" step="1"
|
||
|
|
[value]="timewindowForm.get('aggregation').get('limit').value"
|
||
|
|
min="{{minDatapointsLimit()}}"
|
||
|
|
max="{{maxDatapointsLimit()}}"/>
|
||
|
|
</mat-form-field>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div formGroupName="realtime"
|
||
|
|
*ngIf="aggregation && timewindowForm.get('aggregation').get('type').value !== aggregationTypes.NONE &&
|
||
|
|
timewindow.selectedTab === timewindowTypes.REALTIME" class="mat-content mat-padding" fxLayout="column">
|
||
|
|
<tb-timeinterval
|
||
|
|
formControlName="interval"
|
||
|
|
[min]="minRealtimeAggInterval()" [max]="maxRealtimeAggInterval()"
|
||
|
|
predefinedName="aggregation.group-interval">
|
||
|
|
</tb-timeinterval>
|
||
|
|
</div>
|
||
|
|
<div formGroupName="history"
|
||
|
|
*ngIf="aggregation && timewindowForm.get('aggregation').get('type').value !== aggregationTypes.NONE &&
|
||
|
|
timewindow.selectedTab === timewindowTypes.HISTORY" class="mat-content mat-padding" fxLayout="column">
|
||
|
|
<tb-timeinterval
|
||
|
|
formControlName="interval"
|
||
|
|
[min]="minHistoryAggInterval()" [max]="maxHistoryAggInterval()"
|
||
|
|
predefinedName="aggregation.group-interval">
|
||
|
|
</tb-timeinterval>
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
<span fxFlex></span>
|
||
|
|
<div fxLayout="row" class="tb-panel-actions">
|
||
|
|
<span fxFlex></span>
|
||
|
|
<button type="submit"
|
||
|
|
mat-raised-button
|
||
|
|
color="primary"
|
||
|
|
[disabled]="(isLoading$ | async) || timewindowForm.invalid || !timewindowForm.dirty">
|
||
|
|
{{ 'action.update' | translate }}
|
||
|
|
</button>
|
||
|
|
<button type="button"
|
||
|
|
mat-button
|
||
|
|
[disabled]="(isLoading$ | async)"
|
||
|
|
(click)="cancel()"
|
||
|
|
style="margin-right: 20px;">
|
||
|
|
{{ 'action.cancel' | translate }}
|
||
|
|
</button>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</fieldset>
|
||
|
|
</form>
|