From 5353f5aa63859eecc247d1fee1e01fc13616e246 Mon Sep 17 00:00:00 2001 From: frikky Date: Tue, 12 Oct 2021 00:27:32 +0200 Subject: [PATCH] Fixed Hybrid triggers and minor view changes --- backend/Dockerfile | 1 - backend/app_sdk/app_base.py | 1 + backend/go-app/go.mod | 4 +- backend/go-app/main.go | 2 - backend/go-app/walkoff.go | 4 +- docker-compose.yml | 6 +- frontend/package.json | 6 +- frontend/src/components/Header.js | 9 +- frontend/src/views/Admin.jsx | 3 + frontend/src/views/AngularWorkflow.jsx | 169 ++++++++++++++++--------- frontend/src/views/Workflows.jsx | 15 ++- 11 files changed, 141 insertions(+), 79 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index c3e3ee87..f0a48525 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -7,7 +7,6 @@ WORKDIR /app ADD ./go-app/main.go /app ADD ./go-app/walkoff.go /app ADD ./go-app/docker.go /app -ADD ./go-app/oauth2.go /app ADD ./go-app/go.mod /app diff --git a/backend/app_sdk/app_base.py b/backend/app_sdk/app_base.py index a483b6fd..252885b2 100644 --- a/backend/app_sdk/app_base.py +++ b/backend/app_sdk/app_base.py @@ -1521,6 +1521,7 @@ class AppBase: if variablename.lower() == actionname_lower: baseresult = variable["value"] break + except KeyError as e: print("[INFO] KeyError wf variables: %s" % e) pass diff --git a/backend/go-app/go.mod b/backend/go-app/go.mod index 749f1507..960ac02a 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 @@ -23,7 +23,7 @@ require ( github.com/docker/go-units v0.4.0 // indirect github.com/elastic/go-elasticsearch/v7 v7.13.1 // indirect github.com/frikky/kin-openapi v0.39.0 - github.com/frikky/shuffle-shared v0.1.5 + github.com/frikky/shuffle-shared v0.1.12 github.com/fsouza/go-dockerclient v1.7.2 github.com/ghodss/yaml v1.0.0 github.com/go-git/go-billy/v5 v5.0.0 diff --git a/backend/go-app/main.go b/backend/go-app/main.go index ea6c9d16..53b58fb4 100644 --- a/backend/go-app/main.go +++ b/backend/go-app/main.go @@ -2602,7 +2602,6 @@ func findValidScheduleAppFolders(rootAppFolder string) ([]string, error) { appFiles, err := ioutil.ReadDir(appFolderLocation) if err != nil { // Invalid app folder (deleted within a few MS lol) - log.Printf("%s", err) invalidRootFolders = append(invalidRootFolders, rootfile.Name()) continue } @@ -3168,7 +3167,6 @@ func buildSwaggerApp(resp http.ResponseWriter, body []byte, user shuffle.User) { swagger, err := swaggerLoader.LoadSwaggerFromData(body) if err != nil { log.Printf("[ERROR] Swagger validation error: %s", err) - //log.Printf("%s", string(body)) resp.WriteHeader(500) resp.Write([]byte(`{"success": false, "reason": "Failed verifying openapi"}`)) return diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index aaf6e2a6..8539dbd3 100644 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -730,7 +730,7 @@ func handleGetStreamResults(resp http.ResponseWriter, request *http.Request) { ctx := context.Background() workflowExecution, err := shuffle.GetWorkflowExecution(ctx, actionResult.ExecutionId) if err != nil { - //log.Printf("Failed getting execution (streamresult) %s: %s", actionResult.ExecutionId, err) + log.Printf("Failed getting execution (streamresult) %s: %s", actionResult.ExecutionId, err) resp.WriteHeader(401) resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Bad authorization key or execution_id might not exist."}`))) return @@ -1910,7 +1910,6 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request //b, err := json.Marshal(workflowExecution) //if err == nil { - // log.Printf("%s", string(b)) // log.Printf("LEN: %d", len(string(b))) // //workflowExecution.ExecutionOrg.SyncFeatures = Org{} //} @@ -3095,7 +3094,6 @@ func iterateOpenApiGithub(fs billy.Filesystem, dir []os.FileInfo, extra string, // 3. Load this as a "standby" app // FIXME: This should be a function ROFL - //log.Printf("%s", string(readFile)) swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData([]byte(parsedOpenApi.Body)) if err != nil { log.Printf("[WARNING] Swagger validation error in loop (%s): %s. Continuing.", filename, err) diff --git a/docker-compose.yml b/docker-compose.yml index 2445fe52..09f810e1 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:nightly container_name: shuffle-frontend hostname: shuffle-frontend @@ -16,7 +16,7 @@ services: depends_on: - backend backend: - #build: ./backend + build: ./backend image: ghcr.io/frikky/shuffle-backend:nightly container_name: shuffle-backend hostname: ${BACKEND_HOSTNAME} @@ -66,7 +66,7 @@ services: - CLEANUP=${SHUFFLE_CONTAINER_AUTO_CLEANUP} restart: unless-stopped opensearch: - image: opensearchproject/opensearch:1.0.1 + image: opensearchproject/opensearch:1.1.0 hostname: shuffle-opensearch container_name: shuffle-opensearch environment: diff --git a/frontend/package.json b/frontend/package.json index 8fa85406..dde376fd 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,14 +1,16 @@ { "name": "shuffler", "homepage": "https://shuffler.io", - "version": "0.8.92", + "version": "0.9.22", "private": true, "dependencies": { "@material-ui/core": "^4.5.2", "@material-ui/data-grid": "^4.0.0-alpha.22", - "@material-ui/icons": "^4.5.1", + "@material-ui/icons": "^4.11.2", "@material-ui/lab": "^4.0.0-alpha.58", "@material-ui/styles": "^4.5.2", + "@material-ui/utils": "^4.11.2", + "@mui/icons-material": "^5.0.3", "@uiw/react-codemirror": "^3.2.1", "@use-it/interval": "^1.0.0", "babel-eslint": "^10.1.0", diff --git a/frontend/src/components/Header.js b/frontend/src/components/Header.js index 8fe90568..a25b8679 100644 --- a/frontend/src/components/Header.js +++ b/frontend/src/components/Header.js @@ -6,7 +6,8 @@ import {Link} from 'react-router-dom'; import { useTheme } from '@material-ui/core/styles'; import { Chip, Badge, Typography, Paper, Tooltip, List, Avatar, Menu, ListItem, MenuItem, Select, Button, IconButton, Grid } from '@material-ui/core'; -import { Notifications as NotificationsIcon, Home as HomeIcon, Polymer as PolymerIcon, Apps as AppsIcon, Description as DescriptionIcon} from '@material-ui/icons'; +import { MeetingRoom as MeetingRoomIcon, Settings as SettingsIcon, Notifications as NotificationsIcon, Home as HomeIcon, Polymer as PolymerIcon, Apps as AppsIcon, Description as DescriptionIcon} from '@material-ui/icons'; +//import LogoutIcon from '@mui/icons-material/Logout'; import { useAlert } from "react-alert"; const hoverColor = "#f85a3e" @@ -331,7 +332,7 @@ const Header = props => { anchorEl={anchorElAvatar} keepMounted open={Boolean(anchorElAvatar)} - style={{zIndex: 10002}} + style={{zIndex: 10012}} onClose={() => { handleClose() }} @@ -341,7 +342,7 @@ const Header = props => { handleClose() }}> - Settings + Settings { @@ -349,7 +350,7 @@ const Header = props => { handleClose() handleClickLogout() }}> - Logout + Logout diff --git a/frontend/src/views/Admin.jsx b/frontend/src/views/Admin.jsx index 3f783bfc..24bcef4d 100644 --- a/frontend/src/views/Admin.jsx +++ b/frontend/src/views/Admin.jsx @@ -1015,6 +1015,9 @@ const Admin = (props) => { } const getOrgs = () => { + // API no longer in use, as it's in handleInfo request + return + fetch(globalUrl + "/api/v1/orgs", { method: 'GET', headers: { diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index 8e062351..8c4558db 100644 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -36,6 +36,7 @@ import { Element as ScrollElement, animateScroll as scroll, scrollSpy, scroller const surfaceColor = "#27292D" const inputColor = "#383B40" +const appSorter = "favorite_apps" // http://apps.cytoscape.org/apps/yfileslayoutalgorithms cytoscape.use(edgehandles); @@ -314,13 +315,16 @@ const AngularWorkflow = (props) => { } } - if (param.name === "startnode" && outersub.id !== undefined) { - console.log("SHOULD SET STARTNODE IN SUBFLOW SELECTION: ", outersub) - const innernode = outersub.actions.find(action => action.id === param.value) - console.log("FOUND NODE: ", innernode) - if (innernode !== undefined && subworkflowStartnode.id !== innernode.id) { - setSubworkflowStartnode(innernode) - } + console.log("PARAM: ", param) + //console.log("PARAMVAL: ", param.value) + if (param.name === "startnode" && param.value !== undefined && param.value !== null) { + //console.log("SHOULD SET STARTNODE IN SUBFLOW SELECTION: ", outersub) + //const innernode = outersub.actions.find(action => action.id === param.value) + //console.log("FOUND NODE: ", innernode) + //if (innernode !== undefined && subworkflowStartnode.id !== innernode.id) { + //setSubworkflowStartnode(JSON.parse(JSON.stringify(param.value))) + setSubworkflowStartnode(param.value) + //} /* const sub = responseJson.find(data => data.id === param.value) setSubworkflow(sub) @@ -780,9 +784,10 @@ const AngularWorkflow = (props) => { } } - const saveWorkflow = (curworkflow) => { + const saveWorkflow = (curworkflow, executionArgument, startNode) => { 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` @@ -914,6 +919,12 @@ const AngularWorkflow = (props) => { return response.json() }) .then((responseJson) => { + if (executionArgument !== undefined && startNode !== undefined) { + console.log("Running execution AFTER saving") + executeWorkflow(executionArgument, startNode, true) + return + } + if (!responseJson.success) { console.log(responseJson) alert.error("Failed to save: "+responseJson.reason) @@ -993,17 +1004,20 @@ const AngularWorkflow = (props) => { return true } - const executeWorkflow = (executionArgument, startNode) => { - if (!lastSaved) { + const executeWorkflow = (executionArgument, startNode, hasSaved) => { + if (hasSaved === false) { //alert.error("You might have forgotten to save before executing.") + //const saveWorkflow = (curworkflow) => { + setExecutionRequestStarted(true) + saveWorkflow(workflow, executionArgument, startNode) console.log("FIXME: Might have forgotten to save before executing.") + return } if (workflow.public) { alert.info("Save it to get a new version") } - var returncheck = monitorUpdates() if (!returncheck) { alert.error("No startnode set.") @@ -1012,7 +1026,6 @@ const AngularWorkflow = (props) => { setVisited([]) setExecutionRequest({}) - setExecutionRequestStarted(true) stop() var curelements = cy.elements() @@ -1908,7 +1921,7 @@ const AngularWorkflow = (props) => { // cy.getElementById(currentNode.data.id).remove() // } //} - } else if (data.buttonType === "set_startnode") { + } else if (data.buttonType === "set_startnode" && data.type !== "TRIGGER") { const parentNode = cy.getElementById(data.attachedTo) if (parentNode !== null && parentNode !== undefined) { var oldstartnode = cy.getElementById(workflow.start) @@ -2640,6 +2653,30 @@ const AngularWorkflow = (props) => { } if (nodedata.type === "ACTION") { + /* + const tmpView = localStorage.getItem(appSorter) + const nodekey = nodedata.id + if (tmpView === null || tmpView === undefined) { + const basedata = {} + basedata[nodekey] = 1 + localStorage.setItem(appSorter, JSON.stringify(basedata)) + } else { + try { + var parsed = JSON.parse(tmpView) + try { + parsed[nodekey] += 1 + } catch { + parsed[nodekey] = 1 + } + + localStorage.setItem(appSorter, JSON.stringify(parsed)) + } catch { + console.log("Bad data in tmpView: ", tmpView) + } + } + console.log("FAVORITeS: ", tmpView) + */ + if (workflow.actions.length === 1 && workflow.actions[0].id === workflow.start) { const newEdgeUuid = uuidv4() const newcybranch = { @@ -2694,6 +2731,12 @@ const AngularWorkflow = (props) => { setWorkflow(workflow) } else if (nodedata.type === "TRIGGER") { + if (nodedata.is_valid === false) { + alert.info("This trigger is not available to you") + node.remove() + return + } + if (workflow.triggers === undefined) { workflow.triggers = [nodedata] } else { @@ -2794,8 +2837,7 @@ const AngularWorkflow = (props) => { // } //} else { // //console.log("Shouldnt re-add info? ") - //} - + //} } const onEdgeRemoved = (event) => { @@ -4085,6 +4127,19 @@ const AngularWorkflow = (props) => { "description": "Simple HTTP webhook", "long_description": "Execute a workflow with an unauthicated POST request", }, + { + "name": "Schedule", + "type": "TRIGGER", + "status": "uninitialized", + "description": "Schedule execution time", + "trigger_type": "SCHEDULE", + "errors": null, + "large_image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAAAAABVicqIAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAd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NDMtMDQ6MDAaDzvkAAAAAElFTkSuQmCC", + "label": "Schedule", + "is_valid": true, + "environment": "onprem", + "long_description": "Create a schedule based on cron", + }, { "name": "Shuffle Workflow", "type": "TRIGGER", @@ -4106,24 +4161,11 @@ const AngularWorkflow = (props) => { "description": "Wait for user input", "trigger_type": "USERINPUT", "errors": null, - "is_valid": true, + "is_valid": cloudSyncEnabled || isCloud ? true : false, "label": "User input", "environment": "cloud", "long_description": "Take user input to continue execution", }, - { - "name": "Schedule", - "type": "TRIGGER", - "status": "uninitialized", - "description": "Schedule execution time", - "trigger_type": "SCHEDULE", - "errors": null, - "large_image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAAAAABVicqIAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfjCB8QNSt2pVcCAAAIxUlEQVRo3u2aa4xV1RXH/2vtfWeAYQbBBwpUBqGkjQLKw4LQ1NqmDy2RxmKJSGxiaatttbWhabQPSFuT2i+NqdFKbVqjjDZGYxqgxFbbWgHlNSkBChQj8ii+ZV4Mc/be/34459w5995zH4zYpA3709x7z9m/vdbae6/XCPH+D/0vMM5AzkDOQBoY9hSfJ4n4khCISGMvySlcKww0UvYNpAFdNAxhEAXQc/T1g2/2RFJoOW/8OeNHAaDXepwGIYEGOL5146a9/z5R/LJp7KRp86+4UOJf3yskUKVv/ZN/OQoAogIIQQYAaJ117aL2ehjWHcEF7lsxEQK1RgeNLaLGKgSti5919L76DPUhzvPAV0cAanL3khgDyMf+GOjCUCHB8Z0VI6GFGsYVq8Cnt1cXpg7Eez7ZXiKEiKgxqqqSFUcx7M5+uqFAHLuWQwYRYqzNfsjAjWLmdka5Kqu5u5ztvOkfNoTko4oHICNHtzSHqK+rywMwCEyZruX+ZV5zLFcL4uzTy7qtT24RZUDh4iv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3+pVuSMrqARjwBtI5qbeZAb/fxAMBISDppYtzIB5bmltHrNQR6bwNsMbQULekBZD6INZi1o8p5qt/a2DC1rD8jqqpamiEZg+HfPzG01gYZHLt/0AYxtZo0RoGrO4fcpCHpPF/5ZhugNie9E1FrAblyHd9Du4mxg335rilp4yyrN2MNBK1LnvM1a8cNtwBP/OmpP78aLz4WiHF3pm3u1Ysm1mkBnkozs3vbxk17jmabmRfNmD9vwmlqZsYLhwHQe/SNV97ojrTQcv74MRPaAIRwutqyCYdl853uBnM6LdNqxPvUKh/y+P/594UzkDOQ/3HIfwCAE6puXSx5zQAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxOS0wOC0zMVQxNjo1Mzo0My0wNDowMGtSg1gAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTktMDgtMzFUMTY6NTM6NDMtMDQ6MDAaDzvkAAAAAElFTkSuQmCC", - "label": "Schedule", - "is_valid": true, - "environment": "onprem", - "long_description": "Create a schedule based on cron", - }, { "name": "Office365", "type": "TRIGGER", @@ -5795,7 +5837,8 @@ const AngularWorkflow = (props) => { : "https%3A%2F%2Fshuffler.io%2Fapi%2Fv1%2Ftriggers%2Foutlook%2Fregister" : "http%3A%2F%2Flocalhost:5001%2Fapi%2Fv1%2Ftriggers%2Foutlook%2Fregister" - const client_id = "fd55c175-aa30-4fa6-b303-09a29fb3f750" + //const client_id = "fd55c175-aa30-4fa6-b303-09a29fb3f750" + const client_id = "bb4bff85-0d0b-4f5d-8a69-3cee8029b11a" //isCloud ? userdata.username : const username = userdata.id @@ -5808,9 +5851,12 @@ const AngularWorkflow = (props) => { return } + //console.log("SELECTED: ", selectedTrigger. + console.log("BRANCH: ", branch) const startnode = branch.destination_id - const url = `https://login.microsoftonline.com/common/oauth2/authorize?access_type=offline&client_id=${client_id}&redirect_uri=${redirectUri}&resource=https%3A%2F%2Fgraph.microsoft.com&response_type=code&scope=Mail.Read+User.Read+https%3A%2F%2Foutlook.office.com%2Fmail.read&state=workflow_id%3D${props.match.params.key}%26trigger_id%3D${selectedTrigger.id}username%3D${username}%26type%3Doutlook%26start%3d${startnode}&prompt=login` + const url = `https://login.microsoftonline.com/common/oauth2/authorize?access_type=offline&client_id=${client_id}&redirect_uri=${redirectUri}&resource=https%3A%2F%2Fgraph.microsoft.com&response_type=code&scope=Mail.Read+User.Read+https%3A%2F%2Foutlook.office.com%2Fmail.read&prompt=login&state=workflow_id%3D${props.match.params.key}%26trigger_id%3D${selectedTrigger.id}%26username%3D${username}%26type%3Doutlook%26start%3d${startnode}` + //const url = `https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent&client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&scope=${scopes}&state=workflow_id%3D${props.match.params.key}%26trigger_id%3D${selectedTrigger.id}%26username%3D${username}%26type%3Dgmail%26start%3d${startnode}` //const scopes = "https://www.googleapis.com/auth/gmail.readonly" //const url = `https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent&client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&scope=${scopes}&state=workflow_id%3D${props.match.params.key}%26trigger_id%3D${selectedTrigger.id}%26username%3D${username}%26type%3Dgmail%26start%3d${startnode}` @@ -6331,7 +6377,7 @@ const AngularWorkflow = (props) => { workflow.triggers[selectedTriggerIndex].parameters[1] = {"name": "argument", "value": ""} workflow.triggers[selectedTriggerIndex].parameters[2] = {"name": "user_apikey", "value": ""} workflow.triggers[selectedTriggerIndex].parameters[3] = {"name": "startnode", "value": ""} - workflow.triggers[selectedTriggerIndex].parameters[4] = {"name": "check_result", "value": "true"} + workflow.triggers[selectedTriggerIndex].parameters[4] = {"name": "check_result", "value": "false"} console.log("SETTINGS: ", userSettings) if (userSettings !== undefined && userSettings !== null && userSettings.apikey !== null && userSettings.apikey !== undefined && userSettings.apikey.length > 0) { @@ -6411,24 +6457,23 @@ const AngularWorkflow = (props) => { onChange={(e) => { setUpdate(Math.random()) workflow.triggers[selectedTriggerIndex].parameters[0].value = e.target.value.id - setSubworkflowStartnode(e.target.value.start) + setSubworkflow(e.target.value) // Sets the startnode if (e.target.value.id !== workflow.id) { console.log("WORKFLOW: ", e.target.value) - setSubworkflow(e.target.value) const startnode = e.target.value.actions.find(action => action.id === e.target.value.start) if (startnode !== undefined && startnode !== null) { - //ddsetSubworkflowStartnode(innernode) + console.log("STARTNODE: ", startnode) setSubworkflowStartnode(startnode) try { - workflow.triggers[selectedTriggerIndex].parameters[3].value = e.target.value.id + workflow.triggers[selectedTriggerIndex].parameters[3].value = startnode.id } catch { workflow.triggers[selectedTriggerIndex].parameters[3] = { "name": "startnode", - "value": e.target.value.id, + "value": startnode.id, } } @@ -6437,7 +6482,6 @@ const AngularWorkflow = (props) => { console.log("STARTNODE: ", startnode) } else { console.log("WORKFLOW: ", workflow) - setSubworkflow(e.target.value) } setWorkflow(workflow) @@ -6471,7 +6515,8 @@ const AngularWorkflow = (props) => { Select the Startnode -