From 6c3c361f070a6bd574c2391252c6737f84d4d96e Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Thu, 25 Jul 2024 18:25:15 +0300 Subject: [PATCH] UI: Horizontal wheel valve SCADA symbol --- .../scada_symbols/horizontal-faucet.svg | 85 ------ .../scada_symbols/horizontal-wheel-valve.svg | 261 ++++++++++++++++++ .../scada_water_system_symbols.json | 2 +- .../assets/locale/locale.constant-en_US.json | 12 +- 4 files changed, 273 insertions(+), 87 deletions(-) delete mode 100644 application/src/main/data/json/system/scada_symbols/horizontal-faucet.svg create mode 100644 application/src/main/data/json/system/scada_symbols/horizontal-wheel-valve.svg diff --git a/application/src/main/data/json/system/scada_symbols/horizontal-faucet.svg b/application/src/main/data/json/system/scada_symbols/horizontal-faucet.svg deleted file mode 100644 index 0a2510903c..0000000000 --- a/application/src/main/data/json/system/scada_symbols/horizontal-faucet.svg +++ /dev/null @@ -1,85 +0,0 @@ - -{ - "title": "Horizontal faucet", - "widgetSizeX": 2, - "widgetSizeY": 1, - "tags": [], - "behavior": [], - "properties": [] -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/horizontal-wheel-valve.svg b/application/src/main/data/json/system/scada_symbols/horizontal-wheel-valve.svg new file mode 100644 index 0000000000..1373c48df7 --- /dev/null +++ b/application/src/main/data/json/system/scada_symbols/horizontal-wheel-valve.svg @@ -0,0 +1,261 @@ + + + { + "title": "Horizontal wheel valve", + "description": "Horizontal wheel valve with open/close animation and state colors.", + "searchTags": [ + "valve", + "wheel" + ], + "widgetSizeX": 2, + "widgetSizeY": 1, + "tags": [ + { + "tag": "background", + "stateRenderFunction": "var opened = ctx.values.opened;\nvar elementOpened = element.remember('opened');\nvar color = opened ? ctx.properties.openedColor : ctx.properties.closedColor;\nif (typeof elementOpened === 'undefined') {\n element.attr({fill: color});\n} else if (elementOpened !== opened) {\n ctx.api.animate(element, 500).attr({fill: color});\n}\nelement.remember('opened', opened);", + "actions": null + }, + { + "tag": "clickArea", + "stateRenderFunction": null, + "actions": { + "click": { + "actionFunction": "var opened = ctx.values.opened;\nvar action = opened ? 'close' : 'open';\n\nctx.api.callAction(event, action, undefined, {\n next: () => {\n ctx.api.setValue('opened', !opened);\n }\n});" + } + } + }, + { + "tag": "wheel", + "stateRenderFunction": "var opened = ctx.values.opened;\nvar elementOpened = element.remember('opened');\nvar angle = opened ? ctx.properties.openedRotationAngle : ctx.properties.closedRotationAngle;\nif (typeof elementOpened === 'undefined') {\n element.transform({rotate: angle});\n} else if (elementOpened !== opened) {\n ctx.api.animate(element, 500).transform({rotate: angle});\n}\nelement.remember('opened', opened);", + "actions": null + } + ], + "behavior": [ + { + "id": "opened", + "name": "{i18n:scada.symbol.opened}", + "hint": "{i18n:scada.symbol.opened-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "defaultValue": false, + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.opened}", + "valueToDataType": "CONSTANT", + "constantValue": false, + "valueToDataFunction": "" + }, + { + "id": "open", + "name": "{i18n:scada.symbol.open}", + "hint": "{i18n:scada.symbol.open-hint}", + "group": null, + "type": "action", + "valueType": "BOOLEAN", + "defaultValue": false, + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "valueToDataType": "CONSTANT", + "constantValue": true, + "valueToDataFunction": "" + }, + { + "id": "close", + "name": "{i18n:scada.symbol.close}", + "hint": "{i18n:scada.symbol.close-hint}", + "group": null, + "type": "action", + "valueType": "BOOLEAN", + "defaultValue": false, + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "valueToDataType": "CONSTANT", + "constantValue": false, + "valueToDataFunction": "" + } + ], + "properties": [ + { + "id": "openedColor", + "name": "{i18n:scada.symbol.opened-color}", + "type": "color", + "default": "#1C943E", + "required": null, + "subLabel": null, + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "closedColor", + "name": "{i18n:scada.symbol.closed-color}", + "type": "color", + "default": "#696969", + "required": null, + "subLabel": null, + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "openedRotationAngle", + "name": "{i18n:scada.symbol.opened-rotation-angle}", + "type": "number", + "default": 0, + "required": true, + "subLabel": null, + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": -179, + "max": 179, + "step": null + }, + { + "id": "closedRotationAngle", + "name": "{i18n:scada.symbol.closed-rotation-angle}", + "type": "number", + "default": 90, + "required": true, + "subLabel": null, + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": -179, + "max": 179, + "step": null + } + ] +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/src/main/data/json/system/widget_bundles/scada_water_system_symbols.json b/application/src/main/data/json/system/widget_bundles/scada_water_system_symbols.json index 34faf53bd3..0ae486513e 100644 --- a/application/src/main/data/json/system/widget_bundles/scada_water_system_symbols.json +++ b/application/src/main/data/json/system/widget_bundles/scada_water_system_symbols.json @@ -37,7 +37,7 @@ "long_bottom_filter", "short_top_filter", "long_top_filter", - "horizontal_faucet", + "horizontal_wheel_valve", "horizontal_tank_with_screen", "vertical_tank_with_level", "level_and_fan" 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 4807fe09b8..b078f326e1 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -3659,7 +3659,17 @@ "running-color": "Running color", "stopped-color": "Stopped color", "warning-color": "Warning color", - "critical-color": "Critical color" + "critical-color": "Critical color", + "opened": "Opened", + "opened-hint": "Indicates whether component is in opened state.", + "open": "Open", + "open-hint": "Action invoked when user clicks to open component.", + "close": "Close", + "close-hint": "Action invoked when user clicks to close component.", + "opened-color": "Opened color", + "closed-color": "Closed color", + "opened-rotation-angle": "Opened rotation angle", + "closed-rotation-angle": "Closed rotation angle" } }, "item": {