-
-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transformations: Various enhancements & fixes (#1845)
Closes #1844. * Allows to copy the UID. * Sorts the transformation types in the "by types" list alphabetically and makes the segment labels uppercase to match the transformation service names. * Adjusts to recent core change openhab/openhab-core#3487: removes the script language selection and updates the editor mode and code snippet injection. * Extends language support and refactors the translate mode logic in `script-editor.vue`. * Fixes the clear label button not displayed in create mode and displayed for non-editable transformations. * Shows a tip on how to use the transformation for Item states. * Fixes failing and not required API request after transformation creation. * Removes possibility to select and attempt to delete not-editable transformations, which is not possible and failed. Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
- Loading branch information
1 parent
af1b0a3
commit b317e98
Showing
5 changed files
with
94 additions
and
85 deletions.
There are no files selected for viewing
25 changes: 18 additions & 7 deletions
25
bundles/org.openhab.ui/web/src/assets/definitions/transformations.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
export default { | ||
SNIPPETS: { | ||
SCRIPT: { | ||
'application/vnd.openhab.dsl.rule': 'var returnValue = "String has " + input.length + " characters"\n\nreturnValue', | ||
'application/javascript': '(function(data) {\n var returnValue = "String has " + data.length + " characters"\n return returnValue\n})(input)', | ||
'application/javascript;version=ECMAScript-5.1': '(function(data) {\n var returnValue = "String has " + data.length + " characters"\n return returnValue\n})(input)', | ||
'application/x-ruby': '"String has #{input.length} characters"' | ||
} | ||
DSL: 'var returnValue = "String has " + input.length + " characters"\n\nreturnValue', | ||
JINJA: '{# Available values:\nvalue - The incoming value.\nvalue_json - The incoming value parsed as JSON. #}\n{{value_json[\'AM2301\'].Temperature}}', | ||
JS: '(function(data) {\n var returnValue = "String has " + data.length + " characters"\n return returnValue\n})(input)', | ||
NASHORNJS: '(function(data) {\n var returnValue = "String has " + data.length + " characters"\n return returnValue\n})(input)', | ||
MAP: 'key=value\n=default', | ||
RB: '"String has #{input.length} characters"', | ||
XSLT: '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n' + | ||
'<xsl:stylesheet version=\'2.0\' xmlns:xsl=\'http://www.w3.org/1999/XSL/Transform\'>\n' + | ||
' <xsl:output method=\'xml\' indent=\'no\'/>\n' + | ||
' <xsl:template match=\'/\'>\n' + | ||
' <reRoot><reNode><xsl:value-of select=\'/root/node/@val\' /> world</reNode></reRoot>\n' + | ||
' </xsl:template>\n' + | ||
'</xsl:stylesheet>' | ||
}, | ||
EDITOR_MODES: { | ||
DSL: 'application/vnd.openhab.dsl.rule', | ||
EXEC: 'application/x-sh', | ||
MAP: 'text/x-properties', | ||
SCALE: 'text/x-properties' | ||
NASHORNJS: 'application/javascript;version=ECMAScript-5.1', | ||
SCALE: 'text/x-properties', | ||
XSLT: 'application/xml' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters