From f069ddb27e047f95b77d076edfc4928e4119ccab Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Fri, 23 Sep 2022 13:35:27 +0100 Subject: [PATCH] Automation fixes --- .../SetupPanel/AutomationBlockSetup.svelte | 13 ++++++++----- .../components/common/bindings/BindingPanel.svelte | 2 +- .../controls/FilterEditor/FilterDrawer.svelte | 2 ++ packages/server/src/automations/steps/queryRows.js | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index 8016283094..bb70938dfe 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -113,8 +113,9 @@ // Extract all outputs from all previous steps as available bindins let bindings = [] + let loopBlockCount = 0 for (let idx = 0; idx < blockIdx; idx++) { - let wasLoopBlock = allSteps[idx]?.stepId === ActionStepID.LOOP + let wasLoopBlock = allSteps[idx - 1]?.stepId === ActionStepID.LOOP let isLoopBlock = allSteps[idx]?.stepId === ActionStepID.LOOP && allSteps.find(x => x.blockToLoop === block.id) @@ -122,7 +123,8 @@ // If the previous block was a loop block, decerement the index so the following // steps are in the correct order if (wasLoopBlock) { - blockIdx-- + loopBlockCount++ + continue } let schema = allSteps[idx]?.schema?.outputs?.properties ?? {} @@ -143,8 +145,8 @@ let runtimeName = isLoopBlock ? `loop.${name}` : block.name.startsWith("JS") - ? `steps[${idx}].${name}` - : `steps.${idx}.${name}` + ? `steps[${idx - loopBlockCount}].${name}` + : `steps.${idx - loopBlockCount}.${name}` const runtime = idx === 0 ? `trigger.${name}` : runtimeName return { label: runtime, @@ -155,7 +157,7 @@ ? "Trigger outputs" : isLoopBlock ? "Loop Outputs" - : `Step ${idx} outputs`, + : `Step ${idx - loopBlockCount} outputs`, path: runtime, } }) @@ -229,6 +231,7 @@ {bindings} {schemaFields} panel={AutomationBindingPanel} + fillWidth /> {:else if value.customType === "password"} diff --git a/packages/builder/src/components/common/bindings/BindingPanel.svelte b/packages/builder/src/components/common/bindings/BindingPanel.svelte index ffa0e98819..3447106136 100644 --- a/packages/builder/src/components/common/bindings/BindingPanel.svelte +++ b/packages/builder/src/components/common/bindings/BindingPanel.svelte @@ -247,7 +247,7 @@ return } hoverTarget = { - title: binding.display.name || binding.fieldSchema.name, + title: binding.display?.name || binding.fieldSchema.name, description: binding.description, } popover.show() diff --git a/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte b/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte index 9bd66a4cb1..6c59119169 100644 --- a/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte +++ b/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte @@ -27,6 +27,7 @@ export let panel = ClientBindingPanel export let allowBindings = true export let allOr = false + export let fillWidth = false $: dispatch("change", filters) $: enrichedSchemaFields = getFields(schemaFields || []) @@ -177,6 +178,7 @@ {panel} {bindings} on:change={event => (filter.value = event.detail)} + {fillWidth} /> {:else if ["string", "longform", "number", "formula"].includes(filter.type)} diff --git a/packages/server/src/automations/steps/queryRows.js b/packages/server/src/automations/steps/queryRows.js index cfff039221..23a7ce55fa 100644 --- a/packages/server/src/automations/steps/queryRows.js +++ b/packages/server/src/automations/steps/queryRows.js @@ -80,7 +80,7 @@ exports.definition = { }, success: { type: "boolean", - description: "Whether the deletion was successful", + description: "Whether the query was successful", }, }, required: ["rows", "success"],