Merge pull request #1434 from Monilprajapati/mergingIssue
Merging issue
This commit is contained in:
@@ -5699,16 +5699,15 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
|
||||
// Checks for errors in edges when they're added
|
||||
const onEdgeAdded = (event) => {
|
||||
setLastSaved(false);
|
||||
const edge = event.target.data();
|
||||
|
||||
//console.log("edge added: ", edge)
|
||||
const edge = event.target.data()
|
||||
//console.log("EDGE ADDED!: ", edge)
|
||||
if (edge.source === undefined && edge.target === undefined) {
|
||||
// console.log("Edge source and target is undefined")
|
||||
return
|
||||
}
|
||||
|
||||
if (edge.readded === true) {
|
||||
console.log("Readded edge - stopping")
|
||||
// console.log("Readded edge - stopping")
|
||||
|
||||
event.target.data("readded", false)
|
||||
return
|
||||
@@ -5717,6 +5716,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
const sourcenode = cy.getElementById(edge.source)
|
||||
const destinationnode = cy.getElementById(edge.target)
|
||||
if (sourcenode === undefined || sourcenode === null || destinationnode === undefined || destinationnode === null) {
|
||||
// console.log("Source or destination node is undefined")
|
||||
} else {
|
||||
//console.log("Edge added: Is it a trigger? If so, check if it already has a branch and remove it: ", sourcenode.data())
|
||||
if (sourcenode.data("type") === "TRIGGER") {
|
||||
@@ -5729,17 +5729,17 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
|
||||
console.log("Node: ", targetedge)
|
||||
if (targetedge !== -1) {
|
||||
event.target.remove()
|
||||
|
||||
//console.log("Found branch already!")
|
||||
toast.error("Triggers can have exactly one target node")
|
||||
event.target.remove()
|
||||
return
|
||||
|
||||
|
||||
// name: "Shuffle Workflow",
|
||||
// name: "User Input",
|
||||
} else {
|
||||
console.log("Node doesn't already have one")
|
||||
// console.log("Node doesn't already have one")
|
||||
}
|
||||
}, 50)
|
||||
}
|
||||
@@ -5753,6 +5753,10 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
}
|
||||
}
|
||||
|
||||
if (edge.decorator === true) {
|
||||
// console.log("Doing nothing to branch because decorator")
|
||||
return
|
||||
}
|
||||
|
||||
var targetnode = workflow.triggers.findIndex(
|
||||
(data) => data.id === edge.target
|
||||
@@ -5770,7 +5774,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
if (eventTarget.data("isButton") === true) {
|
||||
const parentNode = cy.getElementById(eventTarget.data("attachedTo"))
|
||||
event.target.remove()
|
||||
console.log("Setting it to parentnode: ", parentNode.data())
|
||||
// console.log("Setting it to parentnode: ", parentNode.data())
|
||||
if (parentNode !== undefined && parentNode !== null) {
|
||||
//event.target.data("target", eventTarget.data("attachedTo"))
|
||||
|
||||
@@ -5792,15 +5796,14 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
eventTarget.data("isDescriptor") === true ||
|
||||
eventTarget.data("type") === "COMMENT"
|
||||
) {
|
||||
console.log("Removing because of descriptor or comment")
|
||||
event.target.remove();
|
||||
return;
|
||||
if (eventTarget.data("isDescriptor") === true || eventTarget.data("type") === "COMMENT") {
|
||||
// console.log("Removing because of descriptor or comment")
|
||||
event.target.remove()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
setLastSaved(false)
|
||||
targetnode = -1;
|
||||
|
||||
// Check if:
|
||||
@@ -5808,38 +5811,51 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
// dest == dest && source == source
|
||||
// backend: check all children? to stop recursion
|
||||
var found = false;
|
||||
for (let branchkey in workflow.branches) {
|
||||
if (
|
||||
workflow.branches[branchkey].destination_id === edge.source &&
|
||||
workflow.branches[branchkey].source_id === edge.target
|
||||
) {
|
||||
toast("A branch in the opposite direction already exists");
|
||||
event.target.remove();
|
||||
found = true;
|
||||
break;
|
||||
} else if (
|
||||
workflow.branches[branchkey].destination_id === edge.target &&
|
||||
workflow.branches[branchkey].source_id === edge.source
|
||||
) {
|
||||
//toast("That branch already exists");
|
||||
event.target.remove();
|
||||
const branches = cy.edges().jsons()
|
||||
|
||||
const startNode = cy.nodes().jsons().find((node) => node.data.isStartNode === true)
|
||||
var startnodeId = workflow.start
|
||||
if (startNode !== undefined && startNode !== null) {
|
||||
startnodeId = startNode.data.id
|
||||
}
|
||||
|
||||
//for (let branchkey in workflow.branches) {
|
||||
for (let branchkey in branches) {
|
||||
const branch = branches[branchkey].data
|
||||
|
||||
//if (workflow.branches[branchkey].destination_id === edge.source && workflow.branches[branchkey].source_id === edge.target) {
|
||||
if (branch.target === edge.source && branch.source === edge.target) {
|
||||
toast("A branch in the opposite direction already exists")
|
||||
event.target.remove()
|
||||
found = true
|
||||
break
|
||||
|
||||
//} else if (workflow.branches[branchkey].destination_id === edge.target && workflow.branches[branchkey].source_id === edge.source) {
|
||||
} else if (branch.target === edge.target && branch.source === edge.source) {
|
||||
|
||||
if (branch.conditions === undefined) {
|
||||
// Edgehandles
|
||||
} else {
|
||||
// console.log("Removing because the same branch already exists")
|
||||
event.target.remove()
|
||||
|
||||
found = true
|
||||
break
|
||||
}
|
||||
} else if (edge.target === startnodeId) {
|
||||
targetnode = workflow.triggers.findIndex((data) => data.id === edge.source)
|
||||
|
||||
found = true;
|
||||
break;
|
||||
} else if (edge.target === workflow.start) {
|
||||
targetnode = workflow.triggers.findIndex(
|
||||
(data) => data.id === edge.source
|
||||
);
|
||||
if (targetnode === -1) {
|
||||
if (targetnode.type !== "TRIGGER") {
|
||||
toast("Can't make arrow to starting node");
|
||||
event.target.remove();
|
||||
break;
|
||||
toast("Can't make arrow to starting node")
|
||||
event.target.remove()
|
||||
break
|
||||
}
|
||||
|
||||
found = true;
|
||||
}
|
||||
} else if (edge.source === workflow.branches[branchkey].source_id) {
|
||||
//} else if (edge.source === workflow.branches[branchkey].source_id) {
|
||||
} else if (edge.source === branch.source) {
|
||||
// FIXME: Verify multi-target for triggers
|
||||
// 1. Check if destination exists
|
||||
// 2. Check if source is a trigger
|
||||
@@ -5883,7 +5899,6 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
newdst !== null
|
||||
) {
|
||||
const dstdata = RunAutocompleter(newdst.data());
|
||||
//console.log("DST Autocompleter: ", dstdata);
|
||||
}
|
||||
|
||||
var newbranch = {
|
||||
@@ -12535,9 +12550,9 @@ 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";
|
||||
}
|
||||
// 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]
|
||||
@@ -15793,7 +15808,6 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
right: 0,
|
||||
left: isMobile ? 20 : leftBarSize + 20,
|
||||
top: isMobile ? 30 : appBarSize + 20,
|
||||
pointerEvents: "none",
|
||||
}
|
||||
|
||||
|
||||
@@ -15814,7 +15828,6 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
<div style={topBarStyle}>
|
||||
<div style={{
|
||||
margin: "0px 10px 0px 10px",
|
||||
pointerEvents: "none",
|
||||
}}>
|
||||
<Breadcrumbs
|
||||
aria-label="breadcrumb"
|
||||
@@ -15839,7 +15852,6 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
</Link>
|
||||
<h2 style={{
|
||||
margin: 0,
|
||||
pointerEvents: "none",
|
||||
}}>{workflow.name}</h2>
|
||||
</Breadcrumbs>
|
||||
|
||||
@@ -18460,7 +18472,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
</div>
|
||||
|
||||
{foundnotifications > 0 ?
|
||||
<Tooltip title={"This workflow created " + foundnotifications + " notification(s)"} placement="top">
|
||||
<Tooltip title={"This workflow created " + foundnotifications + " notification(s). Click to explore them."} placement="top">
|
||||
<ErrorOutlineIcon
|
||||
style={{color: "rgba(255,255,255,0.4)", marginTop: 10, marginRight: 10, }}
|
||||
onClick={(e) => {
|
||||
@@ -21472,7 +21484,11 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
//cy.remove('*')
|
||||
setElements([])
|
||||
}
|
||||
|
||||
|
||||
// // Remove all edges
|
||||
// cy.edges().remove()
|
||||
// cy.nodes().remove()
|
||||
|
||||
// Remove all cy nodes
|
||||
setTimeout(() => {
|
||||
setupGraph(newrevision)
|
||||
|
||||
Reference in New Issue
Block a user