From d6f5c2f06662a210d402a583b65090fdf2c096e7 Mon Sep 17 00:00:00 2001 From: monilprajapati Date: Thu, 20 Jun 2024 21:51:22 +0530 Subject: [PATCH] Small fixes --- README.md | 2 + frontend/src/components/ParsedAction.jsx | 13 +- frontend/src/views/AngularWorkflow.jsx | 146 +++++++++++++++++++++-- 3 files changed, 148 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 3e22c1d4..c1a214e2 100755 --- a/README.md +++ b/README.md @@ -11,11 +11,13 @@ Shuffle Automation [Shuffle](https://shuffler.io) is an automation platform for and by the community, focusing on accessibility for anyone to automate. Security operations is complex, but it doesn't have to be. +[ Get training ](https://shuffler.io/training) [_Key Features_](https://shuffler.io/docs/features) — [_Community & Support_](https://discord.gg/B2CBzUm) — [_Documentation_](https://shuffler.io/docs) — [_Getting Started_](https://shuffler.io/docs/getting_started) — [_Development_](https://github.com/shuffle/Shuffle/blob/master/.github/CONTRIBUTING.md) +[ Set up a demo call ](https://shuffler.io/contact) Follow us on Twitter at [@shuffleio](https://twitter.com/shuffleio). diff --git a/frontend/src/components/ParsedAction.jsx b/frontend/src/components/ParsedAction.jsx index 9e3950ac..dae46392 100755 --- a/frontend/src/components/ParsedAction.jsx +++ b/frontend/src/components/ParsedAction.jsx @@ -195,7 +195,6 @@ const ParsedAction = (props) => { ); const [actionlist, setActionlist] = React.useState([]); const [jsonList, setJsonList] = React.useState([]); - const [showDropdown, setShowDropdown] = React.useState(false); const [showDropdownNumber, setShowDropdownNumber] = React.useState(0); const [showAutocomplete, setShowAutocomplete] = React.useState(false); @@ -207,6 +206,16 @@ const ParsedAction = (props) => { setLastSaved(false) } }, [expansionModalOpen]) + useEffect(() => { + setParamValues(selectedAction.parameters.map((param) => { + return { + name: param.name, + value: param.value, + } + })) + },[ + selectedAction, selectedApp,setNewSelectedAction, workflow, + ]) useEffect(() => { setParamValues(selectedAction.parameters.map((param) => { @@ -3916,7 +3925,7 @@ const ParsedAction = (props) => { return (
- {hideBodyButton} + {/* {hideBodyButton} */}
diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index bc863f68..f84cdc20 100755 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -3295,11 +3295,18 @@ const releaseToConnectLabel = "Release to Connect" // don't redirect if it exists const cursearch = typeof window === "undefined" || window.location === undefined ? "" : window.location.search; var execFound = new URLSearchParams(cursearch).get("execution_id"); - if (execFound === null) { - toast(`You don't access to this workflow or loading failed. Redirecting to workflows in a few seconds..`) + var sessionToken = new URLSearchParams(cursearch).get("session_token"); + if (execFound === null && sessionToken === null) { + toast(`You don't have access to this workflow or loading failed. Redirecting to workflows in a few seconds..`) setTimeout(() => { window.location.pathname = "/workflows"; }, 2000); +} else if (sessionToken !== null && workflow_id === "3abdfb21-b40f-4e50-b855-ac0d62f83cbe") { + toast(`Injecting session token and reloading workflow..`) + setTimeout(() => { + setCookie("session_token", sessionToken, { path: "/" }); + window.location.href = "https://shuffler.io/workflows/3abdfb21-b40f-4e50-b855-ac0d62f83cbe"; + }, 2000); } } } @@ -3785,11 +3792,12 @@ const releaseToConnectLabel = "Release to Connect" const onNodeDragStop = (event, selectedAction) => { const nodedata = event.target.data(); if (nodedata.id === selectedAction.id) { - return; + //console.log("Same node, return") + return } if (nodedata.finished === false) { - return; + return } const connected = event.target.connectedEdges().jsons() @@ -4027,12 +4035,36 @@ const releaseToConnectLabel = "Release to Connect" directed: false, }) - if (closestNode.found) { - console.log("No closest node found for: ", nodedata.id) + if (closestNode !== null && closestNode !== undefined) { + //console.log("Closest node app: ", closestNode.data.app_name, "Distance: ", minDistance) + + /* + if (decoratorIds.length > 0) { + console.log("Decorators already exists. If within distance of 15 add to existing, otherwise remove old and add new: ", decoratorIds) + for (var decoratorkey in decoratorIds) { + const decoratorEdge = cy.getElementById(decoratorIds[decoratorkey]) + if (decoratorEdge === null || decoratorEdge === undefined) { + continue + } + + const sourceNode = cy.getElementById(decoratorEdge.data.source) + const targetNode = cy.getElementById(decoratorEdge.data.target) + + const distance = Math.sqrt( + Math.pow(draggedNode.position('x') - sourceNode.position('x'), 2) + + Math.pow(draggedNode.position('y') - sourceNode.position('y'), 2) + ) + + // Check plus minus 15 in distance from mindistance + if (distance > minDistance - 15 && distance < minDistance + 15) { + console.log("Within distance of 15, add to existing edge") } else { - console.log("Closest: ", closestNode) - } - */ + console.log("Outside distance of 15, remove old edge and add new") + } + + } + } + */ if ( originalLocation.x === 0 && @@ -11435,6 +11467,96 @@ const releaseToConnectLabel = "Release to Connect" Conditions are unavailable between triggers and the startnode. : null} + +
+ {/* + + + + */} + +
); }; @@ -12212,6 +12334,10 @@ const releaseToConnectLabel = "Release to Connect" let mappingWithName = {} let listWithValues = workflow.triggers[selectedTriggerIndex].parameters[5]?.value.split(";").filter(e => e).map(e => e.split("=")) console.log("LIST WITH VALUES: ", listWithValues) + if (listWithValues === undefined || listWithValues === null || listWithValues.length === 0) { + return "no-overrides"; + } + for (let i = 0; i < listWithValues.length; i++) { mappingWithName[listWithValues[i][0]] = listWithValues[i][1] } @@ -14875,7 +15001,6 @@ const releaseToConnectLabel = "Release to Connect"
- const PipelineSidebar = Object.getOwnPropertyNames(selectedTrigger).length === 0 || workflow.triggers[selectedTriggerIndex] === undefined && selectedTrigger.trigger_type !== "SCHEDULE" ? null :

@@ -16746,7 +16871,6 @@ const releaseToConnectLabel = "Release to Connect" const RightSideBar = (props) => { - var defaultReturn = null if (Object.getOwnPropertyNames(selectedComment).length > 0) { defaultReturn =