From aef77d278a5d5086ef6ce21f6704de6038981895 Mon Sep 17 00:00:00 2001 From: frikky Date: Fri, 22 May 2020 10:08:54 +0200 Subject: [PATCH] Fixed condition deletion --- frontend/src/AngularWorkflow.js | 62 +++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/frontend/src/AngularWorkflow.js b/frontend/src/AngularWorkflow.js index bf9ac4cb..ec848df6 100644 --- a/frontend/src/AngularWorkflow.js +++ b/frontend/src/AngularWorkflow.js @@ -1525,10 +1525,10 @@ const AngularWorkflow = (props) => { { try { JSON.parse(event.target.value) } catch (e) { - alert.error("Failed to parse json") + alert.error("Failed to parse json: ", e) } } }} @@ -2939,23 +2939,32 @@ const AngularWorkflow = (props) => {
{data.name}
-
{ - changeActionParameterVariant("STATIC_VALUE") + +
{ + e.preventDefault() + changeActionParameterVariant("STATIC_VALUE") + }}> + +
+
+  |  + +
{ + e.preventDefault() + changeActionParameterVariant("ACTION_RESULT") }}> - static -
+ +
+  |  -
{ - changeActionParameterVariant("ACTION_RESULT") - }}> - action -
-  |  -
{ - changeActionParameterVariant("WORKFLOW_VARIABLE") - }}> - var -
+ +
{ + e.preventDefault() + changeActionParameterVariant("WORKFLOW_VARIABLE") + }}> + +
+
{datafield} @@ -3091,8 +3100,16 @@ const AngularWorkflow = (props) => { const [anchorEl, setAnchorEl] = React.useState(null); const deleteCondition = (conditionIndex) => { - //selectedEdge.conditions.splice(conditionIndex, 1) - //setSelectedEdge(selectedEdge) + console.log(selectedEdge) + if (selectedEdge.conditions.length === 1) { + selectedEdge.conditions = [] + } else { + selectedEdge.conditions.splice(conditionIndex, 1) + } + + setSelectedEdge(selectedEdge) + setOpen(false) + setUpdate("delete "+conditionIndex) } const paperVariableStyle = { @@ -3108,6 +3125,7 @@ const AngularWorkflow = (props) => { } const menuClick = (event) => { + console.log("MENU CLICK") setOpen(!open) setAnchorEl(event.currentTarget); }