#512: Fixed frontend mechanism for unselecting router conditions

This commit is contained in:
frikky
2021-10-22 13:59:31 +02:00
parent 7144c911d7
commit a506b6e124
4 changed files with 23 additions and 10 deletions
+2 -2
View File
@@ -2,7 +2,7 @@ module main
go 1.15 go 1.15
replace github.com/shuffle/shuffle-shared => ../../../../git/shuffle-shared //replace github.com/shuffle/shuffle-shared => ../../../../git/shuffle-shared
//replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi //replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi
//replace github.com/frikky/go-elasticsearch => ../../../../git/go-elasticsearch //replace github.com/frikky/go-elasticsearch => ../../../../git/go-elasticsearch
@@ -21,7 +21,7 @@ require (
github.com/gorilla/mux v1.8.0 github.com/gorilla/mux v1.8.0
github.com/h2non/filetype v1.1.1 github.com/h2non/filetype v1.1.1
github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid v1.2.0
github.com/shuffle/shuffle-shared v0.1.17 github.com/shuffle/shuffle-shared v0.1.18
go4.org v0.0.0-20201209231011-d4a079459e60 // indirect go4.org v0.0.0-20201209231011-d4a079459e60 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
google.golang.org/api v0.58.0 google.golang.org/api v0.58.0
+7 -7
View File
@@ -849,7 +849,7 @@ func handleWorkflowQueue(resp http.ResponseWriter, request *http.Request) {
var trigger shuffle.Trigger var trigger shuffle.Trigger
err = json.Unmarshal([]byte(actionResult.Result), &trigger) err = json.Unmarshal([]byte(actionResult.Result), &trigger)
if err != nil { if err != nil {
log.Printf("Failed unmarshaling actionresult for user input: %s", err) log.Printf("[WARNING] Failed unmarshaling actionresult for user input: %s", err)
resp.WriteHeader(401) resp.WriteHeader(401)
resp.Write([]byte(`{"success": false}`)) resp.Write([]byte(`{"success": false}`))
return return
@@ -862,21 +862,21 @@ func handleWorkflowQueue(resp http.ResponseWriter, request *http.Request) {
err := handleUserInput(trigger, orgId, workflowExecution.Workflow.ID, workflowExecution.ExecutionId) err := handleUserInput(trigger, orgId, workflowExecution.Workflow.ID, workflowExecution.ExecutionId)
if err != nil { if err != nil {
log.Printf("Failed userinput handler: %s", err) log.Printf("[WARNING] Failed userinput handler: %s", err)
actionResult.Result = fmt.Sprintf("Cloud error: %s", err) actionResult.Result = fmt.Sprintf("Cloud error: %s", err)
workflowExecution.Results = append(workflowExecution.Results, actionResult) workflowExecution.Results = append(workflowExecution.Results, actionResult)
workflowExecution.Status = "ABORTED" workflowExecution.Status = "ABORTED"
err = shuffle.SetWorkflowExecution(ctx, *workflowExecution, true) err = shuffle.SetWorkflowExecution(ctx, *workflowExecution, true)
if err != nil { if err != nil {
log.Printf("Failed to set execution during wait") log.Printf("[WARNING] Failed to set execution during wait: %s", err)
} else { } else {
log.Printf("Successfully set the execution to waiting.") log.Printf("[INFO] Successfully set the execution %s to waiting.", workflowExecution.ExecutionId)
} }
resp.WriteHeader(401) resp.WriteHeader(401)
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Error: %s"}`, err))) resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Error: %s"}`, err)))
} else { } else {
log.Printf("Successful userinput handler") log.Printf("[INFO] Successful userinput handler")
resp.WriteHeader(200) resp.WriteHeader(200)
resp.Write([]byte(fmt.Sprintf(`{"success": true, "reason": "CLOUD IS DONE"}`))) resp.Write([]byte(fmt.Sprintf(`{"success": true, "reason": "CLOUD IS DONE"}`)))
@@ -886,7 +886,7 @@ func handleWorkflowQueue(resp http.ResponseWriter, request *http.Request) {
workflowExecution.Status = actionResult.Status workflowExecution.Status = actionResult.Status
err = shuffle.SetWorkflowExecution(ctx, *workflowExecution, true) err = shuffle.SetWorkflowExecution(ctx, *workflowExecution, true)
if err != nil { if err != nil {
log.Printf("Failed ") log.Printf("[WARNING] Failed setting userinput: %s", err)
} else { } else {
log.Printf("Successfully set the execution to waiting.") log.Printf("Successfully set the execution to waiting.")
} }
@@ -1995,7 +1995,7 @@ func getWorkflowApps(resp http.ResponseWriter, request *http.Request) {
// Double unmarshal because of user apps // Double unmarshal because of user apps
newbody, err := json.Marshal(newapps) newbody, err := json.Marshal(newapps)
if err != nil { if err != nil {
log.Printf("Failed unmarshalling all newapps: %s", err) log.Printf("[ERROR] Failed unmarshalling all newapps: %s", err)
resp.WriteHeader(401) resp.WriteHeader(401)
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Failed unpacking workflow apps"}`))) resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Failed unpacking workflow apps"}`)))
return return
+1 -1
View File
@@ -16,7 +16,7 @@ services:
depends_on: depends_on:
- backend - backend
backend: backend:
build: ./backend #build: ./backend
image: ghcr.io/frikky/shuffle-backend:nightly image: ghcr.io/frikky/shuffle-backend:nightly
container_name: shuffle-backend container_name: shuffle-backend
hostname: ${BACKEND_HOSTNAME} hostname: ${BACKEND_HOSTNAME}
+13
View File
@@ -1595,6 +1595,19 @@ const AngularWorkflow = (props) => {
if (event.target.data().decorator) { if (event.target.data().decorator) {
alert.info("This edge can't be edited.") alert.info("This edge can't be edited.")
} else { } else {
console.log("DATA: ", event.target.data())
const destinationId = event.target.data("target")
console.log("DATA: ", event.target.data())
const curaction = workflow.actions.find(a => a.id === destinationId)
console.log("ACTION: ", curaction)
if (curaction !== undefined && curaction !== null) {
if (curaction.app_name == "Shuffle Tools" && curaction.name === "router") {
alert.info("Router action can't have incoming conditions")
event.target.unselect()
return
}
}
setSelectedEdgeIndex(workflow.branches.findIndex(data => data.id === event.target.data()["id"])) setSelectedEdgeIndex(workflow.branches.findIndex(data => data.id === event.target.data()["id"]))
setSelectedEdge(event.target.data()) setSelectedEdge(event.target.data())
} }