|
|
@ -1,5 +1,6 @@ |
|
|
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
|
|
|
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
|
|
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
|
|
|
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'; |
|
|
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'; |
|
|
import { PageComponent } from '@shared/components/page.component'; |
|
|
import { PageComponent } from '@shared/components/page.component'; |
|
|
import { Store } from '@ngrx/store'; |
|
|
import { Store } from '@ngrx/store'; |
|
|
@ -7,7 +8,7 @@ import { AppState } from '@core/core.state'; |
|
|
import { MatDialog } from '@angular/material/dialog'; |
|
|
import { MatDialog } from '@angular/material/dialog'; |
|
|
import { Dashboard, WidgetLayout } from '@shared/models/dashboard.models'; |
|
|
import { Dashboard, WidgetLayout } from '@shared/models/dashboard.models'; |
|
|
import { IAliasController, IStateController } from '@core/api/widget-api.models'; |
|
|
import { IAliasController, IStateController } from '@core/api/widget-api.models'; |
|
|
import { Widget, WidgetConfigMode } from '@shared/models/widget.models'; |
|
|
import { Widget, widgetActionSources, WidgetConfigMode } from '@shared/models/widget.models'; |
|
|
import { WidgetComponentService } from '@home/components/widget/widget-component.service'; |
|
|
import { WidgetComponentService } from '@home/components/widget/widget-component.service'; |
|
|
import { WidgetConfigComponentData } from '../../models/widget-component.models'; |
|
|
import { WidgetConfigComponentData } from '../../models/widget-component.models'; |
|
|
import { isDefined, isDefinedAndNotNull } from '@core/utils'; |
|
|
import { isDefined, isDefinedAndNotNull } from '@core/utils'; |
|
|
@ -53,6 +54,10 @@ export class EditWidgetComponent extends PageComponent implements OnInit, OnChan |
|
|
@coerceBoolean() |
|
|
@coerceBoolean() |
|
|
isDefaultBreakpoint= true; |
|
|
isDefaultBreakpoint= true; |
|
|
|
|
|
|
|
|
|
|
|
@Input() |
|
|
|
|
|
@coerceBoolean() |
|
|
|
|
|
isHtmlPage = false; |
|
|
|
|
|
|
|
|
@Output() |
|
|
@Output() |
|
|
applyWidgetConfig = new EventEmitter<void>(); |
|
|
applyWidgetConfig = new EventEmitter<void>(); |
|
|
|
|
|
|
|
|
@ -94,7 +99,7 @@ export class EditWidgetComponent extends PageComponent implements OnInit, OnChan |
|
|
for (const propName of Object.keys(changes)) { |
|
|
for (const propName of Object.keys(changes)) { |
|
|
const change = changes[propName]; |
|
|
const change = changes[propName]; |
|
|
if (!change.firstChange && change.currentValue !== change.previousValue) { |
|
|
if (!change.firstChange && change.currentValue !== change.previousValue) { |
|
|
if (['widget', 'widgetLayout'].includes(propName)) { |
|
|
if (['widget', 'widgetLayout', 'isHtmlPage'].includes(propName)) { |
|
|
reloadConfig = true; |
|
|
reloadConfig = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -135,7 +140,10 @@ export class EditWidgetComponent extends PageComponent implements OnInit, OnChan |
|
|
widgetInfo.typeLatestDataKeySettingsForm : (widgetInfo.latestDataKeySettingsForm || []); |
|
|
widgetInfo.typeLatestDataKeySettingsForm : (widgetInfo.latestDataKeySettingsForm || []); |
|
|
const typeParameters = widgetInfo.typeParameters; |
|
|
const typeParameters = widgetInfo.typeParameters; |
|
|
const dataKeySettingsFunction: DataKeySettingsFunction = typeParameters?.dataKeySettingsFunction; |
|
|
const dataKeySettingsFunction: DataKeySettingsFunction = typeParameters?.dataKeySettingsFunction; |
|
|
const actionSources = widgetInfo.actionSources; |
|
|
const actionSources = {...widgetInfo.actionSources}; |
|
|
|
|
|
if (this.isHtmlPage) { |
|
|
|
|
|
delete actionSources[widgetActionSources.headerButton.value]; |
|
|
|
|
|
} |
|
|
const isDataEnabled = isDefined(widgetInfo.typeParameters) ? !widgetInfo.typeParameters.useCustomDatasources : true; |
|
|
const isDataEnabled = isDefined(widgetInfo.typeParameters) ? !widgetInfo.typeParameters.useCustomDatasources : true; |
|
|
|
|
|
|
|
|
this.widgetConfig = { |
|
|
this.widgetConfig = { |
|
|
|