openhab / openhab-js

openHAB JavaScript Library for JavaScript Scripting Automation
https://www.openhab.org/addons/automation/jsscripting/
Eclipse Public License 2.0
38 stars 31 forks source link

[rules] Display `execute` code of `JSRule` in MainUI #199

Closed florian-h05 closed 1 year ago

florian-h05 commented 1 year ago

Replaces/Superseds #173.

Fixes https://github.com/openhab/openhab-addons/issues/12929.

Description

With this PR, the JSRule API adds additional information to the rule‘s action, so that MainUI is able to display the code that is executed when the rule runs together with a comment note. The execute function is stringified by calling the JS toString method on the function, Rule Builder is currently not supported (some useless code is displayed).

To Do

@jpg0 WDYT?

jpg0 commented 1 year ago

I'm no typescript expert, but the plain JS looks good to me. Happy to merge if there is no danger in the ts?

florian-h05 commented 1 year ago

The ts code is no danger, it can never break the library's functionality. The worst thing that can happen with the ts files is, that the autocompletion doesn't work. I have just updated the CHANGELOG, feel free to merge @jpg0!