From 1804bd9c1e24575b6b2d5198e2b895ad46468721 Mon Sep 17 00:00:00 2001 From: frikky Date: Tue, 21 Dec 2021 01:44:14 +0100 Subject: [PATCH] Fixed startnode loading for subflow --- frontend/src/views/AngularWorkflow.jsx | 42 ++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index ed2a4781..24f1adca 100644 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -383,18 +383,22 @@ const AngularWorkflow = (props) => { // Sets up subflow trigger with the right info if (trigger_index > -1) { + var baseSubflow = {} const trigger = workflow.triggers[trigger_index]; if (trigger.parameters.length >= 3) { for (var key in trigger.parameters) { const param = trigger.parameters[key]; + if (param.name === "workflow") { if (param.value === workflow.id) { setSubworkflow(workflow); + baseSubflow = workflow } else { const sub = responseJson.find( (data) => data.id === param.value ); if (sub !== undefined && subworkflow.id !== sub.id) { + baseSubflow = sub setSubworkflow(sub); } } @@ -406,7 +410,16 @@ const AngularWorkflow = (props) => { param.value !== undefined && param.value !== null ) { - setSubworkflowStartnode(param.value); + console.log("BASE: ", baseSubflow) + if (Object.getOwnPropertyNames(baseSubflow).length > 0) { + const foundAction = baseSubflow.actions.find(action => action.id === param.value) + console.log("FOUND: ", foundAction) + if (foundAction !== null && foundAction !== undefined) { + setSubworkflowStartnode(foundAction); + } + } else { + setSubworkflowStartnode(param.value); + } } } } @@ -7933,6 +7946,10 @@ const AngularWorkflow = (props) => { option.label === undefined || option.label === null ) { + if (option.length === 36) { + + } + return "TMP"; } @@ -7959,10 +7976,16 @@ const AngularWorkflow = (props) => { return ( { - console.log("Mouse in: ", action.id) + if (subworkflow.id === workflow.id) { + console.log("Mouse in: ", action.id) + handleActionHover(true, action.id) + } }} onMouseOut={() => { - console.log("Mouse out: ", action.id) + if (subworkflow.id === workflow.id) { + console.log("Mouse out: ", action.id) + handleActionHover(false, action.id) + } }} disabled={isCloud && isParent} style={{ @@ -9686,6 +9709,19 @@ const AngularWorkflow = (props) => { ); }; + const handleActionHover = (inside, actionId) => { + if (cy !== undefined) { + var node = cy.getElementById(actionId); + if (node.length > 0) { + if (inside) { + node.addClass("shuffle-hover-highlight"); + } else { + node.removeClass("shuffle-hover-highlight"); + } + } + } + } + const handleHistoryUndo = () => { //console.log("history: ", history, "index: ", historyIndex); var item = history[historyIndex - 1];