From 8ab60dd30a99d38d623d2e7c785a1108b73c5838 Mon Sep 17 00:00:00 2001 From: frikky Date: Tue, 26 May 2020 18:10:23 +0200 Subject: [PATCH] Bugfixes found Shuffle blog part 2 --- backend/app_sdk/app_base.py | 1 + backend/go-app/codegen.go | 1 + backend/go-app/main.go | 2 +- backend/go-app/walkoff.go | 15 ++++++++++++--- frontend/src/AngularWorkflow.js | 4 ++-- frontend/src/AppCreator.js | 2 +- frontend/src/Workflows.js | 6 +++--- 7 files changed, 21 insertions(+), 10 deletions(-) diff --git a/backend/app_sdk/app_base.py b/backend/app_sdk/app_base.py index d15792a0..03a71e01 100644 --- a/backend/app_sdk/app_base.py +++ b/backend/app_sdk/app_base.py @@ -588,6 +588,7 @@ class AppBase: logging.basicConfig(format="{asctime} - {name} - {levelname}:{message}", style='{') logger = logging.getLogger(f"{cls.__name__}") logger.setLevel(logging.DEBUG) + print("Started execution!!") app = cls(redis=None, logger=logger, console_logger=logger) diff --git a/backend/go-app/codegen.go b/backend/go-app/codegen.go index abe03fa8..c8e4e6ee 100644 --- a/backend/go-app/codegen.go +++ b/backend/go-app/codegen.go @@ -637,6 +637,7 @@ func getRunner(classname string) string { return fmt.Sprintf(` # Run the actual thing after we've checked params def run(request): + print("Started execution!") action = request.get_json() print(action) print(type(action)) diff --git a/backend/go-app/main.go b/backend/go-app/main.go index dc73b5c4..53d21219 100644 --- a/backend/go-app/main.go +++ b/backend/go-app/main.go @@ -5748,10 +5748,10 @@ func runInit(ctx context.Context) { } } + //log.Printf("Schedule time: every %d seconds", schedule.Seconds) jobret, err := newscheduler.Every(schedule.Seconds).Seconds().NotImmediately().Run(job) if err != nil { log.Printf("Failed to schedule workflow: %s", err) - // FIXME: what now? lol:w } scheduledJobs[schedule.Id] = jobret diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index 07ae2c18..af100687 100644 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -2340,7 +2340,16 @@ func scheduleWorkflow(resp http.ResponseWriter, request *http.Request) { return } - log.Printf("Schedulearg: %s", string(scheduleArg)) + // Clean up garbage. This might be wrong in some very specific use-cases + parsedBody := string(scheduleArg) + parsedBody = strings.Replace(parsedBody, "\\\"", "\"", -1) + if len(parsedBody) > 0 { + if string(parsedBody[0]) == `"` && string(parsedBody[len(parsedBody)-1]) == "\"" { + parsedBody = parsedBody[1 : len(parsedBody)-1] + } + } + + log.Printf("Schedulearg: %s", parsedBody) err = createSchedule( ctx, @@ -2348,7 +2357,7 @@ func scheduleWorkflow(resp http.ResponseWriter, request *http.Request) { workflow.ID, schedule.Name, schedule.Frequency, - scheduleArg, + []byte(parsedBody), ) // FIXME - real error message lol @@ -3325,7 +3334,6 @@ func iterateOpenApiGithub(fs billy.Filesystem, dir []os.FileInfo, extra string, // Check the file filename := file.Name() if strings.Contains(filename, "yaml") || strings.Contains(filename, "yml") { - appCounter += 1 //log.Printf("File: %s", filename) //log.Printf("Found file: %s", filename) tmpExtra := fmt.Sprintf("%s%s/", extra, file.Name()) @@ -3395,6 +3403,7 @@ func iterateOpenApiGithub(fs billy.Filesystem, dir []os.FileInfo, extra string, log.Printf("Failed setting workflowapp in loop: %s", err) continue } else { + appCounter += 1 log.Printf("Added %s:%s to the database from OpenAPI repo", api.Name, api.AppVersion) // Set OpenAPI datastore diff --git a/frontend/src/AngularWorkflow.js b/frontend/src/AngularWorkflow.js index bc9d99fe..46996c91 100644 --- a/frontend/src/AngularWorkflow.js +++ b/frontend/src/AngularWorkflow.js @@ -4118,7 +4118,7 @@ const AngularWorkflow = (props) => {
- Run how often (seconds)? + Interval (seconds)
{

Executing Workflow

{executionData.execution_argument !== undefined && executionData.execution_argument.length > 0 ?
-

Execution Argument:

{executionText} +

Execution Argument:

{executionData.execution_argument}
: null } {executionData.status !== undefined && executionData.status.length > 0 ? diff --git a/frontend/src/AppCreator.js b/frontend/src/AppCreator.js index 24ab8353..6ccd9d35 100644 --- a/frontend/src/AppCreator.js +++ b/frontend/src/AppCreator.js @@ -600,7 +600,7 @@ const AppCreator = (props) => { console.log("Location: ", parameterLocation) console.log("Name: ", parameterName) const apiKey = authenticationOption === "API key" ? -
+

API key

{
-

Welcome to Shuffle!

+

Welcome to Shuffle

- Shuffle is a flexible, easy to use, automation framework allowing users to integrate their services and devices to reduce the amount of manual labor required for those tasks. Click here for more information. + Shuffle is a flexible, easy to use, automation platform allowing users to integrate their services and devices freely. It's made to significantly reduce the amount of manual labor, and is focused on security applications. Click here to learn more.

- If you want to jump straight into it, click the following button to create your first workflow: + If you want to jump straight into it, click here to create your first workflow: