Refresh BindingBuilder if query.parameters changes

This commit is contained in:
Mel O'Hagan 2022-11-02 11:22:48 +00:00
parent 0faf4e78ba
commit 2ff3cb5fcc
2 changed files with 20 additions and 7 deletions

View File

@ -132,7 +132,15 @@
config={integrationInfo.extra} config={integrationInfo.extra}
/> />
{/if} {/if}
<BindingBuilder bind:queryBindings={query.parameters} bindable={false} /> {#key query.parameters}
<BindingBuilder
queryBindings={query.parameters}
bindable={false}
on:change={e => {
query.parameters = e.detail
}}
/>
{/key}
{/if} {/if}
</div> </div>
{#if shouldShowQueryConfig} {#if shouldShowQueryConfig}

View File

@ -2,6 +2,7 @@
import { Body, Button, Heading, Layout } from "@budibase/bbui" import { Body, Button, Heading, Layout } from "@budibase/bbui"
import KeyValueBuilder from "components/integration/KeyValueBuilder.svelte" import KeyValueBuilder from "components/integration/KeyValueBuilder.svelte"
import { getUserBindings } from "builderStore/dataBinding" import { getUserBindings } from "builderStore/dataBinding"
import { createEventDispatcher } from "svelte"
export let bindable = true export let bindable = true
export let queryBindings = [] export let queryBindings = []
@ -11,6 +12,7 @@
acc[binding.name] = binding.default acc[binding.name] = binding.default
return acc return acc
}, {}) }, {})
let dispatch = createEventDispatcher()
function newQueryBinding() { function newQueryBinding() {
queryBindings = [...queryBindings, {}] queryBindings = [...queryBindings, {}]
@ -45,12 +47,15 @@
bindings={[...userBindings]} bindings={[...userBindings]}
bindingDrawerLeft="260px" bindingDrawerLeft="260px"
on:change={e => { on:change={e => {
queryBindings = e.detail.map(binding => { dispatch(
"change",
e.detail.map(binding => {
return { return {
name: binding.name, name: binding.name,
default: binding.value, default: binding.value,
} }
}) })
)
}} }}
/> />
</div> </div>