diff --git a/backend/go-app/codegen.go b/backend/go-app/codegen.go index e995afea..aa5200b1 100644 --- a/backend/go-app/codegen.go +++ b/backend/go-app/codegen.go @@ -799,7 +799,6 @@ func handleConnect(swagger *openapi3.Swagger, api WorkflowApp, extraParameters [ } if param.Value.In == "path" { - //log.Printf("PATH!: %s", param.Value.Name) parameters = append(parameters, param.Value.Name) //baseUrl = fmt.Sprintf("%s%s", baseUrl) } else if param.Value.In == "query" { @@ -909,7 +908,6 @@ func handleGet(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wor } if param.Value.In == "path" { - log.Printf("PATH!: %s", param.Value.Name) parameters = append(parameters, param.Value.Name) //baseUrl = fmt.Sprintf("%s%s", baseUrl) } else if param.Value.In == "query" { @@ -1016,7 +1014,6 @@ func handleHead(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wo } if param.Value.In == "path" { - //log.Printf("PATH!: %s", param.Value.Name) parameters = append(parameters, param.Value.Name) //baseUrl = fmt.Sprintf("%s%s", baseUrl) } else if param.Value.In == "query" { @@ -1122,7 +1119,6 @@ func handleDelete(swagger *openapi3.Swagger, api WorkflowApp, extraParameters [] } if param.Value.In == "path" { - //log.Printf("PATH!: %s", param.Value.Name) parameters = append(parameters, param.Value.Name) //baseUrl = fmt.Sprintf("%s%s", baseUrl) } else if param.Value.In == "query" { @@ -1178,9 +1174,9 @@ func handlePost(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wo Parameters: extraParameters, } - if path.Post.RequestBody != nil { - log.Printf("RequestBody: %#v", path.Post.RequestBody) - } + //if path.Post.RequestBody != nil { + // log.Printf("RequestBody: %#v", path.Post.RequestBody) + //} action.Returns.Schema.Type = "string" baseUrl := fmt.Sprintf("%s%s", api.Link, actualPath) @@ -1233,7 +1229,6 @@ func handlePost(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wo } if param.Value.In == "path" { - //log.Printf("PATH!: %s", param.Value.Name) parameters = append(parameters, param.Value.Name) //baseUrl = fmt.Sprintf("%s%s", baseUrl) } else if param.Value.In == "query" { @@ -1339,7 +1334,6 @@ func handlePatch(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []W } if param.Value.In == "path" { - //log.Printf("PATH!: %s", param.Value.Name) parameters = append(parameters, param.Value.Name) //baseUrl = fmt.Sprintf("%s%s", baseUrl) } else if param.Value.In == "query" { @@ -1446,7 +1440,6 @@ func handlePut(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wor } if param.Value.In == "path" { - //log.Printf("PATH!: %s", param.Value.Name) parameters = append(parameters, param.Value.Name) //baseUrl = fmt.Sprintf("%s%s", baseUrl) } else if param.Value.In == "query" { diff --git a/backend/go-app/main.go b/backend/go-app/main.go index 0bfeeda9..8ea76242 100644 --- a/backend/go-app/main.go +++ b/backend/go-app/main.go @@ -4648,7 +4648,7 @@ func handleDeleteOutlookSub(resp http.ResponseWriter, request *http.Request) { ctx := context.Background() workflow, err := getWorkflow(ctx, workflowId) if err != nil { - log.Printf("Failed getting the workflow locally: %s", err) + log.Printf("Failed getting the workflow locally (delete outlook): %s", err) resp.WriteHeader(401) resp.Write([]byte(`{"success": false}`)) return @@ -4782,7 +4782,7 @@ func createOutlookSub(resp http.ResponseWriter, request *http.Request) { ctx := context.Background() workflow, err := getWorkflow(ctx, workflowId) if err != nil { - log.Printf("Failed getting the workflow locally: %s", err) + log.Printf("Failed getting the workflow locally (outlook sub): %s", err) resp.WriteHeader(401) resp.Write([]byte(`{"success": false}`)) return @@ -5765,7 +5765,7 @@ func runInit(ctx context.Context) { _, _, err := handleExecution(schedule.WorkflowId, Workflow{}, request) if err != nil { - log.Printf("Failed to execute: %s", err) + log.Printf("Failed to execute %s: %s", schedule.WorkflowId, err) } } diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index b9fde0ba..beda7595 100644 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -428,7 +428,7 @@ func createSchedule(ctx context.Context, scheduleId, workflowId, name, frequency _, _, err := handleExecution(workflowId, Workflow{}, request) if err != nil { - log.Printf("Failed to execute: %s", err) + log.Printf("Failed to execute %s: %s", workflowId, err) } } @@ -1058,7 +1058,7 @@ func deleteWorkflow(resp http.ResponseWriter, request *http.Request) { ctx := context.Background() workflow, err := getWorkflow(ctx, fileId) if err != nil { - log.Printf("Failed getting the workflow locally: %s", err) + log.Printf("Failed getting the workflow locally (delete workflow): %s", err) resp.WriteHeader(401) resp.Write([]byte(`{"success": false}`)) return @@ -1128,7 +1128,7 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) { return } - log.Println("Start") + //log.Println("Start") user, userErr := handleApiAuthentication(resp, request) if userErr != nil { log.Printf("Api authentication failed in edit workflow: %s", userErr) @@ -1137,7 +1137,7 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) { return } - log.Println("PostUser") + //log.Println("PostUser") location := strings.Split(request.URL.String(), "/") var fileId string @@ -1164,7 +1164,7 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) { tmpworkflow, err := getWorkflow(ctx, fileId) if err != nil { - log.Printf("Failed getting the workflow locally: %s", err) + log.Printf("Failed getting the workflow locally (save workflow): %s", err) resp.WriteHeader(401) resp.Write([]byte(`{"success": false}`)) return @@ -1211,7 +1211,7 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) { // FIXME - this shouldn't be necessary with proper API checks newActions := []Action{} allNodes := []string{} - log.Println("Pre") + //log.Println("Pre") for _, action := range workflow.Actions { allNodes = append(allNodes, action.ID) @@ -1237,7 +1237,7 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) { workflow.Actions = newActions for _, trigger := range workflow.Triggers { - log.Println("TRIGGERS") + //log.Println("TRIGGERS") allNodes = append(allNodes, trigger.ID) } @@ -1260,7 +1260,7 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) { foundNodes := []string{} for _, node := range allNodes { for _, branch := range workflow.Branches { - log.Println("branch") + //log.Println("branch") //log.Println(node) //log.Println(branch.DestinationID) if node == branch.DestinationID || node == branch.SourceID { @@ -1668,7 +1668,7 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf if workflow.ID == "" || workflow.ID != id { tmpworkflow, err := getWorkflow(ctx, id) if err != nil { - log.Printf("Failed getting the workflow locally: %s", err) + log.Printf("Failed getting the workflow locally (execution cleanup): %s", err) return WorkflowExecution{}, "Failed getting workflow", err } @@ -1993,7 +1993,7 @@ func executeWorkflow(resp http.ResponseWriter, request *http.Request) { ctx := context.Background() workflow, err := getWorkflow(ctx, fileId) if err != nil { - log.Printf("Failed getting the workflow locally: %s", err) + log.Printf("Failed getting the workflow locally (execute workflow): %s", err) resp.WriteHeader(401) resp.Write([]byte(`{"success": false}`)) return @@ -2064,7 +2064,7 @@ func stopSchedule(resp http.ResponseWriter, request *http.Request) { ctx := context.Background() workflow, err := getWorkflow(ctx, fileId) if err != nil { - log.Printf("Failed getting the workflow locally: %s", err) + log.Printf("Failed getting the workflow locally (stop schedule): %s", err) resp.WriteHeader(401) resp.Write([]byte(`{"success": false}`)) return @@ -2153,7 +2153,7 @@ func stopScheduleGCP(resp http.ResponseWriter, request *http.Request) { ctx := context.Background() workflow, err := getWorkflow(ctx, fileId) if err != nil { - log.Printf("Failed getting the workflow locally: %s", err) + log.Printf("Failed getting the workflow locally (stop schedule GCP): %s", err) resp.WriteHeader(401) resp.Write([]byte(`{"success": false}`)) return @@ -2275,7 +2275,7 @@ func scheduleWorkflow(resp http.ResponseWriter, request *http.Request) { ctx := context.Background() workflow, err := getWorkflow(ctx, fileId) if err != nil { - log.Printf("Failed getting the workflow locally: %s", err) + log.Printf("Failed getting the workflow locally (schedule workflow): %s", err) resp.WriteHeader(401) resp.Write([]byte(`{"success": false}`)) return @@ -3773,7 +3773,7 @@ func getWorkflowExecutions(resp http.ResponseWriter, request *http.Request) { ctx := context.Background() workflow, err := getWorkflow(ctx, fileId) if err != nil { - log.Printf("Failed getting the workflow locally: %s", err) + log.Printf("Failed getting the workflow locally (get executions): %s", err) resp.WriteHeader(401) resp.Write([]byte(`{"success": false}`)) return diff --git a/frontend/src/AngularWorkflow.js b/frontend/src/AngularWorkflow.js index c1701c69..0ce94cb0 100644 --- a/frontend/src/AngularWorkflow.js +++ b/frontend/src/AngularWorkflow.js @@ -1560,6 +1560,7 @@ const AngularWorkflow = (props) => { aria-controls="long-menu" aria-haspopup="true" onClick={menuClick} + style={{color: "white"}} > @@ -1965,7 +1966,7 @@ const AngularWorkflow = (props) => { node.data.type = "ACTION" node.isStartNode = action["id"] === workflow.start - return node; + return node }) const tmpelements = [].concat(actions) @@ -2001,8 +2002,10 @@ const AngularWorkflow = (props) => { } } - const handleDragStop = (e) => { + const handleDragStop = (e, app) => { newNodeId = "" + console.log("STOP!: ", e) + console.log("APP!: ", app) } const appScrollStyle = { @@ -2063,7 +2066,7 @@ const AngularWorkflow = (props) => { return( {handleAppDrag(e, app)}} - onStop={(e) => {handleDragStop(e)}} + onStop={(e) => {handleDragStop(e, app)}} dragging={false} position={{ x: 0, @@ -2703,11 +2706,11 @@ const AngularWorkflow = (props) => { } const setTriggerFolderWrapperMulti = event => { - const { options } = event.target; - const value = []; + const { options } = event.target + const value = [] for (let i = 0, l = options.length; i < l; i += 1) { if (options[i].selected) { - value.push(options[i].value); + value.push(options[i].value) } } @@ -2783,7 +2786,7 @@ const AngularWorkflow = (props) => { if (splitItems.includes(value)) { for( var i = 0; i < splitItems.length; i++){ if (splitItems[i] === value) { - splitItems.splice(i, 1); + splitItems.splice(i, 1) } } @@ -2793,7 +2796,7 @@ const AngularWorkflow = (props) => { for( var i = 0; i < splitItems.length; i++){ if (splitItems[i] === "") { - splitItems.splice(i, 1); + splitItems.splice(i, 1) } } @@ -2824,7 +2827,7 @@ const AngularWorkflow = (props) => { } const AppConditionHandler = (props) => { - const { tmpdata, type } = props; + const { tmpdata, type } = props if (tmpdata === undefined) { return tmpdata @@ -3192,8 +3195,8 @@ const AngularWorkflow = (props) => { const EdgeSidebar = () => { const ConditionHandler = (condition, index) => { - const [open, setOpen] = React.useState(false); - const [anchorEl, setAnchorEl] = React.useState(null); + const [open, setOpen] = React.useState(false) + const [anchorEl, setAnchorEl] = React.useState(null) const deleteCondition = (conditionIndex) => { console.log(selectedEdge) @@ -3223,7 +3226,7 @@ const AngularWorkflow = (props) => { const menuClick = (event) => { console.log("MENU CLICK") setOpen(!open) - setAnchorEl(event.currentTarget); + setAnchorEl(event.currentTarget) } return ( @@ -3363,7 +3366,7 @@ const AngularWorkflow = (props) => { }) .catch(error => { console.log(error.toString()) - }); + }) } const getTriggerAuth = () => { @@ -3384,7 +3387,7 @@ const AngularWorkflow = (props) => { }) .catch(error => { console.log(error.toString()) - }); + }) } // Getting the triggers and the folders if they exist @@ -3426,8 +3429,8 @@ const AngularWorkflow = (props) => { }) .catch(error => { console.log(error.toString()) - }); - }, 2500); + }) + }, 2500) console.log(data) saveWorkflow(workflow) @@ -3801,7 +3804,7 @@ const AngularWorkflow = (props) => { }) .catch(error => { alert.error(error.toString()) - }); + }) } const startMailSub = (trigger, triggerindex) => { @@ -3857,7 +3860,7 @@ const AngularWorkflow = (props) => { }) .catch(error => { alert.error(error.toString()) - }); + }) } const newWebhook = (trigger) => { @@ -3903,7 +3906,7 @@ const AngularWorkflow = (props) => { }) .catch(error => { console.log(error.toString()) - }); + }) } const deleteWebhook = (trigger, triggerindex) => { @@ -3942,7 +3945,7 @@ const AngularWorkflow = (props) => { }) .catch(error => { alert.error(error.toString()) - }); + }) } const UserinputSidebar = () => { @@ -4356,7 +4359,7 @@ const AngularWorkflow = (props) => { } if (Object.getOwnPropertyNames(selectedAction).length > 0 && Object.getOwnPropertyNames(selectedApp).length > 0) { - //console.time('ACTIONSTART'); + //console.time('ACTIONSTART') return(
{appApiView} @@ -4545,7 +4548,7 @@ const AngularWorkflow = (props) => { executionData.results.map(data => { var showResult = data.result.trim() showResult.split(" None").join(" \"None\"") - //showResult = replaceAll(showResult, " None", " \"None\""); + //showResult = replaceAll(showResult, " None", " \"None\"") var jsonvalid = true try { JSON.parse(showResult) @@ -4569,7 +4572,7 @@ const AngularWorkflow = (props) => { {jsonvalid ? @@ -4872,4 +4875,4 @@ const AngularWorkflow = (props) => { ) } -export default AngularWorkflow; +export default AngularWorkflow diff --git a/frontend/src/App.js b/frontend/src/App.js index e40d7660..af034001 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -147,13 +147,13 @@ const App = (message, props) => { // This is a mess hahahah return ( - - - - {includedData} - - - + + + + {includedData} + + + ); }; diff --git a/frontend/src/AppCreator.js b/frontend/src/AppCreator.js index 67803be1..98aa7146 100644 --- a/frontend/src/AppCreator.js +++ b/frontend/src/AppCreator.js @@ -372,30 +372,6 @@ const AppCreator = (props) => { securitySchemes = data.components.securitySchemes } - // FIXME: Have multiple authentication options? - if (securitySchemes !== undefined) { - for (const [key, value] of Object.entries(securitySchemes)) { - if (value.scheme === "bearer") { - setAuthenticationOption("Bearer auth") - break - } else if (value.type === "apiKey") { - setAuthenticationOption("API key") - - value.in = value.in.charAt(0).toUpperCase() + value.in.slice(1); - setParameterLocation(value.in) - if (!apikeySelection.includes(value.in)) { - console.log("APIKEY SELECT: ", apikeySelection) - alert.error("Might be error in setting up API key authentication") - } - - setParameterName(value.name) - break - } else if (value.scheme === "basic") { - setAuthenticationOption("Basic auth") - break - } - } - } console.log(data) @@ -451,9 +427,36 @@ const AppCreator = (props) => { } } + + // FIXME: Have multiple authentication options? + if (securitySchemes !== undefined) { + for (const [key, value] of Object.entries(securitySchemes)) { + if (value.scheme === "bearer") { + setAuthenticationOption("Bearer auth") + break + } else if (value.type === "apiKey") { + setAuthenticationOption("API key") + + value.in = value.in.charAt(0).toUpperCase() + value.in.slice(1); + setParameterLocation(value.in) + if (!apikeySelection.includes(value.in)) { + console.log("APIKEY SELECT: ", apikeySelection) + alert.error("Might be error in setting up API key authentication") + } + + console.log("PARAM NAME: ", value.name) + setParameterName(value.name) + break + } else if (value.scheme === "basic") { + setAuthenticationOption("Basic auth") + break + } + } + } + setActions(newActions) } - + // Saving the app that's been configured. const submitApp = () => { alert.info("Uploading and building app " + name) @@ -810,7 +813,7 @@ const AppCreator = (props) => { id="standard-required" margin="normal" variant="outlined" - defaultValue={parameterName} + value={parameterName} helperText={
Can't be empty. Can't contain any of the following characters: !#$%&'^+-._~|]+$
} onChange={e => setParameterName(e.target.value)} InputProps={{ @@ -926,11 +929,13 @@ const AppCreator = (props) => { {data.method} - {url} - {data.name}
+ {/*
{testAction(index)}}> Test
+ */}
{deleteAction(index)}}> Delete @@ -1576,13 +1581,15 @@ const AppCreator = (props) => {
{actionView}
+ {/* {testView} + */} {errorCode.length > 0 ? `Error: ${errorCode}` : null} diff --git a/frontend/src/Apps.js b/frontend/src/Apps.js index eb3b9e58..12934d79 100644 --- a/frontend/src/Apps.js +++ b/frontend/src/Apps.js @@ -462,7 +462,8 @@ const Apps = (props) => {
Apps interact with eachother in workflows. They are created with the app creator, using OpenAPI specification or manually in python. Use the links above to find potential apps you're looking for using OpenAPI or make one from scratch. There's 1000+ available.
-
+ +