fix issue with readable bindings not displayinng correctly

This commit is contained in:
Peter Clement 2023-10-27 09:13:27 +01:00
parent 6ba9e68e64
commit 89a242f354
2 changed files with 9 additions and 8 deletions

View File

@ -221,7 +221,7 @@ const automationActions = store => ({
newAutomation.definition.steps.splice(blockIdx, 0, block)
await store.actions.save(newAutomation)
},
saveAutomationName: async (stepId, name) => {
saveAutomationName: async (blockId, name) => {
const automation = get(selectedAutomation)
let newAutomation = cloneDeep(automation)
if (!automation) {
@ -229,18 +229,18 @@ const automationActions = store => ({
}
newAutomation.definition.stepNames = {
...newAutomation.definition.stepNames,
[stepId]: name.trim(),
[blockId]: name.trim(),
}
await store.actions.save(newAutomation)
},
deleteAutomationName: async stepId => {
deleteAutomationName: async blockId => {
const automation = get(selectedAutomation)
let newAutomation = cloneDeep(automation)
if (!automation) {
return
}
delete newAutomation.definition.stepNames[stepId]
delete newAutomation.definition.stepNames[blockId]
await store.actions.save(newAutomation)
},
@ -257,6 +257,7 @@ const automationActions = store => ({
newAutomation.definition.steps = newAutomation.definition.steps.filter(
step => step.id !== block.id
)
delete newAutomation.definition.stepNames[block.id]
}
await store.actions.save(newAutomation)
},

View File

@ -194,6 +194,9 @@
bindingIcon = allSteps[idx].icon
bindingRank = idx - loopBlockCount
}
let bindingName =
automation.stepNames?.[allSteps[bindingRank - loopBlockCount].id]
bindings = bindings.concat(
outputs.map(([name, value]) => {
let runtimeName = isLoopBlock
@ -203,9 +206,6 @@
: `steps.${idx - loopBlockCount}.${name}`
const runtime = idx === 0 ? `trigger.${name}` : runtimeName
let bindingName =
automation.stepNames?.[allSteps[bindingRank - loopBlockCount].id]
let categoryName
if (idx === 0) {
categoryName = "Trigger outputs"
@ -218,7 +218,7 @@
}
return {
readableBinding: runtime,
readableBinding: bindingName ? `${bindingName}.${name}` : runtime,
runtimeBinding: runtime,
type: value.type,
description: value.description,