From 597e6f169841ac42d2bf1c0dbb006d488d892f72 Mon Sep 17 00:00:00 2001 From: David Whittaker <84562015+whitdog47@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:16:28 -0800 Subject: [PATCH] fix(ui): adding enums to configuration form (#5539) --- src/dispatch/static/dispatch/src/plugin/store.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/dispatch/static/dispatch/src/plugin/store.js b/src/dispatch/static/dispatch/src/plugin/store.js index ccf54148c07c..d18360600f82 100644 --- a/src/dispatch/static/dispatch/src/plugin/store.js +++ b/src/dispatch/static/dispatch/src/plugin/store.js @@ -183,6 +183,22 @@ function convertToFormkit(json_schema) { help: value.description, }, } + } else if (value.allOf) { + const ref = value.allOf[0].$ref + // will be something like "#/definitions/HostingType" + const ref_name = ref.split("/").pop() + const ref_obj = json_schema.definitions[ref_name]["enum"] + obj = { + $formkit: "select", + name: key, + label: value.title, + help: value.description, + options: ref_obj.map((item) => { + return { label: item, value: item } + }), + default: value.default, + validation: "required", + } } formkit_schema.push(obj) }