1
0
Fork 0
mirror of synced 2024-09-10 22:46:09 +12:00

remove debouncing of automation input change and replace with on blurr

This commit is contained in:
Peter Clement 2022-04-25 14:51:36 +01:00
parent db8e31164a
commit 72985ee71c
4 changed files with 15 additions and 3 deletions

View file

@ -25,7 +25,6 @@
import QueryParamSelector from "./QueryParamSelector.svelte" import QueryParamSelector from "./QueryParamSelector.svelte"
import CronBuilder from "./CronBuilder.svelte" import CronBuilder from "./CronBuilder.svelte"
import Editor from "components/integration/QueryEditor.svelte" import Editor from "components/integration/QueryEditor.svelte"
import { debounce } from "lodash"
import ModalBindableInput from "components/common/bindings/ModalBindableInput.svelte" import ModalBindableInput from "components/common/bindings/ModalBindableInput.svelte"
import FilterDrawer from "components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte" import FilterDrawer from "components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte"
import { LuceneUtils } from "@budibase/frontend-core" import { LuceneUtils } from "@budibase/frontend-core"
@ -54,7 +53,8 @@
$: schema = getSchemaForTable(tableId, { searchableSchema: true }).schema $: schema = getSchemaForTable(tableId, { searchableSchema: true }).schema
$: schemaFields = Object.values(schema || {}) $: schemaFields = Object.values(schema || {})
const onChange = debounce(async function (e, key) { const onChange = async (e, key) => {
console.log(e, key)
try { try {
if (isTestModal) { if (isTestModal) {
// Special case for webhook, as it requires a body, but the schema already brings back the body's contents // Special case for webhook, as it requires a body, but the schema already brings back the body's contents
@ -82,7 +82,7 @@
} catch (error) { } catch (error) {
notifications.error("Error saving automation") notifications.error("Error saving automation")
} }
}, 800) }
function getAvailableBindings(block, automation) { function getAvailableBindings(block, automation) {
if (!block || !automation) { if (!block || !automation) {
@ -205,6 +205,7 @@
on:change={e => onChange(e, key)} on:change={e => onChange(e, key)}
{bindings} {bindings}
allowJS={false} allowJS={false}
updateOnChange={false}
/> />
{/if} {/if}
{:else if value.customType === "query"} {:else if value.customType === "query"}
@ -281,6 +282,7 @@
value={inputData[key]} value={inputData[key]}
on:change={e => onChange(e, key)} on:change={e => onChange(e, key)}
{bindings} {bindings}
updateOnChange={false}
/> />
</div> </div>
{/if} {/if}

View file

@ -43,6 +43,11 @@
} }
const coerce = (value, type) => { const coerce = (value, type) => {
var re = new RegExp(/{{([^{].*?)}}/g)
if (re.test(value)) {
return value
}
if (type === "boolean") { if (type === "boolean") {
if (typeof value === "boolean") { if (typeof value === "boolean") {
return value return value
@ -120,6 +125,7 @@
{bindings} {bindings}
fillWidth={true} fillWidth={true}
allowJS={true} allowJS={true}
updateOnChange={false}
/> />
{/if} {/if}
{:else if !rowControl} {:else if !rowControl}
@ -137,6 +143,7 @@
{bindings} {bindings}
fillWidth={true} fillWidth={true}
allowJS={true} allowJS={true}
updateOnChange={false}
/> />
{/if} {/if}
{/if} {/if}

View file

@ -60,5 +60,6 @@
{bindings} {bindings}
fillWidth={true} fillWidth={true}
allowJS={true} allowJS={true}
updateOnChange={false}
/> />
{/if} {/if}

View file

@ -17,6 +17,7 @@
export let disabled = false export let disabled = false
export let fillWidth export let fillWidth
export let allowJS = true export let allowJS = true
export let updateOnChange = true
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
let bindingDrawer let bindingDrawer
@ -44,6 +45,7 @@
value={isJS ? "(JavaScript function)" : readableValue} value={isJS ? "(JavaScript function)" : readableValue}
on:change={event => onChange(event.detail)} on:change={event => onChange(event.detail)}
{placeholder} {placeholder}
{updateOnChange}
/> />
{#if !disabled} {#if !disabled}
<div class="icon" on:click={bindingDrawer.show}> <div class="icon" on:click={bindingDrawer.show}>