#445: Fixed startnode issues for import/exports during execution
This commit is contained in:
+22
-15
@@ -1551,23 +1551,32 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request
|
||||
}
|
||||
|
||||
workflowExecution.ExecutionVariables = workflow.ExecutionVariables
|
||||
// Local authorization for this single workflow used in workers.
|
||||
|
||||
// FIXME: Used for cloud
|
||||
//mappedData, err := json.Marshal(workflowExecution)
|
||||
//if err != nil {
|
||||
// log.Printf("Failed workflowexecution marshalling: %s", err)
|
||||
// resp.WriteHeader(http.StatusInternalServerError)
|
||||
// resp.Write([]byte(`{"success": false}`))
|
||||
// return
|
||||
//}
|
||||
|
||||
//log.Println(string(mappedData))
|
||||
|
||||
if len(workflowExecution.Start) == 0 && len(workflowExecution.Workflow.Start) > 0 {
|
||||
workflowExecution.Start = workflowExecution.Workflow.Start
|
||||
}
|
||||
//log.Printf("[INFO] New startnode: %s", workflowExecution.Start)
|
||||
|
||||
startnodeFound := false
|
||||
newStartnode := ""
|
||||
for _, item := range workflowExecution.Workflow.Actions {
|
||||
if item.ID == workflowExecution.Start {
|
||||
startnodeFound = true
|
||||
}
|
||||
|
||||
if item.IsStartNode {
|
||||
newStartnode = item.ID
|
||||
}
|
||||
}
|
||||
|
||||
if !startnodeFound {
|
||||
log.Printf("[INFO] Couldn't find startnode %s. Remapping to %#v", workflowExecution.Start, newStartnode)
|
||||
|
||||
if len(newStartnode) > 0 {
|
||||
workflowExecution.Start = newStartnode
|
||||
} else {
|
||||
return shuffle.WorkflowExecution{}, fmt.Sprintf("Startnode couldn't be found"), errors.New("Startnode isn't defined in this workflow..")
|
||||
}
|
||||
}
|
||||
|
||||
childNodes := shuffle.FindChildNodes(workflowExecution, workflowExecution.Start)
|
||||
|
||||
@@ -2122,8 +2131,6 @@ func executeWorkflow(resp http.ResponseWriter, request *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// FIXME - have a check for org etc too..
|
||||
// FIXME - admin check like this? idk
|
||||
if user.Id != workflow.Owner && user.Role != "scheduler" && user.Role != fmt.Sprintf("workflow_%s", fileId) {
|
||||
if workflow.OrgId == user.ActiveOrg.Id && user.Role == "admin" {
|
||||
log.Printf("[INFO] Letting user %s execute %s because they're admin of the same org", user.Username, workflow.ID)
|
||||
|
||||
@@ -184,7 +184,9 @@ const Admin = (props) => {
|
||||
if (responseJson["success"] === false) {
|
||||
alert.error("Failed stopping schedule")
|
||||
} else {
|
||||
getSchedules()
|
||||
setTimeout(() => {
|
||||
getSchedules()
|
||||
}, 1500)
|
||||
alert.success("Successfully stopped schedule!")
|
||||
}
|
||||
}),
|
||||
|
||||
@@ -930,9 +930,22 @@ const AngularWorkflow = (props) => {
|
||||
}
|
||||
|
||||
const monitorUpdates = () => {
|
||||
const firstnode = cy.getElementById(workflow.start)
|
||||
var firstnode = cy.getElementById(workflow.start)
|
||||
if (firstnode.length === 0) {
|
||||
return false
|
||||
var found = false
|
||||
for (var key in workflow.actions) {
|
||||
if (workflow.actions[key].isStartNode) {
|
||||
console.log("Updating startnode")
|
||||
workflow.start = workflow.actions[key].id
|
||||
firstnode = cy.getElementById(workflow.actions[key].id)
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
cy.elements().removeClass('success-highlight failure-highlight executing-highlight')
|
||||
@@ -6265,7 +6278,13 @@ const AngularWorkflow = (props) => {
|
||||
setWorkflow(workflow)
|
||||
} else {
|
||||
// Always update
|
||||
workflow.triggers[selectedTriggerIndex].parameters[0].value = referenceUrl+"webhook_"+selectedTrigger.id
|
||||
const newUrl = referenceUrl+"webhook_"+selectedTrigger.id
|
||||
console.log("Validating webhook url: ", newUrl)
|
||||
if (newUrl !== workflow.triggers[selectedTriggerIndex].parameters[0].value) {
|
||||
console.log("Url is wrong - updating")
|
||||
workflow.triggers[selectedTriggerIndex].parameters[0].value = newUrl
|
||||
setWorkflow(workflow)
|
||||
}
|
||||
}
|
||||
|
||||
const trigger_header_auth = workflow.triggers[selectedTriggerIndex].parameters.length > 2 ? workflow.triggers[selectedTriggerIndex].parameters[2].value : ""
|
||||
@@ -6650,7 +6669,7 @@ const AngularWorkflow = (props) => {
|
||||
return
|
||||
}
|
||||
|
||||
alert.info("Stopping webhook")
|
||||
//alert.info("Stopping webhook")
|
||||
|
||||
fetch(globalUrl+"/api/v1/hooks/"+trigger.id+"/delete", {
|
||||
method: 'DELETE',
|
||||
|
||||
Reference in New Issue
Block a user