linting
This commit is contained in:
parent
48804c5414
commit
8c031b9d35
|
@ -177,12 +177,18 @@
|
||||||
onChange({ detail: tempFilters }, defKey)
|
onChange({ detail: tempFilters }, defKey)
|
||||||
drawer.hide()
|
drawer.hide()
|
||||||
}
|
}
|
||||||
|
console.log(schemaProperties)
|
||||||
|
console.log(inputData)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="fields">
|
<div class="fields">
|
||||||
{#each schemaProperties as [key, value]}
|
{#each schemaProperties as [key, value]}
|
||||||
<div class="block-field">
|
<div class="block-field">
|
||||||
<Label>{value.title || (key === "row" ? "Table" : key)}</Label>
|
<Label
|
||||||
|
tooltip={value.title === "Binding / Value"
|
||||||
|
? "If using the String input type, please use a comma or newline separated string"
|
||||||
|
: null}>{value.title || (key === "row" ? "Table" : key)}</Label
|
||||||
|
>
|
||||||
{#if value.type === "string" && value.enum}
|
{#if value.type === "string" && value.enum}
|
||||||
<Select
|
<Select
|
||||||
on:change={e => onChange(e, key)}
|
on:change={e => onChange(e, key)}
|
||||||
|
|
|
@ -86,3 +86,15 @@ exports.substituteLoopStep = (hbsString, substitute) => {
|
||||||
|
|
||||||
return hbsString
|
return hbsString
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.stringSplit = value => {
|
||||||
|
if (value == null) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
if (value.split("\n").length > 1) {
|
||||||
|
value = value.split("\n")
|
||||||
|
} else {
|
||||||
|
value = value.split(",")
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
|
@ -107,6 +107,7 @@ class Orchestrator {
|
||||||
let loopSteps = []
|
let loopSteps = []
|
||||||
for (let step of automation.definition.steps) {
|
for (let step of automation.definition.steps) {
|
||||||
stepCount++
|
stepCount++
|
||||||
|
let input
|
||||||
if (step.stepId === LOOP_STEP_ID) {
|
if (step.stepId === LOOP_STEP_ID) {
|
||||||
loopStep = step
|
loopStep = step
|
||||||
loopStepNumber = stepCount
|
loopStepNumber = stepCount
|
||||||
|
@ -114,15 +115,13 @@ class Orchestrator {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loopStep) {
|
if (loopStep) {
|
||||||
// lets first of all handle the input
|
input = await processObject(loopStep.inputs, this._context)
|
||||||
if (
|
|
||||||
typeof loopStep.inputs.binding === "string" &&
|
|
||||||
loopStep.inputs.option === "String"
|
|
||||||
) {
|
|
||||||
loopStep.inputs.binding = loopStep.inputs.binding.split("\n")
|
|
||||||
}
|
}
|
||||||
}
|
let iterations = loopStep
|
||||||
let iterations = loopStep ? loopStep.inputs.binding.length : 1
|
? Array.isArray(input.binding)
|
||||||
|
? input.binding.length
|
||||||
|
: automationUtils.stringSplit(input.binding).length
|
||||||
|
: 1
|
||||||
let iterationCount = 0
|
let iterationCount = 0
|
||||||
for (let index = 0; index < iterations; index++) {
|
for (let index = 0; index < iterations; index++) {
|
||||||
let originalStepInput = cloneDeep(step.inputs)
|
let originalStepInput = cloneDeep(step.inputs)
|
||||||
|
@ -140,10 +139,10 @@ class Orchestrator {
|
||||||
|
|
||||||
let tempOutput = { items: loopSteps, iterations: iterationCount }
|
let tempOutput = { items: loopSteps, iterations: iterationCount }
|
||||||
if (
|
if (
|
||||||
(originalStepInput.option === "Array" &&
|
(loopStep.inputs.option === "Array" &&
|
||||||
!Array.isArray(originalStepInput.binding)) ||
|
!Array.isArray(newInput.binding)) ||
|
||||||
(originalStepInput.option === "String" &&
|
(loopStep.inputs.option === "String" &&
|
||||||
typeof originalStepInput.binding !== "string")
|
typeof newInput.binding !== "string")
|
||||||
) {
|
) {
|
||||||
this.updateContextAndOutput(loopStepNumber, step, tempOutput, {
|
this.updateContextAndOutput(loopStepNumber, step, tempOutput, {
|
||||||
status: AutomationErrors.INCORRECT_TYPE,
|
status: AutomationErrors.INCORRECT_TYPE,
|
||||||
|
@ -153,8 +152,19 @@ class Orchestrator {
|
||||||
loopStep = null
|
loopStep = null
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let item
|
||||||
|
if (
|
||||||
|
typeof loopStep.inputs.binding === "string" &&
|
||||||
|
loopStep.inputs.option === "String"
|
||||||
|
) {
|
||||||
|
item = automationUtils.stringSplit(newInput.binding)
|
||||||
|
} else {
|
||||||
|
item = loopStep.inputs.binding
|
||||||
|
}
|
||||||
|
|
||||||
this._context.steps[loopStepNumber] = {
|
this._context.steps[loopStepNumber] = {
|
||||||
currentItem: newInput.binding[index],
|
currentItem: item[index],
|
||||||
}
|
}
|
||||||
|
|
||||||
// The "Loop" binding in the front end is "fake", so replace it here so the context can understand it
|
// The "Loop" binding in the front end is "fake", so replace it here so the context can understand it
|
||||||
|
|
Loading…
Reference in New Issue