From f60cc18a70a475f70fc6230720ecd6b00d0ef595 Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Wed, 26 Jul 2023 17:49:01 +0200 Subject: [PATCH 1/4] oh-colorpicker: Fix error thrown when defaultColor is not defined Signed-off-by: Florian Hotze --- .../web/src/components/widgets/system/oh-colorpicker.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.ui/web/src/components/widgets/system/oh-colorpicker.vue b/bundles/org.openhab.ui/web/src/components/widgets/system/oh-colorpicker.vue index 352bcda514..8206d958bf 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/system/oh-colorpicker.vue +++ b/bundles/org.openhab.ui/web/src/components/widgets/system/oh-colorpicker.vue @@ -46,7 +46,14 @@ export default { color[2] = color[2] / 100 return color } - return JSON.parse(this.config.defaultColor) || null + if (this.config.defaultColor) { + try { + return JSON.parse(this.config.defaultColor) + } catch { + return null + } + } + return null } }, watch: { From 110498a0ce0a5b49bf0c09a5ba1e66ccde3be3b5 Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Wed, 26 Jul 2023 17:57:48 +0200 Subject: [PATCH 2/4] oh-colorpicker: Fix command cannot be sent if state is NULL or - Signed-off-by: Florian Hotze --- .../web/src/components/widgets/system/oh-colorpicker.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/components/widgets/system/oh-colorpicker.vue b/bundles/org.openhab.ui/web/src/components/widgets/system/oh-colorpicker.vue index 8206d958bf..ffaf76dd66 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/system/oh-colorpicker.vue +++ b/bundles/org.openhab.ui/web/src/components/widgets/system/oh-colorpicker.vue @@ -126,8 +126,8 @@ export default { }, areHSBEqual (hsb1, hsb2) { // for the purposes of NOT entering an endless loop, we consider transient non-HSB values to be equal - if (hsb1.length !== hsb2.length) return true - if (hsb1.length !== 3 || hsb2.length !== 3) return true + if (hsb1.length !== hsb2.length) return false + if (hsb1.length !== 3 || hsb2.length !== 3) return false return (hsb1[0] === hsb2[0] && hsb1[1] === hsb2[1] && hsb1[2] === hsb2[2]) }, roundedHSB (state) { From 6310dd98c2dacc8ed525806f6d941ea2fe610d2f Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Thu, 27 Jul 2023 23:54:04 +0200 Subject: [PATCH 3/4] oh-colorpicker: Allow setting style Fixes #1713. Signed-off-by: Florian Hotze --- .../web/src/components/widgets/system/oh-colorpicker.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/components/widgets/system/oh-colorpicker.vue b/bundles/org.openhab.ui/web/src/components/widgets/system/oh-colorpicker.vue index ffaf76dd66..b916fc31eb 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/system/oh-colorpicker.vue +++ b/bundles/org.openhab.ui/web/src/components/widgets/system/oh-colorpicker.vue @@ -1,11 +1,13 @@