Automation fixes

This commit is contained in:
Peter Clement 2022-09-23 13:35:27 +01:00
parent b6ab3bbc19
commit f069ddb27e
4 changed files with 12 additions and 7 deletions

View File

@ -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
/>
</Drawer>
{:else if value.customType === "password"}

View File

@ -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()

View File

@ -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)}
<Input disabled={filter.noValue} bind:value={filter.value} />

View File

@ -80,7 +80,7 @@ exports.definition = {
},
success: {
type: "boolean",
description: "Whether the deletion was successful",
description: "Whether the query was successful",
},
},
required: ["rows", "success"],