Fixed webhook

This commit is contained in:
frikky
2020-05-14 10:43:05 +02:00
parent 809a1824ff
commit 33f6d85e09
3 changed files with 31 additions and 12 deletions
+5 -5
View File
@@ -774,7 +774,7 @@ func handleWorkflowQueue(resp http.ResponseWriter, request *http.Request) {
}
}
log.Printf("Checking results %d vs %d", len(workflowExecution.Results), len(workflowExecution.Workflow.Actions)+extraInputs)
//log.Printf("Checking results %d vs %d", len(workflowExecution.Results), len(workflowExecution.Workflow.Actions)+extraInputs)
if len(workflowExecution.Results) == len(workflowExecution.Workflow.Actions)+extraInputs {
finished := true
for _, result := range workflowExecution.Results {
@@ -1611,7 +1611,6 @@ func cleanupExecutions(resp http.ResponseWriter, request *http.Request) {
func handleExecution(id string, workflow Workflow, request *http.Request) (WorkflowExecution, string, error) {
ctx := context.Background()
if workflow.ID == "" || workflow.ID != id {
log.Printf("UPDATING WORKFLOW")
tmpworkflow, err := getWorkflow(ctx, id)
if err != nil {
log.Printf("Failed getting the workflow locally: %s", err)
@@ -1668,6 +1667,10 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
return WorkflowExecution{}, "", err
}
if execution.Start == "" && len(body) > 0 {
execution.ExecutionArgument = string(body)
}
// FIXME - this should have "execution_argument" from executeWorkflow frontend
if len(execution.ExecutionArgument) > 0 {
workflowExecution.ExecutionArgument = execution.ExecutionArgument
@@ -1835,7 +1838,6 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
onpremExecution := false
environments := []string{}
for _, action := range workflowExecution.Workflow.Actions {
log.Printf("ENV: %#v", action.Environment)
if action.Environment != cloudname {
found := false
for _, env := range environments {
@@ -1859,8 +1861,6 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
return WorkflowExecution{}, "Failed getting workflowexecution", err
}
log.Printf("Environments: %#v", environments)
// Adds queue for onprem execution
// FIXME - add specifics to executionRequest, e.g. specific environment (can run multi onprem)
if onpremExecution {
+8 -3
View File
@@ -801,7 +801,6 @@ const AngularWorkflow = (props) => {
workflow.start = node.data('id')
setWorkflow(workflow)
}
}
const onEdgeRemoved = (event) => {
@@ -1642,8 +1641,6 @@ const AngularWorkflow = (props) => {
}
newNodeId = uuid.v4()
console.log(data)
const newposition = {
"x": e.pageX-cycontainer.offsetLeft,
"y": e.pageY-cycontainer.offsetTop,
@@ -1671,6 +1668,10 @@ const AngularWorkflow = (props) => {
position: newposition,
}
if (data.trigger_type === "WEBHOOK") {
newAppData.status = "running"
}
// Can all the data be in here? hmm
const nodeToBeAdded = {
group: "nodes",
@@ -1714,6 +1715,10 @@ const AngularWorkflow = (props) => {
}
setWorkflow(workflow)
if (data.trigger_type === "WEBHOOK") {
newWebhook(newAppData)
saveWorkflow(workflow)
}
}
}
}
+18 -4
View File
@@ -575,9 +575,26 @@ const Workflows = (props) => {
var starttime = new Date(selectedExecution.started_at*1000)
var endtime = new Date(selectedExecution.started_at*1000)
var parsedArgument = selectedExecution.execution_argument
if (selectedExecution.execution_argument !== undefined && selectedExecution.execution_argument.length > 0) {
parsedArgument = replaceAll(parsedArgument, " None", " \"None\"");
}
const arg = selectedExecution.execution_argument !== undefined && selectedExecution.execution_argument.length > 0 ?
<div>
Argument: {selectedExecution.execution_argument}
Execution argument: {(parsedArgument.startsWith("{") && parsedArgument.endsWith("}")) || (parsedArgument.startsWith("[{") && parsedArgument.endsWith("}]")) ?
<div>
<ReactJson
src={JSON.parse(parsedArgument)}
theme="solarized"
collapsed={true}
displayDataTypes={false}
name={"Execution argument"}
/>
</div>
:
selectedExecution.execution_argument
}
</div>
: null
/*
@@ -603,9 +620,6 @@ const Workflows = (props) => {
<div>
Finished: {endtime.toISOString()}
</div>
<div>
Result: {selectedExecution.result}
</div>
<div>
Last node: {selectedExecution.last_node}
</div>