From ba08eb00390325641acd92113c062a01dfd27e36 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 20 Jul 2021 20:53:27 +0100 Subject: [PATCH] Fix Select-based setting breaking admin pages --- .../core/js/src/admin/components/AdminPage.js | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/framework/core/js/src/admin/components/AdminPage.js b/framework/core/js/src/admin/components/AdminPage.js index c5f3496a1..8ecfbdd12 100644 --- a/framework/core/js/src/admin/components/AdminPage.js +++ b/framework/core/js/src/admin/components/AdminPage.js @@ -98,39 +98,37 @@ export default class AdminPage extends Page { return entry.call(this); } - const { setting, help, ...componentAttrs } = entry; + const { setting, help, type, label, ...componentAttrs } = entry; - const value = this.setting([setting])(); - if (['bool', 'checkbox', 'switch', 'boolean'].includes(componentAttrs.type)) { + const value = this.setting(setting)(); + + if (['bool', 'checkbox', 'switch', 'boolean'].includes(type)) { return (
- {componentAttrs.label} + {label}
{help}
); - } else if (['select', 'dropdown', 'selectdropdown'].includes(componentAttrs.type)) { + } else if (['select', 'dropdown', 'selectdropdown'].includes(type)) { + const { default: defaultValue, options } = componentAttrs; + return (
- +
{help}
-
); } else { componentAttrs.className = classList(['FormControl', componentAttrs.className]); + return (
- {componentAttrs.label ? : ''} + {label ? : ''}
{help}
- +
); }