diff --git a/charts/budibase/templates/app-service-deployment.yaml b/charts/budibase/templates/app-service-deployment.yaml index 86e255d331..18115bf275 100644 --- a/charts/budibase/templates/app-service-deployment.yaml +++ b/charts/budibase/templates/app-service-deployment.yaml @@ -114,6 +114,9 @@ spec: value: {{ .Values.globals.google.clientId | quote }} - name: GOOGLE_CLIENT_SECRET value: {{ .Values.globals.google.secret | quote }} + - name: AUTOMATION_MAX_ITERATIONS + value: {{ .Values.globals.automationMaxIterations | quote }} + image: budibase/apps:{{ .Values.globals.appVersion }} imagePullPolicy: Always name: bbapps diff --git a/charts/budibase/values.yaml b/charts/budibase/values.yaml index 648b1d2dee..a9dbcd426b 100644 --- a/charts/budibase/values.yaml +++ b/charts/budibase/values.yaml @@ -103,6 +103,7 @@ globals: google: clientId: "" secret: "" + automationMaxIterations: "500" createSecrets: true # creates an internal API key, JWT secrets and redis password for you diff --git a/packages/builder/cypress/integration/createAutomation.spec.js b/packages/builder/cypress/integration/createAutomation.spec.js index b9355f7faf..ff8065f544 100644 --- a/packages/builder/cypress/integration/createAutomation.spec.js +++ b/packages/builder/cypress/integration/createAutomation.spec.js @@ -20,7 +20,6 @@ filterTests(['smoke', 'all'], () => { }) // Setup trigger - cy.contains("Setup").click() cy.get(".spectrum-Picker-label").click() cy.wait(500) cy.contains("dog").click() @@ -32,12 +31,11 @@ filterTests(['smoke', 'all'], () => { cy.contains("Create Row").trigger('mouseover').click().click() cy.get(".spectrum-Button--cta").click() }) - cy.contains("Setup").click() cy.get(".spectrum-Picker-label").eq(1).click() cy.contains("dog").click() cy.get(".spectrum-Textfield-input") - .first() - .type("{{ trigger.row.name }}", { parseSpecialCharSequences: false }) + .first() + .type("{{ trigger.row.name }}", { parseSpecialCharSequences: false }) cy.get(".spectrum-Textfield-input") .eq(1) .type("11") diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte index 4e1e5e1103..caf8835b86 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte @@ -39,6 +39,7 @@ if (v.internal) { acc[k] = v } + delete acc.LOOP return acc }, {}) diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte index ca04fed8df..505a0b9aca 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte @@ -72,7 +72,9 @@ animate:flip={{ duration: 500 }} in:fly|local={{ x: 500, duration: 1500 }} > - + {#if block.stepId !== "LOOP"} + + {/if} {/each} diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte index 69dd67724a..ef0a61646e 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte @@ -9,8 +9,8 @@ Modal, Button, StatusLight, - ActionButton, Select, + ActionButton, notifications, } from "@budibase/bbui" import AutomationBlockSetup from "../../SetupPanel/AutomationBlockSetup.svelte" @@ -25,8 +25,8 @@ let webhookModal let actionModal let resultsModal - let setupToggled let blockComplete + let showLooping = false $: rowControl = $automationStore.selectedAutomation.automation.rowControl $: showBindingPicker = @@ -52,8 +52,21 @@ block.schema?.inputs?.properties || {} ).every(x => block?.inputs[x]) + $: loopingSelected = + $automationStore.selectedAutomation?.automation.definition.steps.find( + x => x.blockToLoop === block.id + ) + async function deleteStep() { + let loopBlock = + $automationStore.selectedAutomation?.automation.definition.steps.find( + x => x.blockToLoop === block.id + ) + try { + if (loopBlock) { + automationStore.actions.deleteAutomationBlock(loopBlock) + } automationStore.actions.deleteAutomationBlock(block) await automationStore.actions.save( $automationStore.selectedAutomation?.automation @@ -76,6 +89,23 @@ ) } + async function addLooping() { + loopingSelected = true + const loopDefinition = $automationStore.blockDefinitions.ACTION.LOOP + + const loopBlock = $automationStore.selectedAutomation.constructBlock( + "ACTION", + "LOOP", + loopDefinition + ) + loopBlock.blockToLoop = block.id + block.loopBlock = loopBlock.id + automationStore.actions.addBlockToAutomation(loopBlock, blockIdx) + await automationStore.actions.save( + $automationStore.selectedAutomation?.automation + ) + } + async function onSelect(block) { await automationStore.update(state => { state.selectedBlock = block @@ -84,13 +114,68 @@ } -
{ - onSelect(block) - }} -> +
{}}> + {#if loopingSelected} +
+
{ + showLooping = !showLooping + }} + class="splitHeader" + > +
+ + + +
+ Looping +
+
+ +
+
{ + onSelect(block) + }} + > + +
+
+
+
+ + + {#if !showLooping} +
+
+
deleteStep()}> + +
+
+ + x.blockToLoop === block.id + )} + {webhookModal} + /> + +
+ + {/if} + {/if} +
{ @@ -127,65 +212,66 @@ {block?.name?.toUpperCase() || ""}
- {#if testResult && testResult[0]} - resultsModal.show()}> - View response - - {/if} +
+ {#if testResult && testResult[0]} +
resultsModal.show()}> + View response +
+ {/if} +
{ + onSelect(block) + }} + > + +
+
{#if !blockComplete}
-
- { - onSelect(block) - setupToggled = !setupToggled - }} - quiet - icon={setupToggled ? "ChevronDown" : "ChevronRight"} - > - Setup - - {#if !isTrigger} + {#if !isTrigger} +
- {#if showBindingPicker} -
- + {/if} + deleteStep()} + icon="DeleteOutline" + />
- {/if} -
+
+ {/if} - {#if setupToggled} - - {#if lastStep} - - {/if} + + {#if lastStep} + {/if}
@@ -220,8 +306,10 @@ padding-left: 30px; } .block-options { - display: flex; + justify-content: flex-end; align-items: center; + display: flex; + gap: var(--spacing-m); } .center-items { display: flex; @@ -256,4 +344,9 @@ /* center horizontally */ align-self: center; } + + .blockTitle { + display: flex; + align-items: center; + } diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ResultsModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ResultsModal.svelte index 7dfdff20a7..67c7f493e8 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ResultsModal.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ResultsModal.svelte @@ -1,5 +1,5 @@