BUG: Subflow trigger bugfixes
This commit is contained in:
@@ -1461,7 +1461,12 @@ class AppBase:
|
||||
# FIXME: Only do this IF they want to loop
|
||||
new_replacement = []
|
||||
for i in range(len(json_replacement)):
|
||||
newvalue = tmpitem.replace(actualitem[0][0], json_replacement[i], 1)
|
||||
if isinstance(json_replacement[i], dict) or isinstance(json_replacement[i], dict):
|
||||
tmp_replacer = json.dumps(json_replacement[i])
|
||||
newvalue = tmpitem.replace(actualitem[0][0], tmp_replacer, 1)
|
||||
else:
|
||||
newvalue = tmpitem.replace(actualitem[0][0], json_replacement[i], 1)
|
||||
|
||||
try:
|
||||
newvalue = json.loads(newvalue)
|
||||
except json.decoder.JSONDecodeError as e:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
NAME=shuffle-app_sdk
|
||||
VERSION=0.8.5
|
||||
VERSION=0.8.51
|
||||
|
||||
docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force
|
||||
docker build . -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION
|
||||
|
||||
@@ -7173,8 +7173,10 @@ func runInit(ctx context.Context) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if len(users) == 1 {
|
||||
log.Printf("Found 1 user - %s.", users[0].Username)
|
||||
if len(users) < 5 && len(users) > 0 {
|
||||
for _, user := range users {
|
||||
log.Printf("Username: %s, role: %s", user.Username, user.Role)
|
||||
}
|
||||
} else {
|
||||
log.Printf("Found %d users.", len(users))
|
||||
}
|
||||
|
||||
@@ -1240,20 +1240,19 @@ func runWorkflowExecutionTransaction(ctx context.Context, attempts int64, workfl
|
||||
}
|
||||
|
||||
extraInputs := 0
|
||||
for _, result := range workflowExecution.Results {
|
||||
if result.Action.Name == "User Input" && result.Action.AppName == "User Input" {
|
||||
log.Printf("Found User Input node - prepare cloud?")
|
||||
for _, trigger := range workflowExecution.Workflow.Triggers {
|
||||
if trigger.Name == "User Input" && trigger.AppName == "User Input" {
|
||||
extraInputs += 1
|
||||
} else if result.Action.Name == "run_subflow" && result.Action.AppName == "shuffle-subflow" {
|
||||
log.Printf("[INFO] Found Shuffle Workflow node")
|
||||
} else if trigger.Name == "Shuffle Workflow" && trigger.AppName == "Shuffle Workflow" {
|
||||
extraInputs += 1
|
||||
}
|
||||
}
|
||||
|
||||
//log.Printf("LENGTH: %d - %d", len(workflowExecution.Results), len(workflowExecution.Workflow.Actions))
|
||||
//log.Printf("EXTRA: %d", extraInputs)
|
||||
//log.Printf("LENGTH: %d - %d", len(workflowExecution.Results), len(workflowExecution.Workflow.Actions)+extraInputs)
|
||||
|
||||
if len(workflowExecution.Results) == len(workflowExecution.Workflow.Actions)+extraInputs {
|
||||
log.Printf("\nIN HERE WITH RESULTS %d vs %d\n", len(workflowExecution.Results), len(workflowExecution.Workflow.Actions)+extraInputs)
|
||||
//log.Printf("\nIN HERE WITH RESULTS %d vs %d\n", len(workflowExecution.Results), len(workflowExecution.Workflow.Actions)+extraInputs)
|
||||
finished := true
|
||||
lastResult := ""
|
||||
|
||||
@@ -1367,13 +1366,15 @@ func runWorkflowExecutionTransaction(ctx context.Context, attempts int64, workfl
|
||||
}
|
||||
}
|
||||
|
||||
if setExecution {
|
||||
if setExecution || workflowExecution.Status == "FINISHED" || workflowExecution.Status == "ABORTED" || workflowExecution.Status == "FAILURE" {
|
||||
err = setWorkflowExecution(ctx, *workflowExecution, dbSave)
|
||||
if err != nil {
|
||||
resp.WriteHeader(401)
|
||||
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Failed setting workflowexecution actionresult: %s"}`, err)))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
log.Printf("Skipping setexec with status %s", workflowExecution.Status)
|
||||
}
|
||||
|
||||
//ExecutionId
|
||||
@@ -2070,7 +2071,17 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) {
|
||||
trigger.Status = "stopped"
|
||||
}
|
||||
} else if trigger.TriggerType == "SUBFLOW" {
|
||||
//log.Printf("Found subflow: %#v", trigger.Parameters)
|
||||
for _, param := range trigger.Parameters {
|
||||
if len(param.Value) == 0 && param.Name != "argument" {
|
||||
workflow.IsValid = false
|
||||
workflow.Errors = []string{"Trigger is missing a parameter: %s", param.Name}
|
||||
|
||||
log.Printf("No type specified for user input node")
|
||||
resp.WriteHeader(401)
|
||||
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Trigger %s is missing the parameter %s"}`, trigger.Label, param.Name)))
|
||||
return
|
||||
}
|
||||
}
|
||||
} else if trigger.TriggerType == "WEBHOOK" && trigger.Status != "uninitialized" {
|
||||
hook, err := getHook(ctx, trigger.ID)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user