2019-09-25 19:37:29 +03:00
|
|
|
<!--
|
|
|
|
|
|
2023-01-31 10:43:56 +02:00
|
|
|
Copyright © 2016-2023 The Thingsboard Authors
|
2019-09-25 19:37:29 +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-05-16 20:00:53 +03:00
|
|
|
<div class="tb-widget-config tb-absolute-fill">
|
2023-05-25 17:03:52 +03:00
|
|
|
<div class="tb-widget-config-header" *ngIf="!hideHeader">
|
|
|
|
|
<tb-toggle-header *ngIf="!hideToggleHeader && widgetConfigMode === widgetConfigModes.advanced" (valueChange)="selectedOption = $event" ignoreMdLgSize="true"
|
2023-05-16 20:00:53 +03:00
|
|
|
appearance="fill" [options]="headerOptions" [value]="selectedOption" name="widgetConfigHeader" useSelectOnMdLg="false">
|
|
|
|
|
</tb-toggle-header>
|
2023-05-25 17:03:52 +03:00
|
|
|
<ng-content select=".tb-widget-config-header-prefix"></ng-content>
|
2023-05-16 20:00:53 +03:00
|
|
|
<ng-content select=".tb-widget-config-header-suffix"></ng-content>
|
|
|
|
|
</div>
|
2023-05-25 17:03:52 +03:00
|
|
|
<div *ngIf="widgetConfigMode === widgetConfigModes.advanced; else basicMode" class="tb-widget-config-content">
|
|
|
|
|
<div *ngIf="widgetType !== widgetTypes.static" [fxShow]="selectedOption === 'data'" class="mat-content">
|
|
|
|
|
<ng-container *ngTemplateOutlet="data"></ng-container>
|
2021-10-28 11:21:03 +03:00
|
|
|
</div>
|
2023-05-19 17:54:27 +03:00
|
|
|
<div [fxShow]="selectedOption === 'appearance'" class="mat-content">
|
2023-05-25 17:03:52 +03:00
|
|
|
<ng-container *ngTemplateOutlet="appearance"></ng-container>
|
2023-05-16 20:00:53 +03:00
|
|
|
</div>
|
2023-05-19 17:54:27 +03:00
|
|
|
<div [fxShow]="selectedOption === 'card'" [formGroup]="widgetSettings" class="mat-content">
|
|
|
|
|
<div class="tb-widget-config-panel">
|
|
|
|
|
<div class="tb-widget-config-panel-title" translate>widget-config.card-title</div>
|
2023-05-16 20:00:53 +03:00
|
|
|
<mat-slide-toggle class="mat-slide" formControlName="showTitle">
|
|
|
|
|
{{ 'widget-config.display-title' | translate }}
|
|
|
|
|
</mat-slide-toggle>
|
|
|
|
|
<div fxLayout.xs="column" fxLayout="row" fxLayoutGap.gt-xs="8px">
|
|
|
|
|
<mat-form-field fxFlex>
|
|
|
|
|
<mat-label translate>widget-config.title</mat-label>
|
|
|
|
|
<input matInput formControlName="title">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<mat-form-field fxFlex>
|
|
|
|
|
<mat-label translate>widget-config.title-tooltip</mat-label>
|
|
|
|
|
<input matInput formControlName="titleTooltip">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
2023-05-19 17:54:27 +03:00
|
|
|
<div class="tb-widget-config-row space-between same-padding">
|
2023-05-16 20:00:53 +03:00
|
|
|
<mat-slide-toggle class="mat-slide" formControlName="showTitleIcon">
|
|
|
|
|
{{ 'widget-config.display-icon' | translate }}
|
2021-10-27 13:33:51 +03:00
|
|
|
</mat-slide-toggle>
|
2023-05-19 17:54:27 +03:00
|
|
|
<div fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="16px">
|
|
|
|
|
<tb-material-icon-select asBoxInput
|
|
|
|
|
[color]="widgetSettings.get('iconColor').value"
|
|
|
|
|
formControlName="titleIcon">
|
2023-05-16 20:00:53 +03:00
|
|
|
</tb-material-icon-select>
|
2023-05-19 17:54:27 +03:00
|
|
|
<mat-form-field appearance="outline" subscriptSizing="dynamic" style="width: 60px;">
|
2023-05-16 20:00:53 +03:00
|
|
|
<input matInput formControlName="iconSize">
|
2020-04-21 11:53:26 +03:00
|
|
|
</mat-form-field>
|
2023-05-19 17:54:27 +03:00
|
|
|
<mat-divider vertical></mat-divider>
|
|
|
|
|
<tb-color-input asBoxInput
|
|
|
|
|
formControlName="iconColor">
|
|
|
|
|
</tb-color-input>
|
2020-04-21 11:53:26 +03:00
|
|
|
</div>
|
2023-05-19 17:54:27 +03:00
|
|
|
</div>
|
2023-05-16 20:00:53 +03:00
|
|
|
<mat-expansion-panel class="tb-settings">
|
2023-05-19 17:54:27 +03:00
|
|
|
<mat-expansion-panel-header expandedHeight="48px">
|
|
|
|
|
<mat-panel-description fxLayoutAlign="start" translate>
|
|
|
|
|
widget-config.advanced-title-style
|
2023-05-16 20:00:53 +03:00
|
|
|
</mat-panel-description>
|
|
|
|
|
</mat-expansion-panel-header>
|
|
|
|
|
<ng-template matExpansionPanelContent>
|
|
|
|
|
<tb-json-object-edit
|
|
|
|
|
[editorStyle]="{minHeight: '100px'}"
|
|
|
|
|
required
|
|
|
|
|
label="{{ 'widget-config.title-style' | translate }}"
|
|
|
|
|
formControlName="titleStyle"
|
|
|
|
|
></tb-json-object-edit>
|
|
|
|
|
</ng-template>
|
|
|
|
|
</mat-expansion-panel>
|
2023-05-19 17:54:27 +03:00
|
|
|
</div>
|
|
|
|
|
<div class="tb-widget-config-panel">
|
|
|
|
|
<div class="tb-widget-config-panel-title" translate>widget-config.card-style</div>
|
|
|
|
|
<div class="tb-widget-config-row space-between same-padding">
|
|
|
|
|
<div>{{ 'widget-config.text' | translate }}</div>
|
|
|
|
|
<div fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="16px">
|
|
|
|
|
<mat-divider vertical></mat-divider>
|
|
|
|
|
<tb-color-input asBoxInput
|
2023-05-16 20:00:53 +03:00
|
|
|
formControlName="color">
|
|
|
|
|
</tb-color-input>
|
2020-04-21 11:53:26 +03:00
|
|
|
</div>
|
2023-05-19 17:54:27 +03:00
|
|
|
</div>
|
|
|
|
|
<div class="tb-widget-config-row space-between same-padding">
|
|
|
|
|
<div>{{ 'widget-config.background' | translate }}</div>
|
|
|
|
|
<div fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="16px">
|
|
|
|
|
<mat-divider vertical></mat-divider>
|
|
|
|
|
<tb-color-input asBoxInput
|
|
|
|
|
formControlName="backgroundColor">
|
|
|
|
|
</tb-color-input>
|
2023-05-16 20:00:53 +03:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-05-19 17:54:27 +03:00
|
|
|
<div class="tb-widget-config-row space-between">
|
|
|
|
|
<div>{{ 'widget-config.padding' | translate }}</div>
|
|
|
|
|
<mat-form-field appearance="outline" class="center" subscriptSizing="dynamic">
|
|
|
|
|
<input matInput formControlName="padding" placeholder="{{ 'widget-config.set' | translate }}">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tb-widget-config-row space-between">
|
|
|
|
|
<div>{{ 'widget-config.margin' | translate }}</div>
|
|
|
|
|
<mat-form-field appearance="outline" class="center" subscriptSizing="dynamic">
|
|
|
|
|
<input matInput formControlName="margin" placeholder="{{ 'widget-config.set' | translate }}">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
<mat-slide-toggle class="mat-slide slide-block" formControlName="dropShadow">
|
2023-05-16 20:00:53 +03:00
|
|
|
{{ 'widget-config.drop-shadow' | translate }}
|
|
|
|
|
</mat-slide-toggle>
|
|
|
|
|
<mat-expansion-panel class="tb-settings">
|
|
|
|
|
<mat-expansion-panel-header>
|
2023-05-19 17:54:27 +03:00
|
|
|
<mat-panel-description fxLayoutAlign="start" translate>
|
|
|
|
|
widget-config.advanced-widget-style
|
2023-05-16 20:00:53 +03:00
|
|
|
</mat-panel-description>
|
|
|
|
|
</mat-expansion-panel-header>
|
|
|
|
|
<ng-template matExpansionPanelContent>
|
|
|
|
|
<tb-json-object-edit
|
|
|
|
|
[editorStyle]="{minHeight: '100px'}"
|
|
|
|
|
required
|
|
|
|
|
label="{{ 'widget-config.widget-style' | translate }}"
|
|
|
|
|
formControlName="widgetStyle"
|
|
|
|
|
></tb-json-object-edit>
|
|
|
|
|
<tb-css
|
|
|
|
|
label="{{ 'widget-config.widget-css' | translate }}"
|
|
|
|
|
formControlName="widgetCss"
|
|
|
|
|
></tb-css>
|
|
|
|
|
</ng-template>
|
|
|
|
|
</mat-expansion-panel>
|
2023-05-19 17:54:27 +03:00
|
|
|
</div>
|
|
|
|
|
<div class="tb-widget-config-panel">
|
|
|
|
|
<div class="tb-widget-config-panel-title" translate>widget-config.card-buttons</div>
|
|
|
|
|
<mat-slide-toggle class="mat-slide slide-block" formControlName="enableFullscreen">
|
|
|
|
|
{{ 'widget-config.enable-fullscreen' | translate }}
|
|
|
|
|
</mat-slide-toggle>
|
|
|
|
|
</div>
|
2019-09-25 19:37:29 +03:00
|
|
|
</div>
|
2023-05-19 17:54:27 +03:00
|
|
|
<div [fxShow]="selectedOption === 'actions'" [formGroup]="actionsSettings" class="mat-content" style="height: 100%;">
|
2023-05-25 17:03:52 +03:00
|
|
|
<div class="tb-widget-config-panel" style="height: 100%;">
|
|
|
|
|
<tb-manage-widget-actions
|
|
|
|
|
[callbacks]="widgetConfigCallbacks"
|
|
|
|
|
[widgetType] = "modelValue.widgetType"
|
2023-05-30 12:37:47 +03:00
|
|
|
[actionSources]="modelValue.actionSources"
|
|
|
|
|
formControlName="actions">
|
2023-05-25 17:03:52 +03:00
|
|
|
</tb-manage-widget-actions>
|
|
|
|
|
</div>
|
2019-10-21 19:57:18 +03:00
|
|
|
</div>
|
2023-05-19 17:54:27 +03:00
|
|
|
<div [fxShow]="selectedOption === 'mobile'" [formGroup]="layoutSettings" class="mat-content">
|
|
|
|
|
<div class="tb-widget-config-panel">
|
|
|
|
|
<mat-slide-toggle class="mat-slide" formControlName="mobileHide">
|
|
|
|
|
{{ 'widget-config.mobile-hide' | translate }}
|
|
|
|
|
</mat-slide-toggle>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tb-widget-config-panel">
|
|
|
|
|
<mat-slide-toggle class="mat-slide" formControlName="desktopHide">
|
|
|
|
|
{{ 'widget-config.desktop-hide' | translate }}
|
|
|
|
|
</mat-slide-toggle>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tb-widget-config-panel">
|
|
|
|
|
<div class="tb-widget-config-row space-between">
|
|
|
|
|
<div translate>widget-config.order</div>
|
|
|
|
|
<mat-form-field appearance="outline" class="number center" subscriptSizing="dynamic">
|
|
|
|
|
<input matInput formControlName="mobileOrder" type="number" step="1" placeholder="{{ 'widget-config.set' | translate }}">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tb-widget-config-row space-between">
|
|
|
|
|
<div translate>widget-config.height</div>
|
|
|
|
|
<mat-form-field appearance="outline" class="number center" subscriptSizing="dynamic">
|
|
|
|
|
<input matInput formControlName="mobileHeight" type="number" min="1" step="1" placeholder="{{ 'widget-config.set' | translate }}">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
2023-05-16 20:00:53 +03:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-05-25 17:03:52 +03:00
|
|
|
<ng-template #basicMode>
|
|
|
|
|
<div class="tb-widget-config-content">
|
2023-05-30 12:37:47 +03:00
|
|
|
<div class="mat-content" *ngIf="hasBasicModeDirective; else basicModeContent">
|
|
|
|
|
<ng-container #basicModeContainer></ng-container>
|
|
|
|
|
<div class="tb-basic-mode-directive-error" *ngIf="basicModeDirectiveError">{{basicModeDirectiveError}}</div>
|
2023-05-25 17:03:52 +03:00
|
|
|
</div>
|
2023-05-30 12:37:47 +03:00
|
|
|
<ng-template #basicModeContent>
|
|
|
|
|
<div class="mat-content">
|
|
|
|
|
<ng-container *ngTemplateOutlet="data"></ng-container>
|
|
|
|
|
<ng-container *ngTemplateOutlet="appearance"></ng-container>
|
|
|
|
|
<ng-container [formGroup]="actionsSettings">
|
|
|
|
|
<tb-widget-actions-panel
|
|
|
|
|
formControlName="actions">
|
|
|
|
|
</tb-widget-actions-panel>
|
|
|
|
|
</ng-container>
|
|
|
|
|
</div>
|
|
|
|
|
</ng-template>
|
2023-05-25 17:03:52 +03:00
|
|
|
</div>
|
|
|
|
|
</ng-template>
|
|
|
|
|
<ng-template #data>
|
|
|
|
|
<div *ngIf="displayTimewindowConfig" [formGroup]="dataSettings" class="tb-widget-config-panel">
|
|
|
|
|
<div fxLayout="row" fxLayoutAlign="space-between center">
|
|
|
|
|
<div class="tb-widget-config-panel-title" translate>timewindow.timewindow</div>
|
|
|
|
|
<tb-toggle-header (valueChange)="dataSettings.get('useDashboardTimewindow').patchValue($event)" ignoreMdLgSize="true"
|
|
|
|
|
[options]="[
|
|
|
|
|
{ name: translate.instant('widget-config.use-dashboard-timewindow'), value: true},
|
|
|
|
|
{ name: translate.instant('widget-config.use-widget-timewindow'), value: false}
|
|
|
|
|
]"
|
|
|
|
|
[value]="dataSettings.get('useDashboardTimewindow').value" name="useDashboardTimewindow" useSelectOnMdLg="false">
|
|
|
|
|
</tb-toggle-header>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tb-widget-config-row">
|
|
|
|
|
<tb-timewindow asButton="true"
|
|
|
|
|
strokedButton
|
|
|
|
|
isEdit="true"
|
|
|
|
|
alwaysDisplayTypePrefix
|
|
|
|
|
[historyOnly]="onlyHistoryTimewindow()"
|
|
|
|
|
quickIntervalOnly="{{ widgetType === widgetTypes.latest }}"
|
|
|
|
|
aggregation="{{ widgetType === widgetTypes.timeseries }}"
|
|
|
|
|
formControlName="timewindow"></tb-timewindow>
|
|
|
|
|
<mat-slide-toggle class="mat-slide" formControlName="displayTimewindow">
|
|
|
|
|
{{ 'widget-config.display-timewindow' | translate }}
|
|
|
|
|
</mat-slide-toggle>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div *ngIf="widgetType === widgetTypes.alarm" [formGroup]="dataSettings" class="tb-widget-config-panel" fxLayout="column" fxLayoutAlign="center">
|
|
|
|
|
<tb-alarm-filter-config buttonMode="false" formControlName="alarmFilterConfig"></tb-alarm-filter-config>
|
|
|
|
|
</div>
|
|
|
|
|
<div *ngIf="widgetType !== widgetTypes.rpc &&
|
|
|
|
|
widgetType !== widgetTypes.alarm &&
|
|
|
|
|
modelValue?.isDataEnabled"
|
|
|
|
|
[formGroup]="dataSettings">
|
|
|
|
|
<tb-datasources
|
2023-05-30 12:37:47 +03:00
|
|
|
[configMode]="widgetConfigMode"
|
2023-05-25 17:03:52 +03:00
|
|
|
formControlName="datasources">
|
|
|
|
|
</tb-datasources>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tb-widget-config-panel" *ngIf="widgetType === widgetTypes.rpc &&
|
|
|
|
|
modelValue?.isDataEnabled">
|
|
|
|
|
<div class="tb-widget-config-panel-title" translate>widget-config.target-device</div>
|
|
|
|
|
<div [formGroup]="targetDeviceSettings">
|
|
|
|
|
<tb-entity-alias-select fxFlex
|
|
|
|
|
[tbRequired]="!widgetEditMode"
|
|
|
|
|
[aliasController]="aliasController"
|
|
|
|
|
[allowedEntityTypes]="[entityTypes.DEVICE]"
|
|
|
|
|
[callbacks]="widgetConfigCallbacks"
|
|
|
|
|
formControlName="targetDeviceAliasId">
|
|
|
|
|
</tb-entity-alias-select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div *ngIf="widgetType === widgetTypes.alarm && modelValue?.isDataEnabled"
|
|
|
|
|
[formGroup]="dataSettings" class="tb-widget-config-panel" >
|
|
|
|
|
<div class="tb-widget-config-panel-title" translate>widget-config.alarm-source</div>
|
|
|
|
|
<tb-datasource
|
|
|
|
|
formControlName="alarmSource">
|
|
|
|
|
</tb-datasource>
|
|
|
|
|
</div>
|
|
|
|
|
<div *ngIf="displayLimits" class="tb-widget-config-panel" [formGroup]="widgetSettings">
|
|
|
|
|
<div class="tb-widget-config-panel-title" translate>widget-config.limits</div>
|
|
|
|
|
<div class="tb-widget-config-row space-between">
|
|
|
|
|
<div translate>widget-config.data-page-size</div>
|
|
|
|
|
<mat-form-field appearance="outline" class="center number" subscriptSizing="dynamic">
|
|
|
|
|
<input matInput formControlName="pageSize" type="number" min="1" step="1">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</ng-template>
|
|
|
|
|
<ng-template #appearance>
|
|
|
|
|
<div *ngIf="displayAppearanceDataSettings" class="tb-widget-config-panel" [formGroup]="widgetSettings">
|
|
|
|
|
<div class="tb-widget-config-panel-title" translate>widget-config.data-settings</div>
|
|
|
|
|
<div *ngIf="displayUnitsConfig" class="tb-widget-config-row space-between">
|
|
|
|
|
<div translate>widget-config.units</div>
|
|
|
|
|
<mat-form-field appearance="outline" class="center" subscriptSizing="dynamic">
|
|
|
|
|
<input matInput formControlName="units" placeholder="{{ 'widget-config.set' | translate }}">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
<div *ngIf="displayUnitsConfig" class="tb-widget-config-row space-between">
|
|
|
|
|
<div translate>widget-config.decimals</div>
|
|
|
|
|
<mat-form-field appearance="outline" class="center number" subscriptSizing="dynamic">
|
|
|
|
|
<input matInput formControlName="decimals" type="number" min="0" max="15" step="1" placeholder="{{ 'widget-config.set' | translate }}">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
<div *ngIf="displayNoDataDisplayMessageConfig" class="tb-widget-config-row">
|
|
|
|
|
<div translate>widget-config.no-data-display-message</div>
|
|
|
|
|
<mat-form-field fxFlex appearance="outline" subscriptSizing="dynamic">
|
|
|
|
|
<input matInput formControlName="noDataDisplayMessage" placeholder="{{ 'widget-config.set-message' | translate }}">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div *ngIf="displayAdvancedAppearance" style="height: 100%;" [formGroup]="advancedSettings">
|
|
|
|
|
<tb-widget-settings
|
|
|
|
|
[aliasController]="aliasController"
|
|
|
|
|
[dashboard]="dashboard"
|
|
|
|
|
[widget]="widget"
|
|
|
|
|
formControlName="settings">
|
|
|
|
|
</tb-widget-settings>
|
|
|
|
|
</div>
|
|
|
|
|
</ng-template>
|
2023-05-16 20:00:53 +03:00
|
|
|
</div>
|
|
|
|
|
|