Browse Source

UI: Rename 'get dashboard state with params' to 'get dashboard state object'

pull/12551/head
Vladyslav_Prykhodko 1 year ago
parent
commit
dd9e45deee
  1. 2
      ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts
  2. 2
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html
  3. 6
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts
  4. 6
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts
  5. 4
      ui-ngx/src/app/shared/models/action-widget-settings.models.ts
  6. 4
      ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_object_fn.md
  7. 12
      ui-ngx/src/assets/locale/locale.constant-en_US.json

2
ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts

@ -271,7 +271,7 @@ export abstract class ValueGetter<V> extends ValueAction {
return new AlarmStatusValueGetter<V>(ctx, settings, valueType, valueObserver, simulated);
case GetValueAction.GET_DASHBOARD_STATE:
return new DashboardStateGetter<V>(ctx, settings, valueType, valueObserver, simulated);
case GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS:
case GetValueAction.GET_DASHBOARD_STATE_OBJECT:
return new DashboardStateWithParamsGetter<V>(ctx, settings, valueType, valueObserver, simulated);
}
}

2
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html

@ -133,7 +133,7 @@
<div class="fixed-title-width" translate>widgets.value-action.action-result-converter</div>
<tb-toggle-select formControlName="type"
class="flex-1"
[class.invisible]="getValueSettingsFormGroup.get('action').value === getValueAction.GET_DASHBOARD_STATE_WITH_PARAMS">
[class.invisible]="getValueSettingsFormGroup.get('action').value === getValueAction.GET_DASHBOARD_STATE_OBJECT">
<tb-toggle-option [value]="dataToValueType.NONE">{{ 'widgets.value-action.converter-none' | translate }}</tb-toggle-option>
<tb-toggle-option [value]="dataToValueType.FUNCTION">{{ 'widgets.value-action.converter-function' | translate }}</tb-toggle-option>
</tb-toggle-select>

6
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

6
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;
}

4
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, string>(
[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'],
]
);

4
ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_with_params_fn.md → 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;

12
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",

Loading…
Cancel
Save