#170: Fixed double for-loop issues. Now for anything >2 .. :)
This commit is contained in:
+18
-10
@@ -876,7 +876,6 @@ class AppBase:
|
|||||||
actionname = action["name"]
|
actionname = action["name"]
|
||||||
#print("Multicheck ", actualitem)
|
#print("Multicheck ", actualitem)
|
||||||
print("Actual item: %s" % actualitem)
|
print("Actual item: %s" % actualitem)
|
||||||
print("LENGTH: %d" % len(actualitem))
|
|
||||||
if len(actualitem) > 0:
|
if len(actualitem) > 0:
|
||||||
multiexecution = True
|
multiexecution = True
|
||||||
|
|
||||||
@@ -903,9 +902,12 @@ class AppBase:
|
|||||||
minlength = len(json_replacement)
|
minlength = len(json_replacement)
|
||||||
|
|
||||||
tmpitem = tmpitem.replace(actualitem[0][0], replacement, 1)
|
tmpitem = tmpitem.replace(actualitem[0][0], replacement, 1)
|
||||||
multi_execution_lists.append(tmpitem)
|
|
||||||
params[parameter["name"]] = tmpitem
|
params[parameter["name"]] = tmpitem
|
||||||
multi_parameters[parameter["name"]] = tmpitem
|
multi_execution_lists.append(json_replacement)
|
||||||
|
multi_parameters[parameter["name"]] = json_replacement
|
||||||
|
|
||||||
|
#print("LENGTH OF ARR: %d" % len(resultarray))
|
||||||
|
#print("RESULTARRAY: %s" % resultarray)
|
||||||
print("MULTI finished: %s" % replacement)
|
print("MULTI finished: %s" % replacement)
|
||||||
else:
|
else:
|
||||||
|
|
||||||
@@ -949,6 +951,11 @@ class AppBase:
|
|||||||
resultarray.append(tmpitem)
|
resultarray.append(tmpitem)
|
||||||
|
|
||||||
# With this parameter ready, add it to... a greater list of parameters. Rofl
|
# With this parameter ready, add it to... a greater list of parameters. Rofl
|
||||||
|
print("LENGTH OF ARR: %d" % len(resultarray))
|
||||||
|
print("RESULTARRAY: %s" % resultarray)
|
||||||
|
if resultarray not in multi_execution_lists:
|
||||||
|
multi_execution_lists.append(resultarray)
|
||||||
|
|
||||||
multi_parameters[parameter["name"]] = resultarray
|
multi_parameters[parameter["name"]] = resultarray
|
||||||
else:
|
else:
|
||||||
# Parses things like int(value)
|
# Parses things like int(value)
|
||||||
@@ -961,7 +968,7 @@ class AppBase:
|
|||||||
# Fix lists here
|
# Fix lists here
|
||||||
print("CHECKING multi execution list!")
|
print("CHECKING multi execution list!")
|
||||||
if len(multi_execution_lists) > 0:
|
if len(multi_execution_lists) > 0:
|
||||||
print("Multi execution list has more data: %d" % len(multi_execution_lists))
|
print("\n Multi execution list has more data: %d" % len(multi_execution_lists))
|
||||||
filteredlist = []
|
filteredlist = []
|
||||||
for listitem in multi_execution_lists:
|
for listitem in multi_execution_lists:
|
||||||
if listitem in filteredlist:
|
if listitem in filteredlist:
|
||||||
@@ -971,14 +978,15 @@ class AppBase:
|
|||||||
|
|
||||||
#print("New list length: %d" % len(filteredlist))
|
#print("New list length: %d" % len(filteredlist))
|
||||||
if len(filteredlist) > 1:
|
if len(filteredlist) > 1:
|
||||||
print("Calculating new multi-loop length")
|
print("Calculating new multi-loop length with %d lists" % len(filteredlist))
|
||||||
tmplength = 1
|
tmplength = 1
|
||||||
for innerlist in filteredlist:
|
for innerlist in filteredlist:
|
||||||
|
print("List length: %d. %d*%d" % (len(innerlist), len(innerlist), tmplength))
|
||||||
tmplength = len(innerlist)*tmplength
|
tmplength = len(innerlist)*tmplength
|
||||||
|
|
||||||
minlength = tmplength
|
minlength = tmplength
|
||||||
|
|
||||||
#print("New multi execution length: %d" % tmplength)
|
print("New multi execution length: %d\n" % tmplength)
|
||||||
|
|
||||||
# FIXME - this is horrible, but works for now
|
# FIXME - this is horrible, but works for now
|
||||||
#for i in range(calltimes):
|
#for i in range(calltimes):
|
||||||
@@ -1025,7 +1033,7 @@ class AppBase:
|
|||||||
newarray = []
|
newarray = []
|
||||||
print("VALUE: ", value)
|
print("VALUE: ", value)
|
||||||
additiontime = minlength/len(value)
|
additiontime = minlength/len(value)
|
||||||
#print("Bad length for value: %d - should be %d. Additiontime: %d" % (len(value), minlength, additiontime))
|
print("Bad length for value: %d - should be %d. Additiontime: %d" % (len(value), minlength, additiontime))
|
||||||
if firstlist:
|
if firstlist:
|
||||||
print("Running normal list (FIRST)")
|
print("Running normal list (FIRST)")
|
||||||
for subvalue in value:
|
for subvalue in value:
|
||||||
@@ -1052,7 +1060,7 @@ class AppBase:
|
|||||||
newarray[cnt] = value[subvaluerange]
|
newarray[cnt] = value[subvaluerange]
|
||||||
cnt += 1
|
cnt += 1
|
||||||
|
|
||||||
print("Newarray =", newarray)
|
#print("Newarray =", newarray)
|
||||||
newvalue = newarray[i]
|
newvalue = newarray[i]
|
||||||
firstlist = False
|
firstlist = False
|
||||||
|
|
||||||
@@ -1079,10 +1087,10 @@ class AppBase:
|
|||||||
#print("Json: %s" % e)
|
#print("Json: %s" % e)
|
||||||
results.append(ret)
|
results.append(ret)
|
||||||
|
|
||||||
print("Inner ret parsed: %s" % ret)
|
#print("Inner ret parsed: %s" % ret)
|
||||||
|
|
||||||
# Dump the result as a string of a list
|
# Dump the result as a string of a list
|
||||||
print("RESULTS: %s" % results)
|
#print("RESULTS: %s" % results)
|
||||||
if isinstance(results, list):
|
if isinstance(results, list):
|
||||||
print("JSON OBJECT? ", json_object)
|
print("JSON OBJECT? ", json_object)
|
||||||
if json_object:
|
if json_object:
|
||||||
|
|||||||
@@ -2524,14 +2524,17 @@ const AngularWorkflow = (props) => {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
const foundResult = workflowExecutions[key].results.find(result => result.action.id === item.id)
|
var foundResult = workflowExecutions[key].results.find(result => result.action.id === item.id)
|
||||||
if (foundResult === undefined) {
|
if (foundResult === undefined) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foundResult.result = foundResult.result.trim()
|
||||||
|
foundResult.result = foundResult.result.split(" None").join(" \"None\"")
|
||||||
|
foundResult.result = foundResult.result.split("\'").join("\"")
|
||||||
|
|
||||||
var jsonvalid = true
|
var jsonvalid = true
|
||||||
try {
|
try {
|
||||||
console.log(foundResult.result)
|
|
||||||
const tmp = String(JSON.parse(foundResult.result))
|
const tmp = String(JSON.parse(foundResult.result))
|
||||||
if (!tmp.includes("{") && !tmp.includes("[")) {
|
if (!tmp.includes("{") && !tmp.includes("[")) {
|
||||||
jsonvalid = false
|
jsonvalid = false
|
||||||
@@ -2544,9 +2547,10 @@ const AngularWorkflow = (props) => {
|
|||||||
if (jsonvalid) {
|
if (jsonvalid) {
|
||||||
exampledata = JSON.parse(foundResult.result)
|
exampledata = JSON.parse(foundResult.result)
|
||||||
break
|
break
|
||||||
} else {
|
}
|
||||||
console.log("Invalid JSON: ", foundResult.result)
|
//else {
|
||||||
}
|
// console.log("Invalid JSON: ", foundResult.result)
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2610,10 +2614,14 @@ const AngularWorkflow = (props) => {
|
|||||||
if (curstring.length > 0) {
|
if (curstring.length > 0) {
|
||||||
// Search back in the action list
|
// Search back in the action list
|
||||||
curstring = curstring.split(" ").join("_").toLowerCase()
|
curstring = curstring.split(" ").join("_").toLowerCase()
|
||||||
const actionItem = actionlist.find(data => data.autocomplete.split(" ").join("_").toLowerCase() === curstring)
|
var actionItem = actionlist.find(data => data.autocomplete.split(" ").join("_").toLowerCase() === curstring)
|
||||||
if (actionItem !== undefined) {
|
if (actionItem !== undefined) {
|
||||||
console.log("Found item: ", actionItem)
|
console.log("Found item: ", actionItem)
|
||||||
|
|
||||||
|
//actionItem.example = actionItem.example.trim()
|
||||||
|
//actionItem.example = actionItem.example.split(" None").join(" \"None\"")
|
||||||
|
//actionItem.example = actionItem.example.split("\'").join("\"")
|
||||||
|
|
||||||
var jsonvalid = true
|
var jsonvalid = true
|
||||||
try {
|
try {
|
||||||
const tmp = String(JSON.parse(actionItem.example))
|
const tmp = String(JSON.parse(actionItem.example))
|
||||||
@@ -2977,7 +2985,6 @@ const AngularWorkflow = (props) => {
|
|||||||
|
|
||||||
selectedActionParameters[count].value += toComplete
|
selectedActionParameters[count].value += toComplete
|
||||||
selectedAction.parameters[count].value = selectedActionParameters[count].value
|
selectedAction.parameters[count].value = selectedActionParameters[count].value
|
||||||
console.log("TARGET: ", selectedActionParameters)
|
|
||||||
setSelectedAction(selectedAction)
|
setSelectedAction(selectedAction)
|
||||||
setUpdate(Math.random())
|
setUpdate(Math.random())
|
||||||
|
|
||||||
@@ -5336,7 +5343,8 @@ const AngularWorkflow = (props) => {
|
|||||||
|
|
||||||
const parsedExecutionArgument = () => {
|
const parsedExecutionArgument = () => {
|
||||||
var showResult = executionData.execution_argument.trim()
|
var showResult = executionData.execution_argument.trim()
|
||||||
showResult.split(" None").join(" \"None\"")
|
showResult = showResult.split(" None").join(" \"None\"")
|
||||||
|
showResult = showResult.split("\'").join("\"")
|
||||||
|
|
||||||
var jsonvalid = true
|
var jsonvalid = true
|
||||||
try {
|
try {
|
||||||
@@ -5524,11 +5532,15 @@ const AngularWorkflow = (props) => {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
var showResult = data.result.trim()
|
|
||||||
showResult.split(" None").join(" \"None\"")
|
|
||||||
|
|
||||||
// showResult = replaceAll(showResult, " None", " \"None\"")
|
// showResult = replaceAll(showResult, " None", " \"None\"")
|
||||||
// Super basic check.
|
// Super basic check.
|
||||||
|
//
|
||||||
|
// FIXME: The latter replace doens't really work if ' is used in a string
|
||||||
|
var showResult = data.result.trim()
|
||||||
|
showResult = showResult.split(" None").join(" \"None\"")
|
||||||
|
showResult = showResult.split("\'").join("\"")
|
||||||
|
|
||||||
var jsonvalid = true
|
var jsonvalid = true
|
||||||
try {
|
try {
|
||||||
const tmp = String(JSON.parse(showResult))
|
const tmp = String(JSON.parse(showResult))
|
||||||
|
|||||||
Reference in New Issue
Block a user