Merge pull request #4128 from Budibase/fix/4126
Fix query binding drawer bindable options
This commit is contained in:
commit
78dc55e2d9
|
@ -55,8 +55,8 @@
|
|||
<div>
|
||||
<BindingBuilder
|
||||
bind:customParams={parameters.queryParams}
|
||||
bindings={query.parameters}
|
||||
bind:bindableOptions={bindings}
|
||||
queryBindings={query.parameters}
|
||||
bind:bindings
|
||||
/>
|
||||
<IntegrationQueryEditor
|
||||
height={200}
|
||||
|
|
|
@ -169,8 +169,8 @@
|
|||
{#if getQueryParams(value).length > 0}
|
||||
<BindingBuilder
|
||||
bind:customParams={tmpQueryParams}
|
||||
bindings={getQueryParams(value)}
|
||||
bind:bindableOptions={bindings}
|
||||
queryBindings={getQueryParams(value)}
|
||||
bind:bindings
|
||||
/>
|
||||
{/if}
|
||||
<IntegrationQueryEditor
|
||||
|
|
|
@ -7,27 +7,26 @@
|
|||
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
|
||||
|
||||
export let bindable = true
|
||||
export let queryBindings = []
|
||||
export let bindings = []
|
||||
export let bindableOptions = []
|
||||
export let customParams = {}
|
||||
|
||||
function newQueryBinding() {
|
||||
bindings = [...bindings, {}]
|
||||
queryBindings = [...queryBindings, {}]
|
||||
}
|
||||
|
||||
$: console.log(bindings)
|
||||
|
||||
function deleteQueryBinding(idx) {
|
||||
bindings.splice(idx, 1)
|
||||
bindings = bindings
|
||||
queryBindings.splice(idx, 1)
|
||||
queryBindings = queryBindings
|
||||
}
|
||||
|
||||
// This is necessary due to the way readable and writable bindings are stored.
|
||||
// The readable binding in the UI gets converted to a UUID value that the client understands
|
||||
// for parsing, then converted back so we can display it the readable form in the UI
|
||||
function onBindingChange(param, valueToParse) {
|
||||
customParams[param] = readableToRuntimeBinding(
|
||||
bindableOptions,
|
||||
valueToParse
|
||||
)
|
||||
customParams[param] = readableToRuntimeBinding(bindings, valueToParse)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -49,7 +48,7 @@
|
|||
{/if}
|
||||
</Body>
|
||||
<div class="bindings" class:bindable>
|
||||
{#each bindings as binding, idx}
|
||||
{#each queryBindings as binding, idx}
|
||||
<Input
|
||||
placeholder="Binding Name"
|
||||
thin
|
||||
|
@ -69,10 +68,10 @@
|
|||
thin
|
||||
on:change={evt => onBindingChange(binding.name, evt.detail)}
|
||||
value={runtimeToReadableBinding(
|
||||
bindableOptions,
|
||||
bindings,
|
||||
customParams?.[binding.name]
|
||||
)}
|
||||
{bindableOptions}
|
||||
{bindings}
|
||||
/>
|
||||
{:else}
|
||||
<Icon hoverable name="Close" on:click={() => deleteQueryBinding(idx)} />
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
config={integrationInfo.extra}
|
||||
/>
|
||||
{/if}
|
||||
<BindingBuilder bind:bindings={query.parameters} bindable={false} />
|
||||
<BindingBuilder bind:queryBindings={query.parameters} bindable={false} />
|
||||
{/if}
|
||||
</div>
|
||||
{#if shouldShowQueryConfig}
|
||||
|
|
Loading…
Reference in New Issue