Fixed bugs related to app execution

This commit is contained in:
frikky
2021-04-22 17:44:54 +02:00
parent 6301897945
commit 312588ba0e
4 changed files with 9 additions and 28 deletions
+5 -3
View File
@@ -1212,7 +1212,10 @@ class AppBase:
if len(value) == 0: if len(value) == 0:
return basejson, False return basejson, False
if isinstance(basejson[value], str): if isinstance(basejson, list):
print("VALUE IN ISINSTANCE IS NOT TO BE USED (list): %s" % value)
return basejson, False
elif isinstance(basejson[value], str):
print(f"LOADING STRING '%s' AS JSON" % basejson[value]) print(f"LOADING STRING '%s' AS JSON" % basejson[value])
try: try:
basejson = json.loads(basejson[value]) basejson = json.loads(basejson[value])
@@ -1754,7 +1757,7 @@ class AppBase:
action["parameters"][counter]["value"] = json.dumps(newvalue) action["parameters"][counter]["value"] = json.dumps(newvalue)
except json.decoder.JSONDecodeError as e: except json.decoder.JSONDecodeError as e:
print("Failed JSON replacement for OpenAPI keys (2) %s", val["key"]) print("Failed JSON replacement for OpenAPI keys (2) {e}")
#if "\n" in action["parameters"][counter]["value"]: #if "\n" in action["parameters"][counter]["value"]:
# print("MODIFYING BODY!!") # print("MODIFYING BODY!!")
@@ -1852,7 +1855,6 @@ class AppBase:
print("PRE new_replacement") print("PRE new_replacement")
# FIXME: Only do this IF they want to loop
new_replacement = [] new_replacement = []
for i in range(len(json_replacement)): for i in range(len(json_replacement)):
if isinstance(json_replacement[i], dict) or isinstance(json_replacement[i], list): if isinstance(json_replacement[i], dict) or isinstance(json_replacement[i], list):
+2 -23
View File
@@ -2457,12 +2457,6 @@ func handleWebhookCallback(resp http.ResponseWriter, request *http.Request) {
log.Printf("This should trigger in the cloud. Duplicate action allowed onprem.") log.Printf("This should trigger in the cloud. Duplicate action allowed onprem.")
} }
type ExecutionStruct struct {
Start string `json:"start"`
ExecutionSource string `json:"execution_source"`
ExecutionArgument string `json:"execution_argument"`
}
body, err := ioutil.ReadAll(request.Body) body, err := ioutil.ReadAll(request.Body)
if err != nil { if err != nil {
log.Printf("Body data error: %s", err) log.Printf("Body data error: %s", err)
@@ -2476,26 +2470,11 @@ func handleWebhookCallback(resp http.ResponseWriter, request *http.Request) {
// This is a specific fix for MSteams and may fix other things as well // This is a specific fix for MSteams and may fix other things as well
// Scared whether it may stop other things though, but that's a future problem // Scared whether it may stop other things though, but that's a future problem
// (famous last words) // (famous last words)
parsedBody := string(body)
if strings.Contains(parsedBody, "choice") {
if strings.Count(parsedBody, `\\n`) > 2 {
parsedBody = strings.Replace(parsedBody, `\\n`, "", -1)
}
if strings.Count(parsedBody, `\u0022`) > 2 {
parsedBody = strings.Replace(parsedBody, `\u0022`, `"`, -1)
}
if strings.Count(parsedBody, `\\"`) > 2 {
parsedBody = strings.Replace(parsedBody, `\\"`, `"`, -1)
}
if strings.Contains(parsedBody, `"extra": "{`) { parsedBody = shuffle.GetExecutiobody(body)
parsedBody = strings.Replace(parsedBody, `"extra": "{`, `"extra": {`, 1)
parsedBody = strings.Replace(parsedBody, `}"}`, `}}`, 1)
}
}
//log.Printf("\n\nPARSEDBODY: %s", parsedBody) //log.Printf("\n\nPARSEDBODY: %s", parsedBody)
newBody := ExecutionStruct{ newBody := shuffle.ExecutionStruct{
Start: hook.Start, Start: hook.Start,
ExecutionSource: "webhook", ExecutionSource: "webhook",
ExecutionArgument: parsedBody, ExecutionArgument: parsedBody,
+1 -1
View File
@@ -1,7 +1,7 @@
version: '3' version: '3'
services: services:
frontend: frontend:
build: ./frontend #build: ./frontend
image: ghcr.io/frikky/shuffle-frontend:0.8.74 image: ghcr.io/frikky/shuffle-frontend:0.8.74
container_name: shuffle-frontend container_name: shuffle-frontend
hostname: shuffle-frontend hostname: shuffle-frontend
+1 -1
View File
@@ -1348,7 +1348,7 @@ const AngularWorkflow = (props) => {
return return
} }
if (originalLocation.x === 0 && originalLocation.y === 0) { if (originalLocation.x === 0 && originalLocation.y === 0 && nodedata.position !== undefined) {
console.log("Updating location!: ", nodedata) console.log("Updating location!: ", nodedata)
originalLocation.x = nodedata.position.x originalLocation.x = nodedata.position.x
originalLocation.y = nodedata.position.y originalLocation.y = nodedata.position.y