Stopped query binding value from being cleared. Shifted the bound value updated to an onChange handler

This commit is contained in:
Dean 2023-07-24 17:45:41 +01:00
parent 02c538c315
commit d97c44725f
3 changed files with 17 additions and 6 deletions

View File

@ -73,9 +73,12 @@
{#if query?.parameters?.length > 0}
<div class="params">
<BindingBuilder
bind:customParams={parameters.queryParams}
customParams={parameters.queryParams}
queryBindings={query.parameters}
bind:bindings
on:change={v => {
parameters.queryParams = { ...v.detail }
}}
/>
<IntegrationQueryEditor
height={200}

View File

@ -143,13 +143,12 @@
}
const openQueryParamsDrawer = () => {
tmpQueryParams = value.queryParams
tmpQueryParams = { ...value.queryParams }
drawer.show()
}
const getQueryValue = queries => {
value = queries.find(q => q._id === value._id) || value
return value
return queries.find(q => q._id === value._id) || value
}
const saveQueryParams = () => {
@ -176,7 +175,10 @@
<Layout noPadding gap="XS">
{#if getQueryParams(value).length > 0}
<BindingBuilder
bind:customParams={tmpQueryParams}
customParams={tmpQueryParams}
on:change={v => {
tmpQueryParams = { ...v.detail }
}}
queryBindings={getQueryParams(value)}
bind:bindings
/>

View File

@ -5,6 +5,9 @@
runtimeToReadableBinding,
} from "builderStore/dataBinding"
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
import { createEventDispatcher } from "svelte"
const dispatch = createEventDispatcher()
export let bindable = true
export let queryBindings = []
@ -20,7 +23,10 @@
// 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(bindings, valueToParse)
dispatch("change", {
...customParams,
[param]: readableToRuntimeBinding(bindings, valueToParse),
})
}
</script>