add new status to handle no iterations during loop
This commit is contained in:
parent
9a02364856
commit
0a567a3302
|
@ -58,7 +58,7 @@
|
||||||
/>
|
/>
|
||||||
{#if openBlocks[block.id]}
|
{#if openBlocks[block.id]}
|
||||||
<Divider noMargin />
|
<Divider noMargin />
|
||||||
{#if filteredResults?.[idx]?.outputs.iterations}
|
{#if filteredResults?.[idx]?.outputs?.iterations}
|
||||||
<div style="display: flex; padding: 10px 10px 0px 12px;">
|
<div style="display: flex; padding: 10px 10px 0px 12px;">
|
||||||
<Icon name="Reuse" />
|
<Icon name="Reuse" />
|
||||||
<div style="margin-left: 10px;">
|
<div style="margin-left: 10px;">
|
||||||
|
|
|
@ -34,8 +34,8 @@ const STOPPED_STATUS = { success: true, status: AutomationStatus.STOPPED }
|
||||||
|
|
||||||
function getLoopIterations(loopStep: LoopStep, input: LoopInput) {
|
function getLoopIterations(loopStep: LoopStep, input: LoopInput) {
|
||||||
const binding = automationUtils.typecastForLooping(loopStep, input)
|
const binding = automationUtils.typecastForLooping(loopStep, input)
|
||||||
if (!loopStep || !binding) {
|
if (!binding) {
|
||||||
return 1
|
return 0
|
||||||
}
|
}
|
||||||
if (Array.isArray(binding)) {
|
if (Array.isArray(binding)) {
|
||||||
return binding.length
|
return binding.length
|
||||||
|
@ -43,7 +43,7 @@ function getLoopIterations(loopStep: LoopStep, input: LoopInput) {
|
||||||
if (typeof binding === "string") {
|
if (typeof binding === "string") {
|
||||||
return automationUtils.stringSplit(binding).length
|
return automationUtils.stringSplit(binding).length
|
||||||
}
|
}
|
||||||
return 1
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -423,13 +423,25 @@ class Orchestrator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (loopStep && iterations === 0) {
|
||||||
|
loopStep = undefined
|
||||||
|
this.executionOutput.steps.splice(loopStepNumber + 1, 0, {
|
||||||
|
id: step.id,
|
||||||
|
stepId: step.stepId,
|
||||||
|
outputs: { status: AutomationStatus.NO_ITERATIONS, success: true },
|
||||||
|
inputs: {},
|
||||||
|
})
|
||||||
|
|
||||||
|
this._context.steps.splice(loopStepNumber, 1)
|
||||||
|
iterations = 1
|
||||||
|
}
|
||||||
|
|
||||||
// Delete the step after the loop step as it's irrelevant, since information is included
|
// Delete the step after the loop step as it's irrelevant, since information is included
|
||||||
// in the loop step
|
// in the loop step
|
||||||
if (wasLoopStep && !loopStep) {
|
if (wasLoopStep && !loopStep) {
|
||||||
this._context.steps.splice(loopStepNumber + 1, 1)
|
this._context.steps.splice(loopStepNumber + 1, 1)
|
||||||
wasLoopStep = false
|
wasLoopStep = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loopSteps && loopSteps.length) {
|
if (loopSteps && loopSteps.length) {
|
||||||
let tempOutput = {
|
let tempOutput = {
|
||||||
success: true,
|
success: true,
|
||||||
|
|
|
@ -83,6 +83,7 @@ export enum AutomationStatus {
|
||||||
ERROR = "error",
|
ERROR = "error",
|
||||||
STOPPED = "stopped",
|
STOPPED = "stopped",
|
||||||
STOPPED_ERROR = "stopped_error",
|
STOPPED_ERROR = "stopped_error",
|
||||||
|
NO_ITERATIONS = "no_iterations",
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AutomationResults {
|
export interface AutomationResults {
|
||||||
|
|
Loading…
Reference in New Issue