diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItemHeader.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItemHeader.svelte index edb0c3d9d2..584dda361c 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItemHeader.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItemHeader.svelte @@ -7,12 +7,18 @@ export let blockComplete export let showTestStatus = false export let showParameters = {} + export let testResult + export let isTrigger - $: testResult = - $automationStore.selectedAutomation?.testResults?.steps.filter(step => - block.id ? step.id === block.id : step.stepId === block.stepId - ) - $: isTrigger = block.type === "TRIGGER" + $: { + if (!testResult) { + testResult = + $automationStore.selectedAutomation?.testResults?.steps.filter(step => + block.id ? step.id === block.id : step.stepId === block.stepId + )[0] + } + } + $: isTrigger = isTrigger || block.type === "TRIGGER" async function onSelect(block) { await automationStore.update(state => { @@ -60,13 +66,13 @@
- {#if showTestStatus && testResult && testResult[0]} + {#if showTestStatus && testResult}
{testResult[0].outputs?.success || isTrigger + >{testResult.outputs?.success || isTrigger ? "Success" : "Error"} + import { Icon, Divider, Tabs, Tab, TextArea, Label } from "@budibase/bbui" + import FlowItemHeader from "./FlowChart/FlowItemHeader.svelte" + + export let automation + export let testResults + export let width = "400px" + + let showParameters + let blocks + + function prepTestResults(results) { + return results.steps.filter(x => x.stepId !== "LOOP" || []) + } + + $: filteredResults = prepTestResults(testResults) + + $: { + blocks = [] + if (automation) { + if (automation.definition.trigger) { + blocks.push(automation.definition.trigger) + } + blocks = blocks + .concat(automation.definition.steps || []) + .filter(x => x.stepId !== "LOOP") + } else if (filteredResults) { + blocks = filteredResults || [] + // make sure there is an ID for each block being displayed + let count = 0 + for (let block of blocks) { + block.id = count++ + } + } + } + + +
+ {#each blocks as block, idx} +
+ {#if block.stepId !== "LOOP"} + + {#if showParameters && showParameters[block.id]} + + {#if filteredResults?.[idx]?.outputs.iterations} +
+ +
+ +
+
+ {/if} + +
+ + +
+