From 885e36339c95ba7ca8d098a6b5e6e8d848b868e5 Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Tue, 26 Sep 2023 18:26:50 +0200 Subject: [PATCH 1/2] Internally rename modalParams to modalConfig Signed-off-by: Florian Hotze --- .../web/src/components/widgets/modals/modal-mixin.js | 4 ++-- .../web/src/components/widgets/widget-actions.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/components/widgets/modals/modal-mixin.js b/bundles/org.openhab.ui/web/src/components/widgets/modals/modal-mixin.js index 154c1629f5..1b723f5310 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/modals/modal-mixin.js +++ b/bundles/org.openhab.ui/web/src/components/widgets/modals/modal-mixin.js @@ -7,7 +7,7 @@ export default { 'oh-plan-page': () => import('@/components/widgets/plan/oh-plan-page.vue'), 'oh-chart-page': () => import('@/components/widgets/chart/oh-chart-page.vue') }, - props: ['uid', 'el', 'modalParams'], + props: ['uid', 'el', 'modalConfig'], data () { return { currentTab: 0, @@ -22,7 +22,7 @@ export default { component: component, root: component, store: this.$store.getters.trackedItems, - props: this.modalParams, + props: this.modalConfig, vars: this.vars } }, diff --git a/bundles/org.openhab.ui/web/src/components/widgets/widget-actions.js b/bundles/org.openhab.ui/web/src/components/widgets/widget-actions.js index cfb0e00971..a63abb36f7 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/widget-actions.js +++ b/bundles/org.openhab.ui/web/src/components/widgets/widget-actions.js @@ -179,7 +179,7 @@ export const actionsMixin = { const actionModal = actionConfig[prefix + 'actionModal'] const actionModalConfig = actionConfig[prefix + 'actionModalConfig'] if (actionModal.indexOf('page:') !== 0 && actionModal.indexOf('widget:') !== 0 && actionModal.indexOf('oh-') !== 0) { - console.log('Action target is not of the format page:uid or widget:uid') + console.log('Action target is not of the format page:uid or widget:uid or oh-') return } @@ -196,7 +196,7 @@ export const actionsMixin = { props: { uid: actionModal, el: (evt && evt.target && evt.target._icon) ? evt.target._icon : (evt) ? evt.target : null, - modalParams: actionModalConfig || {} + modalConfig: actionModalConfig || {} } } this.$f7.views.main.router.navigate(modalRoute, modalProps) From 208def74652be7668905db3d4a9e6a9b496d8f71 Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Tue, 26 Sep 2023 19:40:32 +0200 Subject: [PATCH 2/2] Allow configuration of oh- components in modals Fixes #927. Signed-off-by: Florian Hotze --- .../web/src/components/widgets/modals/modal-mixin.js | 3 ++- .../web/src/components/widgets/widget-mixin.js | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/components/widgets/modals/modal-mixin.js b/bundles/org.openhab.ui/web/src/components/widgets/modals/modal-mixin.js index 1b723f5310..912e6e246e 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/modals/modal-mixin.js +++ b/bundles/org.openhab.ui/web/src/components/widgets/modals/modal-mixin.js @@ -23,7 +23,8 @@ export default { root: component, store: this.$store.getters.trackedItems, props: this.modalConfig, - vars: this.vars + vars: this.vars, + modalConfig: this.modalConfig // For configuration of oh- components } }, modalStyle () { diff --git a/bundles/org.openhab.ui/web/src/components/widgets/widget-mixin.js b/bundles/org.openhab.ui/web/src/components/widgets/widget-mixin.js index 7aa459e7ce..c528e008ef 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/widget-mixin.js +++ b/bundles/org.openhab.ui/web/src/components/widgets/widget-mixin.js @@ -59,8 +59,9 @@ export default { config () { if (!this.context || !this.context.component) return null let evalConfig = {} - if (this.context.component.config) { - const sourceConfig = this.context.component.config + // Fallback to modelConfig for oh- components to allow configuring them in modals + const sourceConfig = this.context.component.config || (this.componentType.startsWith('oh-') ? this.context.modalConfig : {}) + if (sourceConfig) { if (typeof sourceConfig !== 'object') return {} for (const key in sourceConfig) { if (key === 'visible' || key === 'visibleTo' || key === 'stylesheet') continue