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}
/>
{/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}
</div>
{#if shouldShowQueryConfig}

View File

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