From c427837d3e10484c4635aef1ce9c0fadbe7b7a5a Mon Sep 17 00:00:00 2001 From: David Whittaker Date: Mon, 25 Nov 2024 15:13:49 -0800 Subject: [PATCH 1/2] fix(ui): adding enums to configuration form --- .../static/dispatch/src/plugin/store.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/dispatch/static/dispatch/src/plugin/store.js b/src/dispatch/static/dispatch/src/plugin/store.js index ccf54148c07c..956c66032a5a 100644 --- a/src/dispatch/static/dispatch/src/plugin/store.js +++ b/src/dispatch/static/dispatch/src/plugin/store.js @@ -3,6 +3,7 @@ import { debounce } from "lodash" import SearchUtils from "@/search/utils" import PluginApi from "@/plugin/api" +import { de } from "date-fns/locale" const getDefaultSelectedState = () => { return { @@ -183,6 +184,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) } From b13848b883261fc82a55f14861e3e8f5a4e09cfa Mon Sep 17 00:00:00 2001 From: David Whittaker Date: Mon, 25 Nov 2024 15:46:21 -0800 Subject: [PATCH 2/2] removing lint error --- src/dispatch/static/dispatch/src/plugin/store.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/dispatch/static/dispatch/src/plugin/store.js b/src/dispatch/static/dispatch/src/plugin/store.js index 956c66032a5a..d18360600f82 100644 --- a/src/dispatch/static/dispatch/src/plugin/store.js +++ b/src/dispatch/static/dispatch/src/plugin/store.js @@ -3,7 +3,6 @@ import { debounce } from "lodash" import SearchUtils from "@/search/utils" import PluginApi from "@/plugin/api" -import { de } from "date-fns/locale" const getDefaultSelectedState = () => { return {