From 2c1d5ba74e8a08f178732838439238a80a031de4 Mon Sep 17 00:00:00 2001 From: frikky Date: Wed, 21 Apr 2021 08:20:35 +0200 Subject: [PATCH] Improved app execution configuration --- backend/go-app/go.mod | 3 +- backend/go-app/go.sum | 2 + backend/go-app/main.go | 7 +- docker-compose.yml | 4 +- frontend/src/components/ParsedAction.jsx | 4 + frontend/src/views/AngularWorkflow.jsx | 94 ++++++++++++++++-------- frontend/src/views/AppCreator.jsx | 2 +- frontend/src/views/LoginPage.jsx | 1 + frontend/src/views/Workflows.jsx | 2 +- 9 files changed, 82 insertions(+), 37 deletions(-) diff --git a/backend/go-app/go.mod b/backend/go-app/go.mod index eced0ea8..93e0b67b 100644 --- a/backend/go-app/go.mod +++ b/backend/go-app/go.mod @@ -2,7 +2,7 @@ module shuffle go 1.13 -//replace github.com/frikky/shuffle-shared => ../../../../git/shuffle-shared +replace github.com/frikky/shuffle-shared => ../../../../git/shuffle-shared //replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi @@ -14,6 +14,7 @@ require ( github.com/Masterminds/semver v1.5.0 // indirect github.com/Microsoft/go-winio v0.4.14 // indirect github.com/basgys/goxml2json v1.1.0 + github.com/bradfitz/slice v0.0.0-20180809154707-2b758aa73013 // indirect github.com/carlescere/scheduler v0.0.0-20170109141437-ee74d2f83d82 github.com/docker/distribution v2.7.1+incompatible // indirect github.com/docker/docker v1.13.1 diff --git a/backend/go-app/go.sum b/backend/go-app/go.sum index 7e5d3932..b2034158 100644 --- a/backend/go-app/go.sum +++ b/backend/go-app/go.sum @@ -57,6 +57,8 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYU github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/basgys/goxml2json v1.1.0 h1:4ln5i4rseYfXNd86lGEB+Vi652IsIXIvggKM/BhUKVw= github.com/basgys/goxml2json v1.1.0/go.mod h1:wH7a5Np/Q4QoECFIU8zTQlZwZkrilY0itPfecMw41Dw= +github.com/bradfitz/slice v0.0.0-20180809154707-2b758aa73013 h1:/P9/RL0xgWE+ehnCUUN5h3RpG3dmoMCOONO1CCvq23Y= +github.com/bradfitz/slice v0.0.0-20180809154707-2b758aa73013/go.mod h1:pccXHIvs3TV/TUqSNyEvF99sxjX2r4FFRIyw6TZY9+w= github.com/carlescere/scheduler v0.0.0-20170109141437-ee74d2f83d82 h1:9bAydALqAjBfPHd/eAiJBHnMZUYov8m2PkXVr+YGQeI= github.com/carlescere/scheduler v0.0.0-20170109141437-ee74d2f83d82/go.mod h1:tyA14J0sA3Hph4dt+AfCjPrYR13+vVodshQSM7km9qw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= diff --git a/backend/go-app/main.go b/backend/go-app/main.go index 6417dd55..de0800fa 100644 --- a/backend/go-app/main.go +++ b/backend/go-app/main.go @@ -5208,9 +5208,14 @@ func runInit(ctx context.Context) { } // Fixing workflows to have real activeorg IDs + //workflowQ := datastore.NewQuery("workflow") + //ret, err := dbclient.GetAll(ctx, workflowQ, &workflows) + //log.Printf("[INFO] Found %d workflows during startup", workflowCount) + //log.Printf("%#v, %s", ret, err) + + var workflows []shuffle.Workflow if len(activeOrgs) == 1 { q := datastore.NewQuery("workflow").Limit(35) - var workflows []shuffle.Workflow _, err = dbclient.GetAll(ctx, q, &workflows) if err != nil && len(workflows) == 0 { log.Printf("Error getting workflows in runinit: %s", err) diff --git a/docker-compose.yml b/docker-compose.yml index 55f7a079..dd791466 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3' services: frontend: - #build: ./frontend + build: ./frontend image: ghcr.io/frikky/shuffle-frontend:0.8.74 container_name: shuffle-frontend hostname: shuffle-frontend @@ -79,6 +79,8 @@ services: - "8000:8000" networks: - shuffle + environment: + - _JAVA_OPTIONS="-Xmx2g" restart: unless-stopped volumes: - ${DB_LOCATION}:/etc/shuffle diff --git a/frontend/src/components/ParsedAction.jsx b/frontend/src/components/ParsedAction.jsx index 40590a4a..1ebf3187 100644 --- a/frontend/src/components/ParsedAction.jsx +++ b/frontend/src/components/ParsedAction.jsx @@ -546,6 +546,10 @@ const ParsedAction = (props) => { var disabled = false var rows = "5" var openApiHelperText = "This is an OpenAPI specific field" + if (selectedApp.generated && data.name === "url" && data.required && data.configuration && hideExtraTypes) { + console.log("GENERATED WITH DATA: ", data) + return null + } if (selectedApp.generated && data.name === "body") { const regex = /\${(\w+)}/g const found = placeholder.match(regex) diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index 56cc8168..c4aab2f6 100644 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -688,6 +688,13 @@ const AngularWorkflow = (props) => { const saveWorkflow = (curworkflow) => { var success = false + + if (isCloud && !isLoggedIn) { + console.log("Should redirect to register with redirect.") + window.location.href = `/register?view=/workflows/${props.match.params.key}&message=You need sign up to use workflows with Shuffle` + return + } + setSavingState(2) // This might not be the right course of action, but seems logical, as items could be running already @@ -1163,7 +1170,7 @@ const AngularWorkflow = (props) => { if (responseJson.public) { alert.info("This workflow is public. You will have to save it to make it your own!") - setLastSaved(false) + //setLastSaved(false) } setWorkflow(responseJson) @@ -1267,8 +1274,9 @@ const AngularWorkflow = (props) => { // Comparing locations between nodes and setting views const onNodeDrag = (event) => { - //console.log("DRAGGING: ", event.target) - //console.log("LEN2: ", event.target.edges.length) + if (Object.getOwnPropertyNames(selectedAction).length === 0) { + return + } const nodedata = event.target.data() if (nodedata.app_name == "Shuffle Tools" || nodedata.app_name == "Testing") { @@ -1281,6 +1289,12 @@ const AngularWorkflow = (props) => { // 3. If it is, then hide text } + console.log(nodedata) + var x = event.clientX, y = event.clientY, + elementMouseIsOver = document.elementFromPoint(x, y) + console.log("ELEMENT: ", elementMouseIsOver) + + /* event.target.animate({ @@ -2952,10 +2966,11 @@ const AngularWorkflow = (props) => { id="appsearch" onKeyPress={(event) => { if (event.key === "Enter") { - runSearch(event.target.value) + event.target.blur(event) } }} onBlur={(event) => { + console.log("BLUR: ", event.target.value) runSearch(event.target.value) }} /> @@ -2972,12 +2987,19 @@ const AngularWorkflow = (props) => { })} : -
- - - Loading apps - -
+ apps.length > 0 ? +
+ + Couldn't find app. Is it active? + +
+ : +
+ + + Loading apps + +
} @@ -5385,25 +5407,27 @@ const AngularWorkflow = (props) => {
{executionButton}
- - { - setExecutionText(e.target.value) - }} - /> - + {workflow.public ? null : + + { + setExecutionText(e.target.value) + }} + /> + + } - @@ -5411,7 +5435,7 @@ const AngularWorkflow = (props) => { {workflow.public ? -