-
-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reintroduce inline script support for ECMAScript #1981
Comments
See the following community thread: |
@openhab/core-maintainers I believe this is an core issu because UI gets its options from the REST API. |
The script transformation regards an entry starting with UI should present a "free text" option at this point, together with the available transformations. |
That's what I was thinking too. The UI should provide the option for a text field where the user can enter an arbitrary inline script. |
Would be one option, but e.g. for DSL, the UI's input field is only there because core provides a config description for it. I would prefer to have it the same for all profiles, otherwise we need to hard-code it for some and for others not. For example for SCRIPT DSL:
{
"uri": "profile:transform:DSL",
"parameters": [
{
"description": "The Script for transforming state updates and commands from the Thing handler to the item. The script may return null to discard the updates/commands and not pass them through.",
"label": "Thing To Item Transformation",
"name": "toItemScript",
"required": false,
"type": "TEXT",
"readOnly": false,
"multiple": false,
"advanced": false,
"verify": false,
"limitToOptions": true,
"options": [],
"filterCriteria": []
},
{
"description": "The Script for transforming commands from the item to the Thing handler. The script may return null to discard the commands and not pass them through.",
"label": "Item To Thing Transformation",
"name": "toHandlerScript",
"required": false,
"type": "TEXT",
"readOnly": false,
"multiple": false,
"advanced": false,
"verify": false,
"limitToOptions": true,
"options": [],
"filterCriteria": []
}
],
"parameterGroups": []
} |
That's really strange, because DSL is in no way different from the other languages, it is handled by the exact same code. Maybe the difference is that you have defined transformations for other languages? |
If you are going to do an inline script, you'd still have to supply the whole thing, right? So there'd be no advantage or even a point in selecting the language first. I was thinking there being an "other" option in the list which just consists of the text field. I think @J-N-K is right, if you don't have a transform defined for a given language, you get a text field. However, if you have even one transform defined for a language, you only can choose from the the already existing transforms without the possibility to define an inline transform. |
Without defined transformation:
With defined transformation:
I think |
After openhab/openhab-core#3730 (e.g. tested on openHAB 4.0.2), all I'm getting is the text input. It does not present me with a list of existing .rb transformations that exist in conf/transform directory or managed transformation). I'd imagine this applies to JS and any other script transformation profile types. Can we have both text input and a list of existing compatible transformations? |
My apologies. It seems that there's a hidden drop down selection that would pop up when you click on the input field. However, there seems to be a bug but I'll open a separate issue about it. |
The problem
Inline script support for channel transformation profiles seems to exist for python and DSL, but is not there for ECMAScript since it presents a list of existing scripts rather than a text field (see below screenshot)
I believe earlier milestones had the custom text field also for ECMAScript.
Your suggestion
The list of scripts is also nice, so perhaps the list and an additional text field as well?
Your environment
The text was updated successfully, but these errors were encountered: