From f6edb2aeb71e339e2d39e4d71b50dc79b547830c Mon Sep 17 00:00:00 2001 From: frikky Date: Sun, 27 Sep 2020 20:44:53 +0200 Subject: [PATCH] Fixed bugs in appcreator --- backend/go-app/codegen.go | 4 ++-- backend/go-app/walkoff.go | 2 +- frontend/src/views/AngularWorkflow.jsx | 12 +++++++----- frontend/src/views/AppCreator.jsx | 2 ++ 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/backend/go-app/codegen.go b/backend/go-app/codegen.go index 5ac9340a..c23070f3 100644 --- a/backend/go-app/codegen.go +++ b/backend/go-app/codegen.go @@ -553,7 +553,7 @@ func generateYaml(swagger *openapi3.Swagger, newmd5 string) (*openapi3.Swagger, }) } else if securitySchemes["BasicAuth"] != nil { api.Authentication.Parameters = append(api.Authentication.Parameters, AuthenticationParams{ - Name: "username_auth", + Name: "username_basic", Value: "", Example: "username", Description: securitySchemes["BasicAuth"].Value.Description, @@ -565,7 +565,7 @@ func generateYaml(swagger *openapi3.Swagger, newmd5 string) (*openapi3.Swagger, }) api.Authentication.Parameters = append(api.Authentication.Parameters, AuthenticationParams{ - Name: "password_auth", + Name: "password_basic", Value: "", Example: "*****", Description: securitySchemes["BasicAuth"].Value.Description, diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index 5a3156f2..73982dac 100644 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -1843,7 +1843,7 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) { if !found && param.Required { log.Printf("Appaction %s with required param %s doesn't exist.", action.Name, param.Name) resp.WriteHeader(401) - resp.Write([]byte(`{"success": false}`)) + resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Appaction %s with required param '%s' is empty."}`, action.Name, param.Name))) return } diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index 81ccc578..353d36c9 100644 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -5476,7 +5476,7 @@ const AngularWorkflow = (props) => { {executionData.results === undefined || executionData.results === null || executionData.results.length === 0 && executionData.status === "EXECUTING" ? : - executionData.results.map(data => { + executionData.results.map((data, index) => { if (executionData.results.length !== 1 && !showSkippedActions && (data.status === "SKIPPED" || data.status === "FAILURE")) { return null } @@ -5504,7 +5504,7 @@ const AngularWorkflow = (props) => { {data.action.app_name} return ( -
+
{actionimg} {data.action.label} @@ -5806,6 +5806,7 @@ const AngularWorkflow = (props) => { console.log(authenticationOption) if (authenticationOption.label.length === 0) { alert.info("Label can't be empty") + return } for (var key in selectedApp.authentication.parameters) { @@ -5819,7 +5820,6 @@ const AngularWorkflow = (props) => { selectedAction.selectedAuthentication = authenticationOption selectedAction.authentication.push(authenticationOption) setSelectedAction(selectedAction) - setUpdate(authenticationOption.id) var newAuthOption = JSON.parse(JSON.stringify(authenticationOption)) var newFields = [] @@ -5834,6 +5834,7 @@ const AngularWorkflow = (props) => { console.log("FIELDS: ", newFields) newAuthOption.fields = newFields setNewAppAuth(newAuthOption) + setUpdate(authenticationOption.id) } return ( @@ -5842,7 +5843,6 @@ const AngularWorkflow = (props) => { What is this?
These are required fields for authenticating with {selectedApp.name}
- {selectedApp.link.length > 0 ? : null} Name - what is this used for? { authenticationOption.label = event.target.value }} /> + {selectedApp.link.length > 0 ?
: null}
{selectedApp.authentication.parameters.map((data, index) => { @@ -5912,9 +5913,10 @@ const AngularWorkflow = (props) => { const EndpointData = () => { const [tmpVar, setTmpVar] = React.useState("") + return (
- The API endpoint to use (URL) - leave this if you're unsure + The API endpoint to use (URL) - predefined in the app { } } + console.log("SCHEMES: ", securitySchemes) + setActions(newActions) setIsAppLoaded(true) }