2023-05-19 17:54:27 +03:00
|
|
|
<!--
|
|
|
|
|
|
2024-01-09 10:46:16 +02:00
|
|
|
Copyright © 2016-2024 The Thingsboard Authors
|
2023-05-19 17:54:27 +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.
|
|
|
|
|
|
|
|
|
|
-->
|
|
|
|
|
<section class="tb-datasource-section" [formGroup]="datasourceFormGroup">
|
2023-05-30 12:37:47 +03:00
|
|
|
<mat-form-field *ngIf="!basicMode" class="tb-datasource-type" hideRequiredMarker>
|
2023-05-19 17:54:27 +03:00
|
|
|
<mat-label translate>widget-config.datasource-type</mat-label>
|
|
|
|
|
<mat-select formControlName="type">
|
|
|
|
|
<mat-option *ngFor="let datasourceType of datasourceTypes" [value]="datasourceType">
|
|
|
|
|
{{ datasourceTypesTranslations.get(datasourceType) | translate }}
|
|
|
|
|
</mat-option>
|
|
|
|
|
</mat-select>
|
|
|
|
|
</mat-form-field>
|
2023-05-30 12:37:47 +03:00
|
|
|
<section fxLayout="column" [ngSwitch]="datasourceFormGroup.get('type').value">
|
2023-05-19 17:54:27 +03:00
|
|
|
<ng-template [ngSwitchCase]="datasourceType.function">
|
2023-09-14 18:45:22 +03:00
|
|
|
<mat-form-field *ngIf="!hideDatasourceLabel" fxFlex>
|
2023-05-19 17:54:27 +03:00
|
|
|
<mat-label translate>datasource.label</mat-label>
|
|
|
|
|
<input matInput
|
|
|
|
|
formControlName="name">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</ng-template>
|
2023-05-25 17:03:52 +03:00
|
|
|
<ng-template [ngSwitchCase]="datasourceFormGroup.get('type').value === datasourceType.device ||
|
|
|
|
|
datasourceFormGroup.get('type').value === datasourceType.entity ||
|
|
|
|
|
datasourceFormGroup.get('type').value === datasourceType.entityCount ||
|
|
|
|
|
datasourceFormGroup.get('type').value === datasourceType.alarmCount ? datasourceFormGroup.get('type').value : ''">
|
2023-05-19 17:54:27 +03:00
|
|
|
<tb-alarm-filter-config *ngIf="datasourceFormGroup.get('type').value === datasourceType.alarmCount"
|
|
|
|
|
propagatedFilter="false"
|
2023-07-05 18:19:22 +03:00
|
|
|
[initialAlarmFilterConfig]="{ statusList: [alarmSearchStatus.ACTIVE] }"
|
2023-05-19 17:54:27 +03:00
|
|
|
style="height: 56px; margin-bottom: 22px;"
|
|
|
|
|
formControlName="alarmFilterConfig"></tb-alarm-filter-config>
|
2023-05-25 17:03:52 +03:00
|
|
|
<tb-entity-autocomplete *ngIf="datasourceFormGroup.get('type').value === datasourceType.device"
|
2024-02-01 19:16:37 +02:00
|
|
|
[required]="!datasourcesOptional"
|
2023-05-25 17:03:52 +03:00
|
|
|
[entityType]="entityType.DEVICE"
|
|
|
|
|
formControlName="deviceId">
|
|
|
|
|
</tb-entity-autocomplete>
|
2023-05-19 17:54:27 +03:00
|
|
|
<tb-entity-alias-select
|
2023-05-25 17:03:52 +03:00
|
|
|
*ngIf="datasourceFormGroup.get('type').value !== datasourceType.device && datasourceFormGroup.get('type').value !== datasourceType.alarmCount"
|
2023-05-19 17:54:27 +03:00
|
|
|
[showLabel]="true"
|
2024-02-01 19:16:37 +02:00
|
|
|
[tbRequired]="!datasourcesOptional"
|
2023-05-19 17:54:27 +03:00
|
|
|
[aliasController]="aliasController"
|
|
|
|
|
formControlName="entityAliasId"
|
|
|
|
|
[callbacks]="entityAliasSelectCallbacks">
|
|
|
|
|
</tb-entity-alias-select>
|
2023-09-14 18:45:22 +03:00
|
|
|
<mat-form-field *ngIf="!hideDatasourceLabel && [datasourceType.entityCount, datasourceType.alarmCount].includes(datasourceFormGroup.get('type').value)"
|
2023-05-19 17:54:27 +03:00
|
|
|
fxFlex>
|
|
|
|
|
<input matInput
|
|
|
|
|
placeholder="{{ 'datasource.label' | translate }}"
|
|
|
|
|
formControlName="name">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</ng-template>
|
|
|
|
|
</section>
|
2023-06-05 19:52:34 +03:00
|
|
|
<section *ngIf="!hideDataKeys" fxLayout="column" fxLayoutAlign="stretch" fxFlex>
|
2023-05-19 17:54:27 +03:00
|
|
|
<tb-data-keys class="tb-data-keys" fxFlex
|
|
|
|
|
[widgetType]="widgetType"
|
|
|
|
|
[datasourceType]="datasourceFormGroup.get('type').value"
|
|
|
|
|
[maxDataKeys]="maxDataKeys"
|
|
|
|
|
[optDataKeys]="isDataKeysOptional(datasourceFormGroup.get('type').value)"
|
|
|
|
|
[simpleDataKeysLabel]="!hasAdditionalLatestDataKeys"
|
|
|
|
|
[aliasController]="aliasController"
|
|
|
|
|
[datakeySettingsSchema]="dataKeySettingsSchema"
|
|
|
|
|
[dataKeySettingsDirective]="dataKeySettingsDirective"
|
2024-03-01 19:58:00 +02:00
|
|
|
[datakeySettingsFunction]="dataKeySettingsFunction"
|
2023-05-19 17:54:27 +03:00
|
|
|
[dashboard]="dashboard"
|
|
|
|
|
[widget]="widget"
|
|
|
|
|
[callbacks]="dataKeysCallbacks"
|
|
|
|
|
[entityAliasId]="datasourceFormGroup.get('entityAliasId').value"
|
2023-05-25 17:03:52 +03:00
|
|
|
[deviceId]="datasourceFormGroup.get('deviceId').value"
|
2023-05-19 17:54:27 +03:00
|
|
|
formControlName="dataKeys">
|
|
|
|
|
</tb-data-keys>
|
|
|
|
|
<tb-data-keys *ngIf="hasAdditionalLatestDataKeys" class="tb-data-keys" fxFlex
|
|
|
|
|
[widgetType]="widgetTypes.latest"
|
|
|
|
|
[datasourceType]="datasourceFormGroup.get('type').value"
|
2024-03-01 19:58:00 +02:00
|
|
|
latestDataKeys
|
2023-05-19 17:54:27 +03:00
|
|
|
[optDataKeys]="true"
|
|
|
|
|
[aliasController]="aliasController"
|
|
|
|
|
[datakeySettingsSchema]="latestDataKeySettingsSchema"
|
|
|
|
|
[dataKeySettingsDirective]="latestDataKeySettingsDirective"
|
2024-03-01 19:58:00 +02:00
|
|
|
[datakeySettingsFunction]="dataKeySettingsFunction"
|
2023-05-19 17:54:27 +03:00
|
|
|
[dashboard]="dashboard"
|
|
|
|
|
[widget]="widget"
|
|
|
|
|
[callbacks]="dataKeysCallbacks"
|
|
|
|
|
[entityAliasId]="datasourceFormGroup.get('entityAliasId').value"
|
2023-05-25 17:03:52 +03:00
|
|
|
[deviceId]="datasourceFormGroup.get('deviceId').value"
|
2023-05-19 17:54:27 +03:00
|
|
|
formControlName="latestDataKeys">
|
|
|
|
|
</tb-data-keys>
|
|
|
|
|
</section>
|
2023-05-30 12:37:47 +03:00
|
|
|
<tb-filter-select
|
2023-09-14 18:45:22 +03:00
|
|
|
*ngIf="(!basicMode || displayDatasourceFilterForBasicMode) && ![datasourceType.function, datasourceType.alarmCount].includes(datasourceFormGroup.get('type').value)"
|
2023-05-30 12:37:47 +03:00
|
|
|
[showLabel]="true"
|
|
|
|
|
[aliasController]="aliasController"
|
|
|
|
|
formControlName="filterId"
|
|
|
|
|
[callbacks]="filterSelectCallbacks">
|
|
|
|
|
</tb-filter-select>
|
2023-05-19 17:54:27 +03:00
|
|
|
</section>
|