|
@@ -275,33 +275,43 @@ export const handleNodeSubmit = (no) => {
|
|
|
break
|
|
|
case NodeType.IfElse:
|
|
|
{
|
|
|
- no.cases = no.__ports.map((v) => {
|
|
|
- const obj = {
|
|
|
- id: v.id,
|
|
|
- case_id: v.id,
|
|
|
- logical_operator: v.mode,
|
|
|
- conditions:
|
|
|
- v.cases?.map((c) => {
|
|
|
- const cObj = {
|
|
|
- id: c.id,
|
|
|
- varType: c.source.type.toLowerCase(),
|
|
|
- variable_selector:
|
|
|
- c.source.source === VarsSource.Root
|
|
|
- ? [c.source.key.split('.')[0], c.source.key.split('.')[1]]
|
|
|
- : [c.source.nodeId, c.source.key],
|
|
|
- comparison_operator: c.method,
|
|
|
- value:
|
|
|
- c.type === ConditionType.Constant
|
|
|
- ? c.target
|
|
|
- : c.target.source === VarsSource.Root
|
|
|
- ? `{{#${c.target.key.split('.')[0]}.${c.target.key.split('.')[1]}#}}`
|
|
|
- : `{{#${c.target.nodeId}.${c.target.key}#}}`,
|
|
|
- }
|
|
|
- return cObj
|
|
|
- }) || [],
|
|
|
- }
|
|
|
- return obj
|
|
|
- })
|
|
|
+ no.cases = no.__ports
|
|
|
+ .filter((v) => !v.isElse)
|
|
|
+ .map((v) => {
|
|
|
+ const obj = {
|
|
|
+ id: v.id,
|
|
|
+ case_id: v.id,
|
|
|
+ logical_operator: v.mode,
|
|
|
+ conditions:
|
|
|
+ v.cases?.map((c) => {
|
|
|
+ const cObj = {
|
|
|
+ id: c.id,
|
|
|
+ varType: c.source.type.toLowerCase(),
|
|
|
+ variable_selector:
|
|
|
+ c.source.source === VarsSource.Root
|
|
|
+ ? [
|
|
|
+ c.source.key.split('.')[0],
|
|
|
+ c.source.key.split('.')[1],
|
|
|
+ ]
|
|
|
+ : [c.source.nodeId, c.source.key],
|
|
|
+ comparison_operator: c.method,
|
|
|
+ value:
|
|
|
+ c.type === ConditionType.Constant
|
|
|
+ ? c.target
|
|
|
+ : c.target.source === VarsSource.Root
|
|
|
+ ? `{{#${c.target.key.split('.')[0]}.${c.target.key.split('.')[1]}#}}`
|
|
|
+ : `{{#${c.target.nodeId}.${c.target.key}#}}`,
|
|
|
+ }
|
|
|
+ if (cObj.varType === 'number') {
|
|
|
+ cObj.numberVarType = c.type
|
|
|
+ } else if (cObj.varType === 'string') {
|
|
|
+ cObj.stringVarType = c.type
|
|
|
+ }
|
|
|
+ return cObj
|
|
|
+ }) || [],
|
|
|
+ }
|
|
|
+ return obj
|
|
|
+ })
|
|
|
}
|
|
|
break
|
|
|
}
|