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