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} {#if query?.parameters?.length > 0}
<div class="params"> <div class="params">
<BindingBuilder <BindingBuilder
bind:customParams={parameters.queryParams} customParams={parameters.queryParams}
queryBindings={query.parameters} queryBindings={query.parameters}
bind:bindings bind:bindings
on:change={v => {
parameters.queryParams = { ...v.detail }
}}
/> />
<IntegrationQueryEditor <IntegrationQueryEditor
height={200} height={200}

View File

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

View File

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