Fixed instaloop autocomplete

This commit is contained in:
frikky
2020-10-02 04:45:14 +02:00
parent 16a6bb2179
commit cfb074d898
4 changed files with 25 additions and 10 deletions
+4 -4
View File
@@ -391,14 +391,14 @@ class AppBase:
return newvalue, True return newvalue, True
elif len(actualitem) > 0: elif len(actualitem) > 0:
# FIXME: This is absolutely not perfect. # FIXME: This is absolutely not perfect.
print("IN HERE: ", actualitem) print("In recursion v2: ", actualitem)
newvalue = [] newvalue = []
firstitem = actualitem[0][0] firstitem = actualitem[0][0]
seconditem = actualitem[0][1] seconditem = actualitem[0][1]
if seconditem == "": if seconditem == "":
print("In first") print("In first")
basejson = basejson[int(firstitem)] newvalue = basejson[int(firstitem)]
else: else:
if seconditem == "max": if seconditem == "max":
seconditem = len(basejson) seconditem = len(basejson)
@@ -868,7 +868,7 @@ 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("ITEM: %d" % len(actualitem)) print("LENGTH: %d" % len(actualitem))
if len(actualitem) > 0: if len(actualitem) > 0:
multiexecution = True multiexecution = True
@@ -985,7 +985,7 @@ class AppBase:
print("KeyError: %s" % e) print("KeyError: %s" % e)
baseparams[key] = "KeyError: %s" % e baseparams[key] = "KeyError: %s" % e
#print("Running with params %s" % baseparams) print("Running with params %s" % baseparams)
ret = await func(**baseparams) ret = await func(**baseparams)
if isinstance(ret, dict) or isinstance(ret, list): if isinstance(ret, dict) or isinstance(ret, list):
results.append(ret) results.append(ret)
-1
View File
@@ -3117,7 +3117,6 @@ func getSpecificWorkflow(resp http.ResponseWriter, request *http.Request) {
//} else { //} else {
// //log.Printf("Set cache for %s", item.Key) // //log.Printf("Set cache for %s", item.Key)
//} //}
log.Println(workflow.IsValid)
resp.WriteHeader(200) resp.WriteHeader(200)
resp.Write(body) resp.Write(body)
+4 -1
View File
@@ -2513,6 +2513,10 @@ const AngularWorkflow = (props) => {
// Look for the ID // Look for the ID
const found = false const found = false
for (var key in workflowExecutions) { for (var key in workflowExecutions) {
if (workflowExecutions[key].results === undefined || workflowExecutions[key].results === null) {
continue
}
const foundResult = workflowExecutions[key].results.find(result => result.action.id === item.id) const foundResult = workflowExecutions[key].results.find(result => result.action.id === item.id)
if (foundResult === undefined) { if (foundResult === undefined) {
continue continue
@@ -3939,7 +3943,6 @@ const AngularWorkflow = (props) => {
<DialogContent style={{display: "flex"}}> <DialogContent style={{display: "flex"}}>
<Tooltip color="primary" title={conditionValue.configuration ? "Negated" : "Default"} placement="top"> <Tooltip color="primary" title={conditionValue.configuration ? "Negated" : "Default"} placement="top">
<Button color="primary" variant={conditionValue.configuration ? "contained" : "outlined"} style={{margin: "auto", height: 50, marginBottom: "auto", marginTop: "auto", marginRight: 5}} onClick={(e) => { <Button color="primary" variant={conditionValue.configuration ? "contained" : "outlined"} style={{margin: "auto", height: 50, marginBottom: "auto", marginTop: "auto", marginRight: 5}} onClick={(e) => {
console.log("VALUE: ", conditionValue.configuration)
conditionValue.configuration = !conditionValue.configuration conditionValue.configuration = !conditionValue.configuration
setConditionValue(conditionValue) setConditionValue(conditionValue)
setUpdate(Math.random()) setUpdate(Math.random())
+17 -4
View File
@@ -43,21 +43,34 @@ const inputColor = "#383B40"
// Parses JSON data into keys that can be used everywhere :) // Parses JSON data into keys that can be used everywhere :)
export const GetParsedPaths = (inputdata, basekey) => { export const GetParsedPaths = (inputdata, basekey) => {
const splitkey = " => " const splitkey = " > "
var parsedValues = [] var parsedValues = []
if (typeof(inputdata) !== "object") { if (typeof(inputdata) !== "object") {
return parsedValues return parsedValues
} }
for (const [key, value] of Object.entries(inputdata)) { for (const [key, value] of Object.entries(inputdata)) {
// Check if loop or JSON // Check if loop or JSON
const extra = basekey.length > 0 ? splitkey : "" const extra = basekey.length > 0 ? splitkey : ""
const basekeyname = `${basekey.slice(1,basekey.length).split(".").join(splitkey)}${extra}${key}` const basekeyname = `${basekey.slice(1, basekey.length).split(".").join(splitkey)}${extra}${key}`
// Handle direct loop!
if (!isNaN(key) && basekey === "") {
console.log("Handling direct loop.")
parsedValues.push({"type": "object", "name": "Node", "autocomplete": `${basekey}`})
parsedValues.push({"type": "list", "name": `${splitkey}list`, "autocomplete": `${basekey}.#`})
const returnValues = GetParsedPaths(value, `${basekey}.#`)
for (var subkey in returnValues) {
parsedValues.push(returnValues[subkey])
}
return parsedValues
}
console.log("KEY: ", key, "VALUE: ", value, "BASEKEY: ", basekeyname)
if (typeof(value) === 'object') { if (typeof(value) === 'object') {
if (Array.isArray(value)) { if (Array.isArray(value)) {
// Check if each item is object // Check if each item is object
console.log("VALUE: ", value)
parsedValues.push({"type": "object", "name": basekeyname, "autocomplete": `${basekey}.${key}`}) parsedValues.push({"type": "object", "name": basekeyname, "autocomplete": `${basekey}.${key}`})
parsedValues.push({"type": "list", "name": `${basekeyname}${splitkey}list`, "autocomplete": `${basekey}.${key}.#`}) parsedValues.push({"type": "list", "name": `${basekeyname}${splitkey}list`, "autocomplete": `${basekey}.${key}.#`})