From 8b7bf4a633c70811e5e36746e728c3b4a003fddf Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 29 Jan 2025 18:43:15 +0200 Subject: [PATCH 1/5] UI: Add new 'Get Dashboard State with Parameters' action type --- .../widget/lib/action/action-widget.models.ts | 23 +++++++++++++++++++ ...value-action-settings-panel.component.html | 4 +++- ...t-value-action-settings-panel.component.ts | 10 +++++--- .../get-value-action-settings.component.ts | 8 +++++++ .../models/action-widget-settings.models.ts | 6 +++-- .../assets/locale/locale.constant-en_US.json | 3 +++ 6 files changed, 48 insertions(+), 6 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts index b4a46d9592..aa001f5a1b 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts @@ -57,6 +57,7 @@ import { isDefinedAndNotNull } from '@core/utils'; import { parseError } from '@shared/models/error.models'; import { CompiledTbFunction, compileTbFunction } from '@shared/models/js-function.models'; import { HttpClient } from '@angular/common/http'; +import { StateObject } from '@core/api/widget-api.models'; @Directive() // eslint-disable-next-line @angular-eslint/directive-class-suffix @@ -269,6 +270,8 @@ export abstract class ValueGetter extends ValueAction { return new AlarmStatusValueGetter(ctx, settings, valueType, valueObserver, simulated); case GetValueAction.GET_DASHBOARD_STATE: return new DashboardStateGetter(ctx, settings, valueType, valueObserver, simulated); + case GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS: + return new DashboardStateWithParamsGetter(ctx, settings, valueType, valueObserver, simulated); } } @@ -641,6 +644,26 @@ export class DashboardStateGetter extends ValueGetter { } } +export class DashboardStateWithParamsGetter extends ValueGetter { + constructor(protected ctx: WidgetContext, + protected settings: GetValueSettings, + protected valueType: ValueType, + protected valueObserver: Partial>, + protected simulated: boolean) { + super(ctx, settings, valueType, valueObserver, simulated); + } + + protected doGetValue(): Observable { + if (this.simulated) { + return of({id: 'default', params: {}}); + } else { + return this.ctx.stateController.dashboardCtrl.dashboardCtx.stateId.pipe( + map(id => ({id, params: this.ctx.stateController.getStateParams()})) + ); + } + } +} + export class ExecuteRpcValueSetter extends ValueSetter { private readonly executeRpcSettings: RpcSettings; 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 cb6cd5cbe0..68a9872799 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 @@ -131,7 +131,9 @@ class="tb-form-panel stroked" formGroupName="dataToValue">
widgets.value-action.action-result-converter
- + {{ 'widgets.value-action.converter-none' | translate }} {{ 'widgets.value-action.converter-function' | translate }} 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 a4339b7e12..82bc659e12 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 @@ -99,6 +99,8 @@ export class GetValueActionSettingsPanelComponent extends PageComponent implemen getValueSettingsFormGroup: UntypedFormGroup; + entityType = EntityType; + alarmSeverities = Object.keys(AlarmSeverity) as AlarmSeverity[]; alarmSeverityTranslationMap = alarmSeverityTranslations; @@ -167,7 +169,7 @@ export class GetValueActionSettingsPanelComponent extends PageComponent implemen private updateValidators() { const action: GetValueAction = this.getValueSettingsFormGroup.get('action').value; - const dataToValueType: DataToValueType = this.getValueSettingsFormGroup.get('dataToValue').get('type').value; + let dataToValueType: DataToValueType = this.getValueSettingsFormGroup.get('dataToValue').get('type').value; this.getValueSettingsFormGroup.get('defaultValue').disable({emitEvent: false}); this.getValueSettingsFormGroup.get('executeRpc').disable({emitEvent: false}); @@ -196,6 +198,10 @@ export class GetValueActionSettingsPanelComponent extends PageComponent implemen case GetValueAction.GET_ALARM_STATUS: this.getValueSettingsFormGroup.get('getAlarmStatus').enable({emitEvent: false}); break; + case GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS: + this.getValueSettingsFormGroup.get('dataToValue.type').setValue(DataToValueType.FUNCTION, {emitEvent: false}); + dataToValueType = DataToValueType.FUNCTION; + break } if (action === GetValueAction.DO_NOTHING || action === GetValueAction.GET_ALARM_STATUS) { this.getValueSettingsFormGroup.get('dataToValue').disable({emitEvent: false}); @@ -208,6 +214,4 @@ export class GetValueActionSettingsPanelComponent extends PageComponent implemen } } } - - protected readonly entityType = EntityType; } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts index 871923e5b7..d482d2e9fe 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts @@ -191,6 +191,14 @@ export class GetValueActionSettingsComponent implements OnInit, ControlValueAcce this.displayValue = this.translate.instant('widgets.value-action.get-dashboard-state-text'); } break; + case GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS: + if (this.valueType === ValueType.BOOLEAN) { + const state = this.modelValue.dataToValue?.compareToValue; + this.displayValue = this.translate.instant('widgets.value-action.when-dashboard-state-with-params-function-is-text', {state}); + } else { + this.displayValue = this.translate.instant('widgets.value-action.get-dashboard-state-with-params-text'); + } + break; } this.cd.markForCheck(); } diff --git a/ui-ngx/src/app/shared/models/action-widget-settings.models.ts b/ui-ngx/src/app/shared/models/action-widget-settings.models.ts index b1c47a1fd3..1c83669206 100644 --- a/ui-ngx/src/app/shared/models/action-widget-settings.models.ts +++ b/ui-ngx/src/app/shared/models/action-widget-settings.models.ts @@ -25,7 +25,8 @@ export enum GetValueAction { GET_ATTRIBUTE = 'GET_ATTRIBUTE', GET_TIME_SERIES = 'GET_TIME_SERIES', GET_ALARM_STATUS = 'GET_ALARM_STATUS', - GET_DASHBOARD_STATE = 'GET_DASHBOARD_STATE' + GET_DASHBOARD_STATE = 'GET_DASHBOARD_STATE', + GET_DASHBOARD_STATE_WITH_PARAMS = 'GET_DASHBOARD_STATE_WITH_PARAMS', } export const getValueActions = Object.keys(GetValueAction) as GetValueAction[]; @@ -45,7 +46,8 @@ export const getValueActionTranslations = new Map( [GetValueAction.GET_ATTRIBUTE, 'widgets.value-action.get-attribute'], [GetValueAction.GET_TIME_SERIES, 'widgets.value-action.get-time-series'], [GetValueAction.GET_ALARM_STATUS, 'widgets.value-action.get-alarm-status'], - [GetValueAction.GET_DASHBOARD_STATE, 'widgets.value-action.get-dashboard-state'] + [GetValueAction.GET_DASHBOARD_STATE, 'widgets.value-action.get-dashboard-state'], + [GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS, 'widgets.value-action.get-dashboard-state-with-params'], ] ); diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index a16625bdaa..8e7e6deb7e 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -8265,14 +8265,17 @@ "get-time-series": "Get time series", "get-alarm-status": "Get alarm status", "get-dashboard-state": "Get dashboard state", + "get-dashboard-state-with-params": "Get dashboard state with params", "add-time-series": "Add time series", "execute-rpc-text": "Execute RPC method '{{methodName}}'", "get-time-series-text": "Use time series '{{key}}'", "get-attribute-text": "Use attribute '{{key}}'", "get-alarm-status-text": "Use alarm status", "get-dashboard-state-text": "Use dashboard state", + "get-dashboard-state-with-params-text": "Use dashboard state with params", "when-dashboard-state-is-text": "When dashboard state is '{{state}}'", "when-dashboard-state-function-is-text": "When f(dashboard state) is '{{state}}'", + "when-dashboard-state-with-params-function-is-text": "When f(dashboard state with params) is '{{state}}'", "set-attribute-to-value-text": "Set '{{key}}' attribute to: {{value}}", "add-time-series-value-text": "Add '{{key}}' time series value: {{value}}", "set-attribute-text": "Set '{{key}}' attribute", From c6bb337d23460f7b468085412d099ac08d6d09e9 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 29 Jan 2025 19:08:11 +0200 Subject: [PATCH 2/5] UI: Add help to function 'Get Dashboard State with Parameters' --- ...value-action-settings-panel.component.html | 2 +- ...t-value-action-settings-panel.component.ts | 8 ++++ ...alue_get_dashboard_state_with_params_fn.md | 40 +++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_with_params_fn.md 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 68a9872799..7783c0af20 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 @@ -145,7 +145,7 @@ [globalVariables]="functionScopeVariables" [functionArgs]="['data']" functionTitle="{{ 'widgets.value-action.parse-value-function' | translate }}" - helpId="widget/lib/rpc/parse_value_fn"> + [helpId]="getParseValueFunctionHelpId()">
{{ 'widgets.value-action.state-when-result-is' | translate:{state: stateLabel} }}
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 82bc659e12..4c98c0cac4 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 @@ -167,6 +167,14 @@ export class GetValueActionSettingsPanelComponent extends PageComponent implemen this.getValueSettingsApplied.emit(getValueSettings); } + getParseValueFunctionHelpId(): string { + const action: GetValueAction = this.getValueSettingsFormGroup.get('action').value; + if (action === GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS) { + return 'widget/config/parse_value_get_dashboard_state_with_params_fn'; + } + return 'widget/lib/rpc/parse_value_fn'; + } + private updateValidators() { const action: GetValueAction = this.getValueSettingsFormGroup.get('action').value; let dataToValueType: DataToValueType = this.getValueSettingsFormGroup.get('dataToValue').get('type').value; diff --git a/ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_with_params_fn.md b/ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_with_params_fn.md new file mode 100644 index 0000000000..c272a07f79 --- /dev/null +++ b/ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_with_params_fn.md @@ -0,0 +1,40 @@ +#### Parse value function + +
+
+ +*function (data): boolean* + +A JavaScript function that converts the current dashboard state and parameters into a boolean value. + +**Parameters:** + +
    +
  • data: StateObject - the current dashboard state object. +
  • +
+ +**Returns:** + +`true` if the widget should be in an activated state, `false` otherwise. + +
+ +##### Examples + +* Check if the current dashboard state ID is "default": + +```javascript +return data.id === 'default' ? true : false; +{:copy-code} +``` + +* Check if the current dashboard state parameters are empty: + +```javascript +return Object.keys(data.params).length ? true : false; +{:copy-code} +``` + +
+
From 50f36c7a5ce7513ade46bbc934b39fec61783963 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 31 Jan 2025 10:11:47 +0200 Subject: [PATCH 3/5] UI: In action dashboard state params added new instance params --- .../home/components/widget/lib/action/action-widget.models.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts index aa001f5a1b..dbf83aac9a 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts @@ -53,7 +53,7 @@ import { import { ValueType } from '@shared/models/constants'; import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models'; import { EntityId } from '@shared/models/id/entity-id'; -import { isDefinedAndNotNull } from '@core/utils'; +import { deepClone, isDefinedAndNotNull } from '@core/utils'; import { parseError } from '@shared/models/error.models'; import { CompiledTbFunction, compileTbFunction } from '@shared/models/js-function.models'; import { HttpClient } from '@angular/common/http'; @@ -658,7 +658,7 @@ export class DashboardStateWithParamsGetter extends ValueGetter { return of({id: 'default', params: {}}); } else { return this.ctx.stateController.dashboardCtrl.dashboardCtx.stateId.pipe( - map(id => ({id, params: this.ctx.stateController.getStateParams()})) + map(id => ({id, params: deepClone(this.ctx.stateController.getStateParams())})) ); } } From be41d477f8bc5b8b619006ad6773b0faf847b0ff Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Tue, 4 Feb 2025 17:33:57 +0200 Subject: [PATCH 4/5] UI: Fixed detect change state in dashboard --- .../widget/lib/action/action-widget.models.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts index dbf83aac9a..9c5bc7885a 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts @@ -25,6 +25,7 @@ import { WidgetContext } from '@home/models/widget-component.models'; import { BehaviorSubject, forkJoin, + merge, Observable, Observer, of, @@ -33,7 +34,7 @@ import { switchMap, throwError } from 'rxjs'; -import { catchError, delay, map, share, take } from 'rxjs/operators'; +import { catchError, debounceTime, delay, map, share, take } from 'rxjs/operators'; import { AfterViewInit, ChangeDetectorRef, Directive, Input, OnDestroy, OnInit, TemplateRef } from '@angular/core'; import { DataToValueSettings, @@ -657,8 +658,15 @@ export class DashboardStateWithParamsGetter extends ValueGetter { if (this.simulated) { return of({id: 'default', params: {}}); } else { - return this.ctx.stateController.dashboardCtrl.dashboardCtx.stateId.pipe( - map(id => ({id, params: deepClone(this.ctx.stateController.getStateParams())})) + return merge( + this.ctx.stateController.dashboardCtrl.dashboardCtx.stateId, + this.ctx.stateController.dashboardCtrl.dashboardCtx.stateChanged + ).pipe( + debounceTime(10), + map(() => ({ + id: this.ctx.stateController.getStateId(), + params: deepClone(this.ctx.stateController.getStateParams()) + })) ); } } From dd9e45deee753a58b9e518607fdda211fc4a0b98 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 5 Feb 2025 16:37:10 +0200 Subject: [PATCH 5/5] UI: Rename 'get dashboard state with params' to 'get dashboard state object' --- .../widget/lib/action/action-widget.models.ts | 2 +- .../get-value-action-settings-panel.component.html | 2 +- .../get-value-action-settings-panel.component.ts | 6 +++--- .../action/get-value-action-settings.component.ts | 6 +++--- .../shared/models/action-widget-settings.models.ts | 4 ++-- ... => parse_value_get_dashboard_state_object_fn.md} | 4 ++-- ui-ngx/src/assets/locale/locale.constant-en_US.json | 12 ++++++------ 7 files changed, 18 insertions(+), 18 deletions(-) rename ui-ngx/src/assets/help/en_US/widget/config/{parse_value_get_dashboard_state_with_params_fn.md => parse_value_get_dashboard_state_object_fn.md} (89%) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts index 9c5bc7885a..2e02d36f04 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts @@ -271,7 +271,7 @@ export abstract class ValueGetter extends ValueAction { return new AlarmStatusValueGetter(ctx, settings, valueType, valueObserver, simulated); case GetValueAction.GET_DASHBOARD_STATE: return new DashboardStateGetter(ctx, settings, valueType, valueObserver, simulated); - case GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS: + case GetValueAction.GET_DASHBOARD_STATE_OBJECT: return new DashboardStateWithParamsGetter(ctx, settings, valueType, valueObserver, simulated); } } 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 7783c0af20..9c9f45173d 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 @@ -133,7 +133,7 @@
widgets.value-action.action-result-converter
+ [class.invisible]="getValueSettingsFormGroup.get('action').value === getValueAction.GET_DASHBOARD_STATE_OBJECT"> {{ 'widgets.value-action.converter-none' | translate }} {{ 'widgets.value-action.converter-function' | translate }} 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 4c98c0cac4..9b8b86e626 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 @@ -169,8 +169,8 @@ export class GetValueActionSettingsPanelComponent extends PageComponent implemen getParseValueFunctionHelpId(): string { const action: GetValueAction = this.getValueSettingsFormGroup.get('action').value; - if (action === GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS) { - return 'widget/config/parse_value_get_dashboard_state_with_params_fn'; + if (action === GetValueAction.GET_DASHBOARD_STATE_OBJECT) { + return 'widget/config/parse_value_get_dashboard_state_object_fn'; } return 'widget/lib/rpc/parse_value_fn'; } @@ -206,7 +206,7 @@ export class GetValueActionSettingsPanelComponent extends PageComponent implemen case GetValueAction.GET_ALARM_STATUS: this.getValueSettingsFormGroup.get('getAlarmStatus').enable({emitEvent: false}); break; - case GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS: + case GetValueAction.GET_DASHBOARD_STATE_OBJECT: this.getValueSettingsFormGroup.get('dataToValue.type').setValue(DataToValueType.FUNCTION, {emitEvent: false}); dataToValueType = DataToValueType.FUNCTION; break diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts index d482d2e9fe..5e2661df59 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts @@ -191,12 +191,12 @@ export class GetValueActionSettingsComponent implements OnInit, ControlValueAcce this.displayValue = this.translate.instant('widgets.value-action.get-dashboard-state-text'); } break; - case GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS: + case GetValueAction.GET_DASHBOARD_STATE_OBJECT: if (this.valueType === ValueType.BOOLEAN) { const state = this.modelValue.dataToValue?.compareToValue; - this.displayValue = this.translate.instant('widgets.value-action.when-dashboard-state-with-params-function-is-text', {state}); + this.displayValue = this.translate.instant('widgets.value-action.when-dashboard-state-object-function-is-text', {state}); } else { - this.displayValue = this.translate.instant('widgets.value-action.get-dashboard-state-with-params-text'); + this.displayValue = this.translate.instant('widgets.value-action.get-dashboard-state-object-text'); } break; } diff --git a/ui-ngx/src/app/shared/models/action-widget-settings.models.ts b/ui-ngx/src/app/shared/models/action-widget-settings.models.ts index 1c83669206..fd78ab30f0 100644 --- a/ui-ngx/src/app/shared/models/action-widget-settings.models.ts +++ b/ui-ngx/src/app/shared/models/action-widget-settings.models.ts @@ -26,7 +26,7 @@ export enum GetValueAction { GET_TIME_SERIES = 'GET_TIME_SERIES', GET_ALARM_STATUS = 'GET_ALARM_STATUS', GET_DASHBOARD_STATE = 'GET_DASHBOARD_STATE', - GET_DASHBOARD_STATE_WITH_PARAMS = 'GET_DASHBOARD_STATE_WITH_PARAMS', + GET_DASHBOARD_STATE_OBJECT = 'GET_DASHBOARD_STATE_OBJECT', } export const getValueActions = Object.keys(GetValueAction) as GetValueAction[]; @@ -47,7 +47,7 @@ export const getValueActionTranslations = new Map( [GetValueAction.GET_TIME_SERIES, 'widgets.value-action.get-time-series'], [GetValueAction.GET_ALARM_STATUS, 'widgets.value-action.get-alarm-status'], [GetValueAction.GET_DASHBOARD_STATE, 'widgets.value-action.get-dashboard-state'], - [GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS, 'widgets.value-action.get-dashboard-state-with-params'], + [GetValueAction.GET_DASHBOARD_STATE_OBJECT, 'widgets.value-action.get-dashboard-state-object'], ] ); diff --git a/ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_with_params_fn.md b/ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_object_fn.md similarity index 89% rename from ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_with_params_fn.md rename to ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_object_fn.md index c272a07f79..ddc1ed7bc8 100644 --- a/ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_with_params_fn.md +++ b/ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_object_fn.md @@ -5,7 +5,7 @@ *function (data): boolean* -A JavaScript function that converts the current dashboard state and parameters into a boolean value. +A JavaScript function that converts the current dashboard state object into a boolean value. **Parameters:** @@ -22,7 +22,7 @@ A JavaScript function that converts the current dashboard state and parameters i ##### Examples -* Check if the current dashboard state ID is "default": +* Check if the current dashboard state id is "default": ```javascript return data.id === 'default' ? true : false; diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index cd91f44b4b..7871e6c022 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -8334,18 +8334,18 @@ "set-attribute": "Set attribute", "get-time-series": "Get time series", "get-alarm-status": "Get alarm status", - "get-dashboard-state": "Get dashboard state", - "get-dashboard-state-with-params": "Get dashboard state with params", + "get-dashboard-state": "Get dashboard state id", + "get-dashboard-state-object": "Get dashboard state object", "add-time-series": "Add time series", "execute-rpc-text": "Execute RPC method '{{methodName}}'", "get-time-series-text": "Use time series '{{key}}'", "get-attribute-text": "Use attribute '{{key}}'", "get-alarm-status-text": "Use alarm status", "get-dashboard-state-text": "Use dashboard state", - "get-dashboard-state-with-params-text": "Use dashboard state with params", - "when-dashboard-state-is-text": "When dashboard state is '{{state}}'", - "when-dashboard-state-function-is-text": "When f(dashboard state) is '{{state}}'", - "when-dashboard-state-with-params-function-is-text": "When f(dashboard state with params) is '{{state}}'", + "get-dashboard-state-object-text": "Use dashboard state object", + "when-dashboard-state-is-text": "When dashboard state id is '{{state}}'", + "when-dashboard-state-function-is-text": "When f(dashboard state id) is '{{state}}'", + "when-dashboard-state-object-function-is-text": "When f(dashboard state object) is '{{state}}'", "set-attribute-to-value-text": "Set '{{key}}' attribute to: {{value}}", "add-time-series-value-text": "Add '{{key}}' time series value: {{value}}", "set-attribute-text": "Set '{{key}}' attribute",