diff --git a/ui-ngx/src/app/modules/common/modules-map.ts b/ui-ngx/src/app/modules/common/modules-map.ts
index 8d64384ab0..b3a14b0f61 100644
--- a/ui-ngx/src/app/modules/common/modules-map.ts
+++ b/ui-ngx/src/app/modules/common/modules-map.ts
@@ -206,9 +206,9 @@ import * as EntityAliasDialogComponent from '@home/components/alias/entity-alias
import * as EntityFilterComponent from '@home/components/entity/entity-filter.component';
import * as RelationFiltersComponent from '@home/components/relation/relation-filters.component';
import * as EntityAliasSelectComponent from '@home/components/alias/entity-alias-select.component';
-import * as DataKeysComponent from '@home/components/widget/data-keys.component';
-import * as DataKeyConfigDialogComponent from '@home/components/widget/data-key-config-dialog.component';
-import * as DataKeyConfigComponent from '@home/components/widget/data-key-config.component';
+import * as DataKeysComponent from '@home/components/widget/config/data-keys.component';
+import * as DataKeyConfigDialogComponent from '@home/components/widget/config/data-key-config-dialog.component';
+import * as DataKeyConfigComponent from '@home/components/widget/config/data-key-config.component';
import * as LegendConfigComponent from '@home/components/widget/lib/settings/common/legend-config.component';
import * as ManageWidgetActionsComponent from '@home/components/widget/action/manage-widget-actions.component';
import * as WidgetActionDialogComponent from '@home/components/widget/action/widget-action-dialog.component';
@@ -501,9 +501,9 @@ class ModulesMap implements IModulesMap {
'@home/components/entity/entity-filter.component': EntityFilterComponent,
'@home/components/relation/relation-filters.component': RelationFiltersComponent,
'@home/components/alias/entity-alias-select.component': EntityAliasSelectComponent,
- '@home/components/widget/data-keys.component': DataKeysComponent,
- '@home/components/widget/data-key-config-dialog.component': DataKeyConfigDialogComponent,
- '@home/components/widget/data-key-config.component': DataKeyConfigComponent,
+ '@home/components/widget/config/data-keys.component': DataKeysComponent,
+ '@home/components/widget/config/data-key-config-dialog.component': DataKeyConfigDialogComponent,
+ '@home/components/widget/config/data-key-config.component': DataKeyConfigComponent,
'@home/components/widget/lib/settings/common/legend-config.component': LegendConfigComponent,
'@home/components/widget/action/manage-widget-actions.component': ManageWidgetActionsComponent,
'@home/components/widget/action/widget-action-dialog.component': WidgetActionDialogComponent,
diff --git a/ui-ngx/src/app/modules/home/components/home-components.module.ts b/ui-ngx/src/app/modules/home/components/home-components.module.ts
index a2d18dfa34..a6e2cc03dc 100644
--- a/ui-ngx/src/app/modules/home/components/home-components.module.ts
+++ b/ui-ngx/src/app/modules/home/components/home-components.module.ts
@@ -170,14 +170,13 @@ import { AlarmAssigneePanelComponent } from '@home/components/alarm/alarm-assign
import { RouterTabsComponent } from '@home/components/router-tabs.component';
import { SendNotificationButtonComponent } from '@home/components/notification/send-notification-button.component';
import { AlarmAssigneeSelectPanelComponent } from '@home/components/alarm/alarm-assignee-select-panel.component';
-import { AlarmAssigneeSelectComponent } from '@home/components/alarm/alarm-assignee-select.component';
import { DeviceInfoFilterComponent } from '@home/components/device/device-info-filter.component';
import { WidgetPreviewComponent } from '@home/components/widget/widget-preview.component';
import {
ManageWidgetActionsDialogComponent
} from '@home/components/widget/action/manage-widget-actions-dialog.component';
-import { WidgetConfigComponentsModule } from '@home/components/widget/widget-config-components.module';
-import { BasicWidgetConfigModule } from '@home/components/widget/basic-config/basic-widget-config.module';
+import { WidgetConfigComponentsModule } from '@home/components/widget/config/widget-config-components.module';
+import { BasicWidgetConfigModule } from '@home/components/widget/config/basic/basic-widget-config.module';
@NgModule({
declarations:
@@ -202,7 +201,6 @@ import { BasicWidgetConfigModule } from '@home/components/widget/basic-config/ba
AlarmTableHeaderComponent,
AlarmTableComponent,
AlarmAssigneePanelComponent,
- AlarmAssigneeSelectComponent,
AlarmAssigneeSelectPanelComponent,
AttributeTableComponent,
AddAttributeDialogComponent,
@@ -350,7 +348,6 @@ import { BasicWidgetConfigModule } from '@home/components/widget/basic-config/ba
RelationFiltersComponent,
AlarmTableComponent,
AlarmAssigneePanelComponent,
- AlarmAssigneeSelectComponent,
AlarmAssigneeSelectPanelComponent,
AttributeTableComponent,
AliasesEntitySelectComponent,
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/basic-widget-config.module.ts b/ui-ngx/src/app/modules/home/components/widget/config/basic/basic-widget-config.module.ts
index b6f8fba834..e7d0d58b13 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/basic/basic-widget-config.module.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/basic-widget-config.module.ts
@@ -17,14 +17,14 @@
import { NgModule, Type } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SharedModule } from '@shared/shared.module';
-import { IBasicWidgetConfigComponent } from '@home/components/widget/widget-config.component.models';
-import { WidgetConfigComponentsModule } from '@home/components/widget/widget-config-components.module';
+import { IBasicWidgetConfigComponent } from '@home/components/widget/config/widget-config.component.models';
+import { WidgetConfigComponentsModule } from '@home/components/widget/config/widget-config-components.module';
import {
SimpleCardBasicConfigComponent
-} from '@home/components/widget/basic-config/cards/simple-card-basic-config.component';
+} from '@home/components/widget/config/basic/cards/simple-card-basic-config.component';
import {
WidgetActionsPanelComponent
-} from '@home/components/widget/basic-config/common/widget-actions-panel.component';
+} from '@home/components/widget/config/basic/common/widget-actions-panel.component';
@NgModule({
declarations: [
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/simple-card-basic-config.component.html b/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/simple-card-basic-config.component.html
index 7ede72f4e4..28cd0aaa6e 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/simple-card-basic-config.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/simple-card-basic-config.component.html
@@ -51,9 +51,9 @@
widget-config.decimals-short
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/simple-card-basic-config.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/simple-card-basic-config.component.ts
index f27552f078..62d25249e9 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/simple-card-basic-config.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/simple-card-basic-config.component.ts
@@ -18,7 +18,7 @@ import { Component } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
-import { BasicWidgetConfigComponent } from '@home/components/widget/widget-config.component.models';
+import { BasicWidgetConfigComponent } from '@home/components/widget/config/widget-config.component.models';
import { WidgetConfigComponentData } from '@home/models/widget-component.models';
import {
Datasource,
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/common/widget-actions-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/basic/common/widget-actions-panel.component.ts
index 02d9787aa7..68dfca5858 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/basic/common/widget-actions-panel.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/common/widget-actions-panel.component.ts
@@ -15,16 +15,10 @@
///
import { ChangeDetectorRef, Component, forwardRef, Input, OnInit } from '@angular/core';
-import {
- ControlValueAccessor,
- NG_VALIDATORS,
- NG_VALUE_ACCESSOR,
- UntypedFormBuilder,
- UntypedFormGroup
-} from '@angular/forms';
+import { ControlValueAccessor, NG_VALUE_ACCESSOR, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { WidgetConfigComponent } from '@home/components/widget/widget-config.component';
import { WidgetActionsData } from '@home/components/widget/action/manage-widget-actions.component.models';
-import { Datasource, WidgetActionDescriptor } from '@shared/models/widget.models';
+import { WidgetActionDescriptor } from '@shared/models/widget.models';
import {
ManageWidgetActionsDialogComponent,
ManageWidgetActionsDialogData
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/data-key-config-dialog.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/data-key-config-dialog.component.ts
index 24aca1800e..d2bdd2f8a1 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/data-key-config-dialog.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/config/data-key-config-dialog.component.ts
@@ -24,7 +24,7 @@ import { Router } from '@angular/router';
import { DialogComponent } from '@shared/components/dialog.component';
import { DataKey, Widget, widgetType } from '@shared/models/widget.models';
import { DataKeysCallbacks } from './data-keys.component.models';
-import { DataKeyConfigComponent } from '@home/components/widget/data-key-config.component';
+import { DataKeyConfigComponent } from '@home/components/widget/config/data-key-config.component';
import { Dashboard } from '@shared/models/dashboard.models';
import { IAliasController } from '@core/api/widget-api.models';
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/data-key-config.component.scss b/ui-ngx/src/app/modules/home/components/widget/config/data-key-config.component.scss
index e5f6c02ef7..2ef3488e53 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/data-key-config.component.scss
+++ b/ui-ngx/src/app/modules/home/components/widget/config/data-key-config.component.scss
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-@import '../../../../../scss/constants';
+@import '../../../../../../scss/constants';
:host {
.tb-datakey-config {
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/data-key-config.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/data-key-config.component.ts
index c1e1911638..9d9201e88a 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/data-key-config.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/config/data-key-config.component.ts
@@ -40,7 +40,7 @@ import { UtilsService } from '@core/services/utils.service';
import { TranslateService } from '@ngx-translate/core';
import { MatDialog } from '@angular/material/dialog';
import { EntityService } from '@core/http/entity.service';
-import { DataKeysCallbacks } from '@home/components/widget/data-keys.component.models';
+import { DataKeysCallbacks } from '@home/components/widget/config/data-keys.component.models';
import { DataKeyType } from '@shared/models/telemetry/telemetry.models';
import { Observable, of } from 'rxjs';
import { map, mergeMap, publishReplay, refCount, tap } from 'rxjs/operators';
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/data-keys.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/data-keys.component.ts
index a4d11dc1de..95fe5bc444 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/data-keys.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/config/data-keys.component.ts
@@ -61,14 +61,14 @@ import { MatDialog } from '@angular/material/dialog';
import {
DataKeyConfigDialogComponent,
DataKeyConfigDialogData
-} from '@home/components/widget/data-key-config-dialog.component';
+} from '@home/components/widget/config/data-key-config-dialog.component';
import { deepClone, guid, isDefinedAndNotNull, isUndefined } from '@core/utils';
import { Dashboard } from '@shared/models/dashboard.models';
import { AggregationType } from '@shared/models/time/time.models';
import { DndDropEvent } from 'ngx-drag-drop/lib/dnd-dropzone.directive';
import { moveItemInArray } from '@angular/cdk/drag-drop';
import { coerceBoolean } from '@shared/decorators/coercion';
-import { DatasourceComponent } from '@home/components/widget/datasource.component';
+import { DatasourceComponent } from '@home/components/widget/config/datasource.component';
@Component({
selector: 'tb-data-keys',
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/datasource.component.models.ts b/ui-ngx/src/app/modules/home/components/widget/config/datasource.component.models.ts
index 208cdd7b47..0664058fb4 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/datasource.component.models.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/config/datasource.component.models.ts
@@ -16,6 +16,6 @@
import { EntityAliasSelectCallbacks } from '@home/components/alias/entity-alias-select.component.models';
import { FilterSelectCallbacks } from '@home/components/filter/filter-select.component.models';
-import { DataKeysCallbacks } from '@home/components/widget/data-keys.component.models';
+import { DataKeysCallbacks } from '@home/components/widget/config/data-keys.component.models';
export type DatasourceCallbacks = EntityAliasSelectCallbacks & FilterSelectCallbacks & DataKeysCallbacks;
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/datasource.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/datasource.component.ts
index a3e3fc7c26..6fca263c53 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/datasource.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/config/datasource.component.ts
@@ -39,9 +39,9 @@ import { WidgetConfigComponent } from '@home/components/widget/widget-config.com
import { IAliasController } from '@core/api/widget-api.models';
import { EntityAliasSelectCallbacks } from '@home/components/alias/entity-alias-select.component.models';
import { FilterSelectCallbacks } from '@home/components/filter/filter-select.component.models';
-import { DataKeysCallbacks } from '@home/components/widget/data-keys.component.models';
+import { DataKeysCallbacks } from '@home/components/widget/config/data-keys.component.models';
import { EntityType } from '@shared/models/entity-type.models';
-import { DatasourcesComponent } from '@home/components/widget/datasources.component';
+import { DatasourcesComponent } from '@home/components/widget/config/datasources.component';
@Component({
selector: 'tb-datasource',
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/datasources.component.scss b/ui-ngx/src/app/modules/home/components/widget/config/datasources.component.scss
index 8be2eeadbf..5b356afcf2 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/datasources.component.scss
+++ b/ui-ngx/src/app/modules/home/components/widget/config/datasources.component.scss
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-@import "../../../../../theme";
+@import "../../../../../../theme";
.tb-datasource-list-item {
&.mat-mdc-list-item {
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/datasources.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/datasources.component.ts
index dc62b0e25e..383b9e15ee 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/datasources.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/config/datasources.component.ts
@@ -39,14 +39,14 @@ import { CdkDragDrop } from '@angular/cdk/drag-drop';
import { deepClone } from '@core/utils';
import { DataKeyType } from '@shared/models/telemetry/telemetry.models';
import { UtilsService } from '@core/services/utils.service';
-import { DataKeysCallbacks } from '@home/components/widget/data-keys.component.models';
+import { DataKeysCallbacks } from '@home/components/widget/config/data-keys.component.models';
import { TranslateService } from '@ngx-translate/core';
import { coerceBoolean } from '@shared/decorators/coercion';
@Component({
selector: 'tb-datasources',
templateUrl: './datasources.component.html',
- styleUrls: ['./datasources.component.scss', 'widget-config.scss'],
+ styleUrls: ['./datasources.component.scss', './widget-config.scss'],
providers: [
{
provide: NG_VALUE_ACCESSOR,
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/timewindow-config-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/config/timewindow-config-panel.component.html
new file mode 100644
index 0000000000..985db7d942
--- /dev/null
+++ b/ui-ngx/src/app/modules/home/components/widget/config/timewindow-config-panel.component.html
@@ -0,0 +1,42 @@
+
+
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/timewindow-config-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/timewindow-config-panel.component.ts
new file mode 100644
index 0000000000..ec7e8d0854
--- /dev/null
+++ b/ui-ngx/src/app/modules/home/components/widget/config/timewindow-config-panel.component.ts
@@ -0,0 +1,115 @@
+///
+/// Copyright © 2016-2023 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.
+///
+
+import { Component, forwardRef, Input, OnInit } from '@angular/core';
+import { ControlValueAccessor, NG_VALUE_ACCESSOR, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
+import { WidgetConfigComponent } from '@home/components/widget/widget-config.component';
+import { widgetType } from '@shared/models/widget.models';
+import { Timewindow } from '@shared/models/time/time.models';
+import { TranslateService } from '@ngx-translate/core';
+import { coerceBoolean } from '@shared/decorators/coercion';
+
+export interface TimewindowConfigData {
+ useDashboardTimewindow: boolean;
+ displayTimewindow: boolean;
+ timewindow: Timewindow;
+}
+
+@Component({
+ selector: 'tb-timewindow-config-panel',
+ templateUrl: './timewindow-config-panel.component.html',
+ styleUrls: ['./widget-config.scss'],
+ providers: [
+ {
+ provide: NG_VALUE_ACCESSOR,
+ useExisting: forwardRef(() => TimewindowConfigPanelComponent),
+ multi: true
+ }
+ ]
+})
+export class TimewindowConfigPanelComponent implements ControlValueAccessor, OnInit {
+
+ widgetTypes = widgetType;
+
+ public get widgetType(): widgetType {
+ return this.widgetConfigComponent.widgetType;
+ }
+
+ @Input()
+ disabled: boolean;
+
+ @Input()
+ @coerceBoolean()
+ onlyHistoryTimewindow = false;
+
+
+ timewindowConfig: UntypedFormGroup;
+
+ private propagateChange = (_val: any) => {};
+
+ constructor(private fb: UntypedFormBuilder,
+ public translate: TranslateService,
+ private widgetConfigComponent: WidgetConfigComponent) {
+ }
+
+ ngOnInit() {
+ this.timewindowConfig = this.fb.group({
+ useDashboardTimewindow: [null, []],
+ displayTimewindow: [null, []],
+ timewindow: [null, []]
+ });
+ this.timewindowConfig.valueChanges.subscribe(
+ (val) => this.propagateChange(val)
+ );
+ this.timewindowConfig.get('useDashboardTimewindow').valueChanges.subscribe(() => {
+ this.updateTimewindowConfigEnabledState();
+ });
+ }
+
+ writeValue(data?: TimewindowConfigData): void {
+ this.timewindowConfig.patchValue(data || {}, {emitEvent: false});
+ this.updateTimewindowConfigEnabledState();
+ }
+
+ registerOnChange(fn: any): void {
+ this.propagateChange = fn;
+ }
+
+ registerOnTouched(fn: any): void {
+ }
+
+ setDisabledState(isDisabled: boolean): void {
+ this.disabled = isDisabled;
+ if (this.disabled) {
+ this.timewindowConfig.disable({emitEvent: false});
+ } else {
+ this.timewindowConfig.enable({emitEvent: false});
+ this.updateTimewindowConfigEnabledState();
+ }
+ }
+
+ private updateTimewindowConfigEnabledState() {
+ const useDashboardTimewindow: boolean = this.timewindowConfig.get('useDashboardTimewindow').value;
+ if (useDashboardTimewindow) {
+ this.timewindowConfig.get('displayTimewindow').disable({emitEvent: false});
+ this.timewindowConfig.get('timewindow').disable({emitEvent: false});
+ } else {
+ this.timewindowConfig.get('displayTimewindow').enable({emitEvent: false});
+ this.timewindowConfig.get('timewindow').enable({emitEvent: false});
+ }
+ }
+
+}
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/widget-config-components.module.ts b/ui-ngx/src/app/modules/home/components/widget/config/widget-config-components.module.ts
index c5a114d763..186a89537e 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/widget-config-components.module.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/config/widget-config-components.module.ts
@@ -19,16 +19,17 @@ import { CommonModule } from '@angular/common';
import { SharedModule } from '@app/shared/shared.module';
import { AlarmFilterConfigComponent } from '@home/components/alarm/alarm-filter-config.component';
import { AlarmAssigneeSelectComponent } from '@home/components/alarm/alarm-assignee-select.component';
-import { DataKeysComponent } from '@home/components/widget/data-keys.component';
-import { DataKeyConfigDialogComponent } from '@home/components/widget/data-key-config-dialog.component';
-import { DataKeyConfigComponent } from '@home/components/widget/data-key-config.component';
-import { DatasourceComponent } from '@home/components/widget/datasource.component';
-import { DatasourcesComponent } from '@home/components/widget/datasources.component';
+import { DataKeysComponent } from '@home/components/widget/config/data-keys.component';
+import { DataKeyConfigDialogComponent } from '@home/components/widget/config/data-key-config-dialog.component';
+import { DataKeyConfigComponent } from '@home/components/widget/config/data-key-config.component';
+import { DatasourceComponent } from '@home/components/widget/config/datasource.component';
+import { DatasourcesComponent } from '@home/components/widget/config/datasources.component';
import { EntityAliasSelectComponent } from '@home/components/alias/entity-alias-select.component';
import { FilterSelectComponent } from '@home/components/filter/filter-select.component';
import { WidgetSettingsModule } from '@home/components/widget/lib/settings/widget-settings.module';
-import { WidgetSettingsComponent } from '@home/components/widget/widget-settings.component';
-import { TimewindowConfigPanelComponent } from '@home/components/widget/timewindow-config-panel.component';
+import { WidgetSettingsComponent } from '@home/components/widget/config/widget-settings.component';
+import { TimewindowConfigPanelComponent } from '@home/components/widget/config/timewindow-config-panel.component';
+import { WidgetUnitsComponent } from '@home/components/widget/config/widget-units.component';
@NgModule({
declarations:
@@ -43,6 +44,7 @@ import { TimewindowConfigPanelComponent } from '@home/components/widget/timewind
EntityAliasSelectComponent,
FilterSelectComponent,
TimewindowConfigPanelComponent,
+ WidgetUnitsComponent,
WidgetSettingsComponent
],
imports: [
@@ -61,6 +63,7 @@ import { TimewindowConfigPanelComponent } from '@home/components/widget/timewind
EntityAliasSelectComponent,
FilterSelectComponent,
TimewindowConfigPanelComponent,
+ WidgetUnitsComponent,
WidgetSettingsComponent
]
})
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/widget-config.component.models.ts b/ui-ngx/src/app/modules/home/components/widget/config/widget-config.component.models.ts
index 3d9f60f1ad..39b3c2a741 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/widget-config.component.models.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/config/widget-config.component.models.ts
@@ -14,8 +14,8 @@
/// limitations under the License.
///
-import { WidgetActionCallbacks } from './action/manage-widget-actions.component.models';
-import { DatasourceCallbacks } from '@home/components/widget/datasource.component.models';
+import { WidgetActionCallbacks } from '@home/components/widget/action/manage-widget-actions.component.models';
+import { DatasourceCallbacks } from '@home/components/widget/config/datasource.component.models';
import { WidgetConfigComponentData } from '@home/models/widget-component.models';
import { Observable } from 'rxjs';
import { AfterViewInit, Directive, EventEmitter, Inject, OnInit } from '@angular/core';
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/widget-units.component.html b/ui-ngx/src/app/modules/home/components/widget/config/widget-units.component.html
new file mode 100644
index 0000000000..d573e65183
--- /dev/null
+++ b/ui-ngx/src/app/modules/home/components/widget/config/widget-units.component.html
@@ -0,0 +1,20 @@
+
+
+
+
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/widget-units.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/widget-units.component.ts
new file mode 100644
index 0000000000..4a1665b5b2
--- /dev/null
+++ b/ui-ngx/src/app/modules/home/components/widget/config/widget-units.component.ts
@@ -0,0 +1,67 @@
+///
+/// Copyright © 2016-2023 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.
+///
+
+import { Component, forwardRef, Input, OnInit } from '@angular/core';
+import { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR, UntypedFormBuilder } from '@angular/forms';
+
+@Component({
+ selector: 'tb-widget-units',
+ templateUrl: './widget-units.component.html',
+ styleUrls: ['./widget-config.scss'],
+ providers: [
+ {
+ provide: NG_VALUE_ACCESSOR,
+ useExisting: forwardRef(() => WidgetUnitsComponent),
+ multi: true
+ }
+ ]
+})
+export class WidgetUnitsComponent implements ControlValueAccessor, OnInit {
+
+ @Input()
+ disabled: boolean;
+
+ unitsFormControl: FormControl;
+
+ private propagateChange = (_val: any) => {};
+
+ constructor(private fb: UntypedFormBuilder) {
+ }
+
+ ngOnInit() {
+ this.unitsFormControl = this.fb.control('', []);
+ }
+
+ writeValue(units?: string): void {
+ this.unitsFormControl.patchValue(units, {emitEvent: false});
+ }
+
+ registerOnChange(fn: any): void {
+ this.propagateChange = fn;
+ }
+
+ registerOnTouched(fn: any): void {
+ }
+
+ setDisabledState(isDisabled: boolean): void {
+ this.disabled = isDisabled;
+ if (this.disabled) {
+ this.unitsFormControl.disable({emitEvent: false});
+ } else {
+ this.unitsFormControl.enable({emitEvent: false});
+ }
+ }
+}
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/simple-card-widget-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/simple-card-widget-settings.component.ts
index f22828d41d..b9080b93ff 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/simple-card-widget-settings.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/simple-card-widget-settings.component.ts
@@ -23,7 +23,7 @@ import { AppState } from '@core/core.state';
@Component({
selector: 'tb-simple-card-widget-settings',
templateUrl: './simple-card-widget-settings.component.html',
- styleUrls: ['../../../widget-config.scss']
+ styleUrls: ['../../../config/widget-config.scss']
})
export class SimpleCardWidgetSettingsComponent extends WidgetSettingsComponent {
diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts b/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts
index eb4964de91..e3ff270197 100644
--- a/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts
@@ -164,7 +164,7 @@ export class WidgetComponentService {
(window as any).TbMapWidgetV2 = mod.TbMapWidgetV2;
}))
);
- widgetModulesTasks.push(from(import('@home/components/widget/trip-animation/trip-animation.component')).pipe(
+ widgetModulesTasks.push(from(import('@home/components/widget/lib/trip-animation/trip-animation.component')).pipe(
tap((mod) => {
(window as any).TbTripAnimationWidget = mod.TbTripAnimationWidget;
}))
diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-components.module.ts b/ui-ngx/src/app/modules/home/components/widget/widget-components.module.ts
index 5368ed2e71..ce2e7055cc 100644
--- a/ui-ngx/src/app/modules/home/components/widget/widget-components.module.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/widget-components.module.ts
@@ -29,7 +29,7 @@ import {
DateRangeNavigatorWidgetComponent
} from '@home/components/widget/lib/date-range-navigator/date-range-navigator.component';
import { MultipleInputWidgetComponent } from '@home/components/widget/lib/multiple-input-widget.component';
-import { TripAnimationComponent } from '@home/components/widget/trip-animation/trip-animation.component';
+import { TripAnimationComponent } from '@home/components/widget/lib/trip-animation/trip-animation.component';
import { PhotoCameraInputWidgetComponent } from '@home/components/widget/lib/photo-camera-input.component';
import { GatewayFormComponent } from '@home/components/widget/lib/gateway/gateway-form.component';
import { NavigationCardsWidgetComponent } from '@home/components/widget/lib/navigation-cards-widget.component';
diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-config.component.html b/ui-ngx/src/app/modules/home/components/widget/widget-config.component.html
index 86f2cba04e..1766b79009 100644
--- a/ui-ngx/src/app/modules/home/components/widget/widget-config.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/widget-config.component.html
@@ -252,9 +252,9 @@
widget-config.data-settings