Merge pull request #5569 from Budibase/fix/automation-performance-ux

Some small automation fixes
This commit is contained in:
Peter Clement 2022-04-26 11:43:31 +01:00 committed by GitHub
commit 22ec90e860
7 changed files with 25 additions and 14 deletions

View File

@ -48,10 +48,6 @@
$automationStore.selectedAutomation?.automation?.definition?.steps.length + $automationStore.selectedAutomation?.automation?.definition?.steps.length +
1 1
$: hasCompletedInputs = Object.keys(
block.schema?.inputs?.properties || {}
).every(x => block?.inputs[x])
$: loopingSelected = $: loopingSelected =
$automationStore.selectedAutomation?.automation.definition.steps.find( $automationStore.selectedAutomation?.automation.definition.steps.find(
x => x.blockToLoop === block.id x => x.blockToLoop === block.id
@ -290,13 +286,7 @@
</Modal> </Modal>
</div> </div>
<div class="separator" /> <div class="separator" />
<Icon <Icon on:click={() => actionModal.show()} hoverable name="AddCircle" size="S" />
on:click={() => actionModal.show()}
disabled={!hasCompletedInputs}
hoverable
name="AddCircle"
size="S"
/>
{#if isTrigger ? totalBlocks > 1 : blockIdx !== totalBlocks - 2} {#if isTrigger ? totalBlocks > 1 : blockIdx !== totalBlocks - 2}
<div class="separator" /> <div class="separator" />
{/if} {/if}

View File

@ -25,11 +25,11 @@
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"
import { getSchemaForTable } from "builderStore/dataBinding" import { getSchemaForTable } from "builderStore/dataBinding"
import { Utils } from "@budibase/frontend-core"
export let block export let block
export let testData export let testData
@ -54,7 +54,7 @@
$: 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 = Utils.sequential(async (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) {
@ -226,6 +226,7 @@
on:change={e => onChange(e, key)} on:change={e => onChange(e, key)}
{bindings} {bindings}
fillWidth fillWidth
updateOnChange={false}
/> />
{:else} {:else}
<DrawerBindableInput <DrawerBindableInput
@ -237,6 +238,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"}
@ -310,6 +312,7 @@
type={value.customType} type={value.customType}
on:change={e => onChange(e, key)} on:change={e => onChange(e, key)}
{bindings} {bindings}
updateOnChange={false}
/> />
{:else} {:else}
<div class="test"> <div class="test">
@ -321,6 +324,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) => {
const 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

@ -30,6 +30,10 @@
label: "DateTime", label: "DateTime",
value: "datetime", value: "datetime",
}, },
{
label: "Array",
value: "array",
},
] ]
function addField() { function addField() {
@ -70,6 +74,7 @@
secondary secondary
placeholder="Enter field name" placeholder="Enter field name"
on:change={fieldNameChanged(field.name)} on:change={fieldNameChanged(field.name)}
updateOnChange={false}
/> />
<Select <Select
value={field.type} value={field.type}

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}>

View File

@ -15,6 +15,7 @@
export let placeholder export let placeholder
export let label export let label
export let allowJS = false export let allowJS = false
export let updateOnChange = true
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
let bindingModal let bindingModal
@ -41,6 +42,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}
/> />
<div class="icon" on:click={bindingModal.show}> <div class="icon" on:click={bindingModal.show}>
<Icon size="S" name="FlashOn" /> <Icon size="S" name="FlashOn" />