From 1ac4526ef5ec44b3f78771c48f778d096f7082de Mon Sep 17 00:00:00 2001 From: Mark Herwege Date: Mon, 16 Sep 2024 08:48:08 +0200 Subject: [PATCH 01/32] check language installed for blockly and when running Signed-off-by: Mark Herwege --- .../components/rule/action-module-wizard.vue | 13 +++++- .../settings/rules/script/script-edit.vue | 46 ++++++++++++++++--- .../rules/script/script-general-settings.vue | 1 + 3 files changed, 53 insertions(+), 7 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/components/rule/action-module-wizard.vue b/bundles/org.openhab.ui/web/src/components/rule/action-module-wizard.vue index c8c1b99377..f36b97cd73 100644 --- a/bundles/org.openhab.ui/web/src/components/rule/action-module-wizard.vue +++ b/bundles/org.openhab.ui/web/src/components/rule/action-module-wizard.vue @@ -91,7 +91,8 @@ @@ -187,6 +188,9 @@ export default { } return [] + }, + isJSAvailable () { + return this.isMimeTypeAvailable(this.GRAALJS_MIME_TYPE) || this.isMimeTypeAvailable(this.NASHORNJS_MIME_TYPE) } }, methods: { @@ -278,6 +282,13 @@ export default { this.currentItem = value this.$set(this.currentModule.configuration, 'itemName', value.name) this.$emit('typeSelect', 'core.ItemCommandAction') + }, + isMimeTypeAvailable (mimeType) { + return this.languages.map(l => l.contentType).includes(mimeType) + }, + created () { + this.GRAALJS_MIME_TYPE = 'application/javascript' + this.NASHORNJS_MIME_TYPE = 'application/javascript;version=ECMAScript-5.1' } } } diff --git a/bundles/org.openhab.ui/web/src/pages/settings/rules/script/script-edit.vue b/bundles/org.openhab.ui/web/src/pages/settings/rules/script/script-edit.vue index 833207f6f7..a9b7894eea 100644 --- a/bundles/org.openhab.ui/web/src/pages/settings/rules/script/script-edit.vue +++ b/bundles/org.openhab.ui/web/src/pages/settings/rules/script/script-edit.vue @@ -25,9 +25,22 @@ - From 742bdf61a6b3d8b6e2859f58f906631e906fb1d8 Mon Sep 17 00:00:00 2001 From: Mark Herwege Date: Mon, 16 Sep 2024 08:55:00 +0200 Subject: [PATCH 26/32] js scripting check in module wizards Signed-off-by: Mark Herwege --- .../web/src/components/rule/action-module-wizard.vue | 10 ---------- .../src/components/rule/condition-module-wizard.vue | 3 ++- .../web/src/components/rule/module-wizard-mixin.js | 9 +++++++++ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/components/rule/action-module-wizard.vue b/bundles/org.openhab.ui/web/src/components/rule/action-module-wizard.vue index f36b97cd73..fa38c8a587 100644 --- a/bundles/org.openhab.ui/web/src/components/rule/action-module-wizard.vue +++ b/bundles/org.openhab.ui/web/src/components/rule/action-module-wizard.vue @@ -188,9 +188,6 @@ export default { } return [] - }, - isJSAvailable () { - return this.isMimeTypeAvailable(this.GRAALJS_MIME_TYPE) || this.isMimeTypeAvailable(this.NASHORNJS_MIME_TYPE) } }, methods: { @@ -282,13 +279,6 @@ export default { this.currentItem = value this.$set(this.currentModule.configuration, 'itemName', value.name) this.$emit('typeSelect', 'core.ItemCommandAction') - }, - isMimeTypeAvailable (mimeType) { - return this.languages.map(l => l.contentType).includes(mimeType) - }, - created () { - this.GRAALJS_MIME_TYPE = 'application/javascript' - this.NASHORNJS_MIME_TYPE = 'application/javascript;version=ECMAScript-5.1' } } } diff --git a/bundles/org.openhab.ui/web/src/components/rule/condition-module-wizard.vue b/bundles/org.openhab.ui/web/src/components/rule/condition-module-wizard.vue index c15156a2f9..db11caaa5e 100644 --- a/bundles/org.openhab.ui/web/src/components/rule/condition-module-wizard.vue +++ b/bundles/org.openhab.ui/web/src/components/rule/condition-module-wizard.vue @@ -62,7 +62,8 @@ diff --git a/bundles/org.openhab.ui/web/src/components/rule/module-wizard-mixin.js b/bundles/org.openhab.ui/web/src/components/rule/module-wizard-mixin.js index dd6ed1607f..7acf9e14a1 100644 --- a/bundles/org.openhab.ui/web/src/components/rule/module-wizard-mixin.js +++ b/bundles/org.openhab.ui/web/src/components/rule/module-wizard-mixin.js @@ -45,6 +45,9 @@ export default { } return ['ON', 'OFF'].map((c) => { return { value: c, label: c } }) + }, + isJSAvailable () { + return this.isMimeTypeAvailable(this.GRAALJS_MIME_TYPE) } }, methods: { @@ -69,6 +72,12 @@ export default { this.$f7.once('modelPickerClosed', () => { this.$f7.off('itemsPicked', this.itemPicked) }) + }, + isMimeTypeAvailable (mimeType) { + return this.languages.map(l => l.contentType).includes(mimeType) + }, + created () { + this.GRAALJS_MIME_TYPE = 'application/javascript' } } } From 953f1daf44b0d1ad57d992276eba93420ef35ae0 Mon Sep 17 00:00:00 2001 From: Mark Herwege Date: Mon, 16 Sep 2024 08:55:00 +0200 Subject: [PATCH 27/32] always check JS scripting installed Signed-off-by: Mark Herwege --- .../pages/settings/rules/script/script-edit.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/pages/settings/rules/script/script-edit.vue b/bundles/org.openhab.ui/web/src/pages/settings/rules/script/script-edit.vue index f08892ea9c..5600a14fc8 100644 --- a/bundles/org.openhab.ui/web/src/pages/settings/rules/script/script-edit.vue +++ b/bundles/org.openhab.ui/web/src/pages/settings/rules/script/script-edit.vue @@ -594,8 +594,11 @@ export default { } }, onBlocklyReady () { + if (!this.isBlockly) return + let message = '' + // Make sure the MIME type is set correctly for Blockly rules and the saved script is up to date - if (this.isBlockly && this.script) { + if (this.script) { let oldRule = false if (this.mode !== this.GRAALJS_MIME_TYPE) { this.mode = this.GRAALJS_MIME_TYPE @@ -612,10 +615,13 @@ export default { this.$f7.dialog.alert(e) } } - if (oldRule) { - this.$f7.dialog.alert('Your Blockly script was created with a previous version of openHAB. Please save your script again and make sure the JS Scripting addon is installed.') - } + if (oldRule) message += 'Your Blockly script was created with a previous version of openHAB. Please save your script' } + + // Check if JS Scripting is installed + if (!this.isJSAvailable) message += (message ? ' and' : 'You do not have JS Scripting installed. Please') + ' install the JS Scripting addon' + + if (message) this.$f7.dialog.alert(message + '.') }, setBlocklyRenderer (newRenderer) { this.blocklyRenderer = newRenderer From 4664b844aec162b0ba4c43a7569e8db6600b1ef5 Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Mon, 16 Sep 2024 16:53:33 +0200 Subject: [PATCH 28/32] Fix JS installed check not properly working for action/condition module wizard Signed-off-by: Florian Hotze --- .../web/src/components/rule/action-module-wizard.vue | 2 +- .../web/src/components/rule/condition-module-wizard.vue | 2 +- .../web/src/components/rule/module-wizard-mixin.js | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/components/rule/action-module-wizard.vue b/bundles/org.openhab.ui/web/src/components/rule/action-module-wizard.vue index fa38c8a587..dd3cebc1b0 100644 --- a/bundles/org.openhab.ui/web/src/components/rule/action-module-wizard.vue +++ b/bundles/org.openhab.ui/web/src/components/rule/action-module-wizard.vue @@ -92,7 +92,7 @@ diff --git a/bundles/org.openhab.ui/web/src/components/rule/condition-module-wizard.vue b/bundles/org.openhab.ui/web/src/components/rule/condition-module-wizard.vue index db11caaa5e..65da7366ce 100644 --- a/bundles/org.openhab.ui/web/src/components/rule/condition-module-wizard.vue +++ b/bundles/org.openhab.ui/web/src/components/rule/condition-module-wizard.vue @@ -63,7 +63,7 @@ diff --git a/bundles/org.openhab.ui/web/src/components/rule/module-wizard-mixin.js b/bundles/org.openhab.ui/web/src/components/rule/module-wizard-mixin.js index 7acf9e14a1..c12a09cb1c 100644 --- a/bundles/org.openhab.ui/web/src/components/rule/module-wizard-mixin.js +++ b/bundles/org.openhab.ui/web/src/components/rule/module-wizard-mixin.js @@ -46,8 +46,8 @@ export default { return ['ON', 'OFF'].map((c) => { return { value: c, label: c } }) }, - isJSAvailable () { - return this.isMimeTypeAvailable(this.GRAALJS_MIME_TYPE) + isJsAvailable () { + return this.isMimeTypeAvailable('application/javascript') } }, methods: { @@ -75,9 +75,6 @@ export default { }, isMimeTypeAvailable (mimeType) { return this.languages.map(l => l.contentType).includes(mimeType) - }, - created () { - this.GRAALJS_MIME_TYPE = 'application/javascript' } } } From a398d7f567e39f55403d01f4345f51b3d1a0d5d5 Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Mon, 16 Sep 2024 16:58:27 +0200 Subject: [PATCH 29/32] Change naming of computed value to be camel case Signed-off-by: Florian Hotze --- .../web/src/pages/settings/rules/script/script-edit.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/pages/settings/rules/script/script-edit.vue b/bundles/org.openhab.ui/web/src/pages/settings/rules/script/script-edit.vue index 5600a14fc8..f837e8a7b4 100644 --- a/bundles/org.openhab.ui/web/src/pages/settings/rules/script/script-edit.vue +++ b/bundles/org.openhab.ui/web/src/pages/settings/rules/script/script-edit.vue @@ -85,7 +85,7 @@ @@ -230,7 +230,7 @@ export default { isBlockly () { return this.currentModule && this.currentModule.configuration && this.currentModule.configuration.blockSource }, - isJSAvailable () { + isJsAvailable () { return this.isMimeTypeAvailable(this.GRAALJS_MIME_TYPE) } }, @@ -619,7 +619,7 @@ export default { } // Check if JS Scripting is installed - if (!this.isJSAvailable) message += (message ? ' and' : 'You do not have JS Scripting installed. Please') + ' install the JS Scripting addon' + if (!this.isJsAvailable) message += (message ? ' and' : 'You do not have JS Scripting installed. Please') + ' install the JS Scripting addon' if (message) this.$f7.dialog.alert(message + '.') }, From f9b7b8e8c8ecf2521c445120b53d786ba0233fa4 Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Mon, 16 Sep 2024 16:58:37 +0200 Subject: [PATCH 30/32] blockly-editor: Declare emits Signed-off-by: Florian Hotze --- .../web/src/components/config/controls/blockly-editor.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/bundles/org.openhab.ui/web/src/components/config/controls/blockly-editor.vue b/bundles/org.openhab.ui/web/src/components/config/controls/blockly-editor.vue index 83d7b060f8..a78276110a 100644 --- a/bundles/org.openhab.ui/web/src/components/config/controls/blockly-editor.vue +++ b/bundles/org.openhab.ui/web/src/components/config/controls/blockly-editor.vue @@ -1191,6 +1191,7 @@ Vue.config.ignoredElements = [ export default { props: ['blocks', 'libraryDefinitions'], + emits: ['mounted', 'ready', 'change'], data () { return { blockLibraries: null, From bcdd276dc9d4feb1bce0446245b7c42315c4352b Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Mon, 16 Sep 2024 16:59:03 +0200 Subject: [PATCH 31/32] Notification blocks: Fix code generation for log notification block Signed-off-by: Florian Hotze --- .../web/src/assets/definitions/blockly/blocks-notifications.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.ui/web/src/assets/definitions/blockly/blocks-notifications.js b/bundles/org.openhab.ui/web/src/assets/definitions/blockly/blocks-notifications.js index 14e6132823..a30a914814 100644 --- a/bundles/org.openhab.ui/web/src/assets/definitions/blockly/blocks-notifications.js +++ b/bundles/org.openhab.ui/web/src/assets/definitions/blockly/blocks-notifications.js @@ -78,7 +78,7 @@ export default function defineOHBlocks_Notifications (f7) { const message = javascriptGenerator.valueToCode(block, 'message', javascriptGenerator.ORDER_ATOMIC) const icon = javascriptGenerator.valueToCode(block, 'icon', javascriptGenerator.ORDER_ATOMIC) const severity = block.getFieldValue('severity') - return `actions.notificationBuilder(${message}).withIcon(${icon}).withTag('${severity}').send();\n` + return `actions.notificationBuilder(${message}).logOnly().withIcon(${icon}).withTag('${severity}').send();\n` } const usersImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAL7ElEQVRYhY1Xa3BUZZp+zjl9Tp++nnSn00nfknTnSgwpkxjBDBIBpcSkWApqa4Ow1DCU4rICppiV3WWJQLk1w/xgaobaLctatHagvIyxRC5q1hCSIIgoJkUkJpCkDd3ppJu+JX3vc/p8+0PpGgVn96k659d3znt7vud9X8rlcgEAcrkcCCF4/PHHYTQakclkIMsyeJ7HzMwMHA4HysvLVzscjo6SkpI2vV5fxzAMTwgBISSbSCRuzc3NXXK73ee+/fbbj6LRKOx2O+LxOFiWhSzLkCQJn332GURRhEKhAAB8//4JaJqGJEnw+/1wu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VJKkm5Ik6TUajZ4QorknSqIoIpPJhCcnJ69++umnhw4fPvy3b7zxxsC2bdu2DQ4OjhQWFiq7uroe8ng8N3O5HHK5HBiG+b4vOJ3OPGF+GCgRi8WQTCaxbdu2Y5s2ber66quvpI8//njfmTNn/pjL5VBdXQ2Xy4X5+XkbIQR2u31+ZGQkNzs7C47jsGrVqm0dHR1/bGtrEz744IP/fu+9936ZSqVgMBgwNDT0o+X0PgdWrVoFlUqFUCiEdDqNhx9+2LF27dqjTqdzcyqVgtvtvuP1egez2ewXc3NztwEQs9lcTlHUsrKyspVVVVVVgiBgbGzsXH9//8tXr1791mKxgOd5ZLPZ+7bjBzqgVCqRSqXAcRzMZjMCgQB4nlfW19d3lpaWrrdYLCsZhjHd+8kP0050fn7+itvtPjM6OvrO3NzcQnFxMVKpFHiehyRJD1zP/xecT9Vzx69iBQAAAABJRU5ErkJggg==' From fda6c2897f70ad317caf0db0806eeb2414dfce62 Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Mon, 16 Sep 2024 17:19:13 +0200 Subject: [PATCH 32/32] Move add-on names for MIME types to asset Signed-off-by: Florian Hotze --- .../web/src/assets/definitions/automation-languages.js | 7 +++++++ .../web/src/pages/settings/rules/script/script-edit.vue | 8 ++------ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 bundles/org.openhab.ui/web/src/assets/definitions/automation-languages.js diff --git a/bundles/org.openhab.ui/web/src/assets/definitions/automation-languages.js b/bundles/org.openhab.ui/web/src/assets/definitions/automation-languages.js new file mode 100644 index 0000000000..22a75b6911 --- /dev/null +++ b/bundles/org.openhab.ui/web/src/assets/definitions/automation-languages.js @@ -0,0 +1,7 @@ +export const AddonNames = { + 'application/javascript': 'JavaScript Scripting', + 'application/javascript;version=ECMAScript-5.1': 'JavaScript Scripting (Nashorn)', + 'application/x-groovy': 'Groovy Scripting', + 'application/x-python': 'Jython Scripting', + 'application/x-ruby': 'JRuby Scripting' +} diff --git a/bundles/org.openhab.ui/web/src/pages/settings/rules/script/script-edit.vue b/bundles/org.openhab.ui/web/src/pages/settings/rules/script/script-edit.vue index f837e8a7b4..051ec4ba27 100644 --- a/bundles/org.openhab.ui/web/src/pages/settings/rules/script/script-edit.vue +++ b/bundles/org.openhab.ui/web/src/pages/settings/rules/script/script-edit.vue @@ -156,6 +156,7 @@ import RuleStatus from '@/components/rule/rule-status-mixin' import ScriptGeneralSettings from './script-general-settings.vue' import ModuleDescriptionSuggestions from '../module-description-suggestions' import DirtyMixin from '../../dirty-mixin' +import { AddonNames } from '@/assets/definitions/automation-languages' export default { mixins: [RuleStatus, ModuleDescriptionSuggestions, DirtyMixin], @@ -385,11 +386,7 @@ export default { return this.languages.map(l => l.contentType).includes(mimeType) }, mimeTypeDescription (mode) { - if (mode === this.GRAALJS_MIME_TYPE) return 'JS Scripting' - if (mode === this.NASHORNJS_MIME_TYPE) return 'JS Scripting (Nashorn)' - if (mode === 'py') return 'Jython Scripting' - if (mode === 'rb' || mode === 'application/x-ruby') return 'JRuby Scripting' - return mode + return AddonNames[mode] || mode }, /** * Load the script module type, i.e. the available script languages @@ -701,7 +698,6 @@ export default { }, created () { this.GRAALJS_MIME_TYPE = 'application/javascript' - this.NASHORNJS_MIME_TYPE = 'application/javascript;version=ECMAScript-5.1' } }