2019-10-31 10:06:57 +02:00
|
|
|
<!--
|
|
|
|
|
|
2024-01-09 10:46:16 +02:00
|
|
|
Copyright © 2016-2024 The Thingsboard Authors
|
2019-10-31 10:06:57 +02: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-07-21 18:26:14 +03:00
|
|
|
<form class="tb-add-widget-dialog" [formGroup]="widgetFormGroup">
|
2020-04-21 11:53:26 +03:00
|
|
|
<mat-toolbar color="primary">
|
2023-08-01 19:58:59 +03:00
|
|
|
<div class="tb-add-widget-toolbar">
|
2023-08-03 19:26:35 +03:00
|
|
|
<h2>{{'widget.add' | translate}}:</h2>
|
|
|
|
|
<span fxFlex>{{data.widgetInfo.widgetName}}</span>
|
|
|
|
|
<div fxLayout="row" fxLayoutAlign="start center" fxLayoutGap.gt-xs="16px" style="min-width: fit-content;">
|
2023-08-17 18:50:32 +03:00
|
|
|
<tb-toggle-select *ngIf="widgetConfig.hasBasicMode" appearance="fill-invert" selectMediaBreakpoint="xs"
|
2023-08-01 19:58:59 +03:00
|
|
|
[(ngModel)]="widgetConfigMode" [ngModelOptions]="{standalone: true}">
|
|
|
|
|
<tb-toggle-option value="basic">{{ 'widget.basic-mode' | translate }}</tb-toggle-option>
|
|
|
|
|
<tb-toggle-option value="advanced">{{ 'widget.advanced-mode' | translate }}</tb-toggle-option>
|
|
|
|
|
</tb-toggle-select>
|
|
|
|
|
<div [tb-help]="helpLinkIdForWidgetType()"></div>
|
|
|
|
|
</div>
|
2023-05-25 17:03:52 +03:00
|
|
|
</div>
|
2020-04-21 11:53:26 +03:00
|
|
|
<button mat-icon-button
|
2019-10-31 10:06:57 +02:00
|
|
|
(click)="cancel()"
|
|
|
|
|
type="button">
|
|
|
|
|
<mat-icon class="material-icons">close</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
</mat-toolbar>
|
2023-07-21 18:26:14 +03:00
|
|
|
<div mat-dialog-content>
|
2023-08-17 18:50:32 +03:00
|
|
|
<tb-widget-config
|
|
|
|
|
#widgetConfigComponent
|
|
|
|
|
class="tb-absolute-fill"
|
2023-07-21 18:26:14 +03:00
|
|
|
[aliasController]="aliasController"
|
|
|
|
|
[functionsOnly]="false"
|
|
|
|
|
[dashboard]="dashboard"
|
|
|
|
|
[widget]="widget"
|
2023-08-17 18:50:32 +03:00
|
|
|
[hideHeader]="hideHeader"
|
2023-07-21 18:26:14 +03:00
|
|
|
isAdd
|
|
|
|
|
formControlName="widgetConfig">
|
|
|
|
|
</tb-widget-config>
|
|
|
|
|
<tb-widget-preview *ngIf="previewMode" class="tb-absolute-fill"
|
|
|
|
|
[aliasController]="aliasController"
|
|
|
|
|
[stateController]="stateController"
|
|
|
|
|
[dashboardTimewindow]="dashboard.configuration.timewindow"
|
|
|
|
|
[widget]="widget"
|
|
|
|
|
[widgetConfig]="widgetFormGroup.get('widgetConfig').value.config"
|
|
|
|
|
[previewWidth]="widgetConfig.typeParameters.previewWidth"
|
|
|
|
|
[previewHeight]="widgetConfig.typeParameters.previewHeight">
|
|
|
|
|
<div class="tb-preview-panel-content">
|
|
|
|
|
<button mat-button
|
|
|
|
|
(click)="previewMode = false">
|
|
|
|
|
<mat-icon>chevron_left</mat-icon>
|
|
|
|
|
{{ 'action.back' | translate }}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</tb-widget-preview>
|
2019-10-31 10:06:57 +02:00
|
|
|
</div>
|
2023-05-16 20:00:53 +03:00
|
|
|
<div mat-dialog-actions fxLayoutAlign="space-between center">
|
2019-10-31 10:06:57 +02:00
|
|
|
<button mat-button color="primary"
|
|
|
|
|
type="button"
|
2020-04-21 11:53:26 +03:00
|
|
|
(click)="cancel()"
|
|
|
|
|
cdkFocusInitial>
|
2019-10-31 10:06:57 +02:00
|
|
|
{{ 'action.cancel' | translate }}
|
|
|
|
|
</button>
|
2023-05-16 20:00:53 +03:00
|
|
|
<div fxLayout="row" fxLayoutGap="8px">
|
|
|
|
|
<button *ngIf="!previewMode"
|
|
|
|
|
mat-button color="primary"
|
|
|
|
|
type="button"
|
2023-11-08 17:01:47 +02:00
|
|
|
[disabled]="!widgetFormGroup.valid"
|
2023-05-16 20:00:53 +03:00
|
|
|
(click)="previewMode = true"
|
|
|
|
|
cdkFocusInitial>
|
|
|
|
|
{{ 'widget-config.preview' | translate }}
|
|
|
|
|
</button>
|
|
|
|
|
<button mat-raised-button color="primary"
|
|
|
|
|
(click)="add()"
|
2023-11-08 17:01:47 +02:00
|
|
|
[disabled]="!widgetFormGroup.valid">
|
2023-05-16 20:00:53 +03:00
|
|
|
{{ 'action.add' | translate }}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2019-10-31 10:06:57 +02:00
|
|
|
</div>
|
|
|
|
|
</form>
|