diff --git a/packages/builder/src/components/workflow/SetupPanel/ParamInputs/ModelSelector.svelte b/packages/builder/src/components/workflow/SetupPanel/ParamInputs/ModelSelector.svelte index b600e87dc6..ac09a328c1 100644 --- a/packages/builder/src/components/workflow/SetupPanel/ParamInputs/ModelSelector.svelte +++ b/packages/builder/src/components/workflow/SetupPanel/ParamInputs/ModelSelector.svelte @@ -2,12 +2,19 @@ import { backendUiStore } from "builderStore" export let value - let modelId = value ? value._id : "" - $: value = $backendUiStore.models.find(x => x._id === modelId) + $: modelId = value ? value._id : "" + + function onChange(e) { + value = $backendUiStore.models.find(x => x._id === e.target.value) + }
- {#each $backendUiStore.models as model} diff --git a/packages/builder/src/components/workflow/SetupPanel/ParamInputs/RecordSelector.svelte b/packages/builder/src/components/workflow/SetupPanel/ParamInputs/RecordSelector.svelte index 436252be39..0df942c035 100644 --- a/packages/builder/src/components/workflow/SetupPanel/ParamInputs/RecordSelector.svelte +++ b/packages/builder/src/components/workflow/SetupPanel/ParamInputs/RecordSelector.svelte @@ -3,8 +3,12 @@ import { Input, Label } from "@budibase/bbui" export let value - let modelId = value && value.model ? value.model._id : "" - $: value.model = $backendUiStore.models.find(x => x._id === modelId) + $: modelId = value && value.model ? value.model._id : "" + $: schemaFields = Object.keys(value && value.model ? value.model.schema : {}) + + function onChangeModel(e) { + value.model = $backendUiStore.models.find(x => x._id === e.target.value) + } function setParsedValue(evt, field) { const fieldSchema = value.model.schema[field] @@ -17,7 +21,11 @@
- {#each $backendUiStore.models as model} @@ -25,10 +33,10 @@
-{#if value.model} +{#if schemaFields.length}
- {#each Object.keys(value.model.schema) as field} + {#each schemaFields as field}