diff --git a/ui-ngx/src/app/modules/home/components/converter/converter-test-dialog.component.ts b/ui-ngx/src/app/modules/home/components/converter/converter-test-dialog.component.ts index b2e1888113..4842816f19 100644 --- a/ui-ngx/src/app/modules/home/components/converter/converter-test-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/converter/converter-test-dialog.component.ts @@ -153,7 +153,7 @@ export class ConverterTestDialogComponent extends DialogComponent; + let metadata: Record; let integrationMetadata: Record; if (debugIn) { if (debugIn.inContentType) { @@ -161,12 +161,7 @@ export class ConverterTestDialogComponent extends DialogComponent { this.converterTestFormGroup.patchValue({ payload: value, - metadata: value.metadata + metadata: this.stringifyMetadataValues(value.metadata) }, {emitEvent: false}); this.currentOriginalMsg.payload = msg.payload; this.currentOriginalMsg.metadata = msg.metadata; @@ -446,9 +441,20 @@ export class ConverterTestDialogComponent extends DialogComponent): Record { + if (!metadata) { + return metadata; + } + const result: Record = {}; + Object.keys(metadata).forEach((key) => { + result[key] = isObject(metadata[key]) ? JSON.stringify(metadata[key]) : metadata[key]; + }); + return result; + } + private testConverter(): Observable { if (this.checkInputParamErrors()) { - const metadata: Record = this.converterTestFormGroup.get('metadata').value; + const metadata: Record = {...this.converterTestFormGroup.get('metadata').value}; Object.keys(metadata).forEach(function (key) { try { metadata[key] = JSON.parse(metadata[key]); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html index 2cd8413e32..3560e331cd 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html @@ -207,7 +207,7 @@
-
{{ 'widgets.value-action.request-timeout-ms' | translate }}
+
{{ 'widgets.value-action.request-timeout-ms' | translate }}
@if (getValueSettingsFormGroup.get('executeRpc').get('requestTimeout').touched && @@ -236,7 +236,7 @@
-
{{ 'widgets.value-action.persistent-polling-interval' | translate }}
+
{{ 'widgets.value-action.persistent-polling-interval' | translate }}
@if (getValueSettingsFormGroup.get('executeRpc').get('persistentPollingInterval').touched && diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts index b6cda40331..a7f483683f 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts @@ -110,10 +110,10 @@ export class GetValueActionSettingsPanelComponent extends PageComponent implemen defaultValue: [this.getValueSettings?.defaultValue, [Validators.required]], executeRpc: this.fb.group({ method: [this.getValueSettings?.executeRpc?.method, [Validators.required]], - requestTimeout: [this.getValueSettings?.executeRpc?.requestTimeout, [Validators.required, Validators.min(5000)]], + requestTimeout: [this.getValueSettings?.executeRpc?.requestTimeout ?? 5000, [Validators.required, Validators.min(5000)]], requestPersistent: [this.getValueSettings?.executeRpc?.requestPersistent, []], persistentPollingInterval: - [this.getValueSettings?.executeRpc?.persistentPollingInterval, [Validators.required, Validators.min(1000)]], + [this.getValueSettings?.executeRpc?.persistentPollingInterval ?? 1000, [Validators.required, Validators.min(1000)]], params: this.fb.group({ type: [this.getValueSettings?.executeRpc?.params?.type ?? RpcParamsType.NONE, [Validators.required]], constantValue: [this.getValueSettings?.executeRpc?.params?.constantValue, [Validators.required]], diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings-panel.component.html index 4d37d94c7f..e5963def57 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings-panel.component.html @@ -139,7 +139,7 @@
-
{{ 'widgets.value-action.request-timeout-ms' | translate }}
+
{{ 'widgets.value-action.request-timeout-ms' | translate }}
@if (setValueSettingsFormGroup.get('executeRpc').get('requestTimeout').touched && @@ -168,7 +168,7 @@
-
{{ 'widgets.value-action.persistent-polling-interval' | translate }}
+
{{ 'widgets.value-action.persistent-polling-interval' | translate }}
@if (setValueSettingsFormGroup.get('executeRpc').get('persistentPollingInterval').touched && diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings-panel.component.ts index 25091cb3bd..759256c772 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings-panel.component.ts @@ -89,10 +89,10 @@ export class SetValueActionSettingsPanelComponent extends PageComponent implemen action: [this.setValueSettings?.action, []], executeRpc: this.fb.group({ method: [this.setValueSettings?.executeRpc?.method, [Validators.required]], - requestTimeout: [this.setValueSettings?.executeRpc?.requestTimeout, [Validators.required, Validators.min(5000)]], + requestTimeout: [this.setValueSettings?.executeRpc?.requestTimeout ?? 5000, [Validators.required, Validators.min(5000)]], requestPersistent: [this.setValueSettings?.executeRpc?.requestPersistent, []], persistentPollingInterval: - [this.setValueSettings?.executeRpc?.persistentPollingInterval, [Validators.required, Validators.min(1000)]] + [this.setValueSettings?.executeRpc?.persistentPollingInterval ?? 1000, [Validators.required, Validators.min(1000)]] }), setAttribute: this.fb.group({ scope: [this.setValueSettings?.setAttribute?.scope, []], diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings.component.ts index bb2c6024db..6578d6a5b4 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings.component.ts @@ -18,7 +18,7 @@ import { SetValueAction, SetValueSettings, ValueToDataType } from '@shared/model import { TranslateService } from '@ngx-translate/core'; import { IAliasController } from '@core/api/widget-api.models'; import { TargetDevice, widgetType } from '@shared/models/widget.models'; -import { isDefinedAndNotNull } from '@core/utils'; +import { isDefinedAndNotNull, isObject } from '@core/utils'; import { SetValueActionSettingsPanelComponent } from '@home/components/widget/lib/settings/common/action/set-value-action-settings-panel.component'; @@ -136,6 +136,9 @@ export class SetValueActionSettingsComponent implements OnInit, ControlValueAcce break; case ValueToDataType.CONSTANT: value = this.modelValue.valueToData.constantValue; + if (isObject(value)) { + value = JSON.stringify(value); + } break; case ValueToDataType.FUNCTION: value = 'f(value)'; diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-container.component.scss b/ui-ngx/src/app/modules/home/components/widget/widget-container.component.scss index d02cd489ee..e7871370e1 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-container.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/widget-container.component.scss @@ -27,6 +27,7 @@ div.tb-widget { display: flex; flex-direction: column; + isolation: isolate; .tb-widget-header { display: flex; flex-direction: row; diff --git a/ui-ngx/src/app/shared/models/converter.models.ts b/ui-ngx/src/app/shared/models/converter.models.ts index 3c6bba0ee0..2180399bfe 100644 --- a/ui-ngx/src/app/shared/models/converter.models.ts +++ b/ui-ngx/src/app/shared/models/converter.models.ts @@ -140,7 +140,7 @@ export interface ConvertedInputMsgParams { export interface ConvertedInputMsgResult { payload: any; - metadata: {[key: string]: string}; + metadata: Record; contentType: ContentType; stringContent?: string; }