Fixed startnode loading for subflow

This commit is contained in:
frikky
2021-12-21 01:44:14 +01:00
parent b9d30419fa
commit 1804bd9c1e
+39 -3
View File
@@ -383,18 +383,22 @@ const AngularWorkflow = (props) => {
// Sets up subflow trigger with the right info // Sets up subflow trigger with the right info
if (trigger_index > -1) { if (trigger_index > -1) {
var baseSubflow = {}
const trigger = workflow.triggers[trigger_index]; const trigger = workflow.triggers[trigger_index];
if (trigger.parameters.length >= 3) { if (trigger.parameters.length >= 3) {
for (var key in trigger.parameters) { for (var key in trigger.parameters) {
const param = trigger.parameters[key]; const param = trigger.parameters[key];
if (param.name === "workflow") { if (param.name === "workflow") {
if (param.value === workflow.id) { if (param.value === workflow.id) {
setSubworkflow(workflow); setSubworkflow(workflow);
baseSubflow = workflow
} else { } else {
const sub = responseJson.find( const sub = responseJson.find(
(data) => data.id === param.value (data) => data.id === param.value
); );
if (sub !== undefined && subworkflow.id !== sub.id) { if (sub !== undefined && subworkflow.id !== sub.id) {
baseSubflow = sub
setSubworkflow(sub); setSubworkflow(sub);
} }
} }
@@ -406,7 +410,16 @@ const AngularWorkflow = (props) => {
param.value !== undefined && param.value !== undefined &&
param.value !== null 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 === undefined ||
option.label === null option.label === null
) { ) {
if (option.length === 36) {
}
return "TMP"; return "TMP";
} }
@@ -7959,10 +7976,16 @@ const AngularWorkflow = (props) => {
return ( return (
<MenuItem <MenuItem
onMouseOver={() => { onMouseOver={() => {
console.log("Mouse in: ", action.id) if (subworkflow.id === workflow.id) {
console.log("Mouse in: ", action.id)
handleActionHover(true, action.id)
}
}} }}
onMouseOut={() => { 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} disabled={isCloud && isParent}
style={{ 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 = () => { const handleHistoryUndo = () => {
//console.log("history: ", history, "index: ", historyIndex); //console.log("history: ", history, "index: ", historyIndex);
var item = history[historyIndex - 1]; var item = history[historyIndex - 1];