diff --git a/packages/builder/cypress/integration/createAutomation.spec.js b/packages/builder/cypress/integration/createAutomation.spec.js index e8892d16e2..b9355f7faf 100644 --- a/packages/builder/cypress/integration/createAutomation.spec.js +++ b/packages/builder/cypress/integration/createAutomation.spec.js @@ -33,7 +33,7 @@ filterTests(['smoke', 'all'], () => { cy.get(".spectrum-Button--cta").click() }) cy.contains("Setup").click() - cy.get(".spectrum-Picker-label").click() + cy.get(".spectrum-Picker-label").eq(1).click() cy.contains("dog").click() cy.get(".spectrum-Textfield-input") .first() diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js index b901a71cb1..84e6033439 100644 --- a/packages/builder/src/builderStore/store/automation/index.js +++ b/packages/builder/src/builderStore/store/automation/index.js @@ -57,6 +57,7 @@ const automationActions = store => ({ return state }) }, + save: async automation => { const response = await API.updateAutomation(automation) store.update(state => { @@ -130,6 +131,12 @@ const automationActions = store => ({ name: block.name, }) }, + toggleFieldControl: value => { + store.update(state => { + state.selectedBlock.rowControl = value + return state + }) + }, deleteAutomationBlock: block => { store.update(state => { const idx = diff --git a/packages/builder/src/components/automation/AutomationBuilder/AutomationBuilder.svelte b/packages/builder/src/components/automation/AutomationBuilder/AutomationBuilder.svelte index 7ce77a58e3..e852ee1a0d 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/AutomationBuilder.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/AutomationBuilder.svelte @@ -3,14 +3,8 @@ import Flowchart from "./FlowChart/FlowChart.svelte" $: automation = $automationStore.selectedAutomation?.automation - function onSelect(block) { - automationStore.update(state => { - state.selectedBlock = block - return state - }) - } {#if automation} - + {/if} diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte index 777fcd710a..ca04fed8df 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte @@ -14,7 +14,7 @@ } from "@budibase/bbui" export let automation - export let onSelect + let testDataModal let blocks let confirmDeleteDialog @@ -45,7 +45,7 @@
{automation.name} -
+
- +
{/each}
diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte index f13a827f31..69dd67724a 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte @@ -10,6 +10,7 @@ Button, StatusLight, ActionButton, + Select, notifications, } from "@budibase/bbui" import AutomationBlockSetup from "../../SetupPanel/AutomationBlockSetup.svelte" @@ -18,7 +19,6 @@ import ActionModal from "./ActionModal.svelte" import { externalActions } from "./ExternalActions" - export let onSelect export let block export let testDataModal let selected @@ -28,6 +28,10 @@ let setupToggled let blockComplete + $: rowControl = $automationStore.selectedAutomation.automation.rowControl + $: showBindingPicker = + block.stepId === "CREATE_ROW" || block.stepId === "UPDATE_ROW" + $: testResult = $automationStore.selectedAutomation.testResults?.steps.filter( step => (block.id ? step.id === block.id : step.stepId === block.stepId) ) @@ -44,12 +48,6 @@ $automationStore.selectedAutomation?.automation?.definition?.steps.length + 1 - // Logic for hiding / showing the add button.first we check if it has a child - // then we check to see whether its inputs have been commpleted - $: disableAddButton = isTrigger - ? $automationStore.selectedAutomation?.automation?.definition?.steps - .length > 0 - : !isTrigger && steps.length - blockIdx > 1 $: hasCompletedInputs = Object.keys( block.schema?.inputs?.properties || {} ).every(x => block?.inputs[x]) @@ -64,6 +62,26 @@ notifications.error("Error saving notification") } } + function toggleFieldControl(evt) { + onSelect(block) + let rowControl + if (evt.detail === "Use values") { + rowControl = false + } else { + rowControl = true + } + automationStore.actions.toggleFieldControl(rowControl) + automationStore.actions.save( + $automationStore.selectedAutomation?.automation + ) + } + + async function onSelect(block) { + await automationStore.update(state => { + state.selectedBlock = block + return state + }) + }
(setupToggled = !setupToggled)} + on:click={() => { + onSelect(block) + setupToggled = !setupToggled + }} quiet icon={setupToggled ? "ChevronDown" : "ChevronRight"} > Setup {#if !isTrigger} -
deleteStep()}> - +
+ {#if showBindingPicker} +
+ {#each schemaFields as [field, schema]} {#if !schema.autocolumn} - {#if schemaHasOptions(schema) && schema.type !== "array"} -