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/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte
index 69dd67724a..5bd250572e 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,
+ Label,
notifications,
} from "@budibase/bbui"
import AutomationBlockSetup from "../../SetupPanel/AutomationBlockSetup.svelte"
@@ -25,7 +25,6 @@
let webhookModal
let actionModal
let resultsModal
- let setupToggled
let blockComplete
$: rowControl = $automationStore.selectedAutomation.automation.rowControl
@@ -52,6 +51,8 @@
block.schema?.inputs?.properties || {}
).every(x => block?.inputs[x])
+ $: loopingSelected = !!block.llop
+ $: showLooping = false
async function deleteStep() {
try {
automationStore.actions.deleteAutomationBlock(block)
@@ -76,6 +77,37 @@
)
}
+ /*
+ async function removeLooping() {
+ loopingSelected = false
+ const idx =
+ $automationStore.selectedAutomation.automation.definition.steps.findIndex(
+ x => x.id === block.id
+ )
+
+ delete $automationStore.selectedAutomation.automation.definition.steps[idx]
+ .loop
+
+ await automationStore.actions.save(
+ $automationStore.selectedAutomation?.automation
+ )
+ }*/
+ async function addLooping() {
+ loopingSelected = true
+ const loopDefinition = $automationStore.blockDefinitions.ACTION.LOOP
+
+ const loopBlock = $automationStore.selectedAutomation.constructBlock(
+ "ACTION",
+ "LOOP",
+ loopDefinition
+ )
+ loopBlock.blockToLoop = block.id
+ automationStore.actions.addBlockToAutomation(loopBlock, blockIdx - 1)
+ await automationStore.actions.save(
+ $automationStore.selectedAutomation?.automation
+ )
+ }
+
async function onSelect(block) {
await automationStore.update(state => {
state.selectedBlock = block
@@ -84,13 +116,61 @@
}
-
{
- onSelect(block)
- }}
->
+
{}}>
+ {#if loopingSelected}
+
+
{
+ showLooping = !showLooping
+ }}
+ class="splitHeader"
+ >
+
+
+
+
{
+ onSelect(block)
+ }}
+ >
+
+
+
+
+
+
+ {#if !showLooping}
+
+
+ {/if}
+ {/if}
+
{
@@ -127,34 +207,42 @@
{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}
-
+ {/if}
- {#if setupToggled}
-
- {#if lastStep}
-
- {/if}
+
+ {#if lastStep}
+
{/if}
@@ -220,8 +306,9 @@
padding-left: 30px;
}
.block-options {
- display: flex;
+ justify-content: flex-end;
align-items: center;
+ display: flex;
}
.center-items {
display: flex;
@@ -256,4 +343,9 @@
/* center horizontally */
align-self: center;
}
+
+ .blockTitle {
+ display: flex;
+ align-items: center;
+ }
diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte
index a94a78286c..19847a5196 100644
--- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte
+++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte
@@ -35,6 +35,7 @@
export let testData
export let schemaProperties
export let isTestModal = false
+ export let isLoop = false
let webhookModal
let drawer
let tempFilters = lookForFilters(schemaProperties) || []
@@ -73,6 +74,11 @@
await automationStore.actions.save(
$automationStore.selectedAutomation?.automation
)
+ } else if (isLoop) {
+ block.loop[key] = e.detail
+ await automationStore.actions.save(
+ $automationStore.selectedAutomation?.automation
+ )
} else {
block.inputs[key] = e.detail
await automationStore.actions.save(
@@ -261,6 +267,14 @@
value={inputData[key]}
/>
+ {:else if value.customType === "loopOption"}
+