Fixed issue with multiple trigger branches
This commit is contained in:
@@ -3186,6 +3186,13 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (edge.readded === true) {
|
||||||
|
console.log("Readded edge - stopping")
|
||||||
|
|
||||||
|
event.target.data("readded", false)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const sourcenode = cy.getElementById(edge.source)
|
const sourcenode = cy.getElementById(edge.source)
|
||||||
const destinationnode = cy.getElementById(edge.target)
|
const destinationnode = cy.getElementById(edge.target)
|
||||||
if (sourcenode === undefined || sourcenode === null || destinationnode === undefined || destinationnode === null) {
|
if (sourcenode === undefined || sourcenode === null || destinationnode === undefined || destinationnode === null) {
|
||||||
@@ -3567,12 +3574,48 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
const onEdgeRemoved = (event) => {
|
const onEdgeRemoved = (event) => {
|
||||||
setLastSaved(false);
|
setLastSaved(false);
|
||||||
|
|
||||||
|
|
||||||
const edge = event.target;
|
const edge = event.target;
|
||||||
if (edge.data("decorator") === true) {
|
if (edge.data("decorator") === true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if the source is trigger and can start
|
||||||
|
console.log("Removed: ", edge.data())
|
||||||
|
const allNodes = cy.nodes().jsons()
|
||||||
|
for (var key in allNodes) {
|
||||||
|
const curnode = allNodes[key]
|
||||||
|
if (curnode.data.type !== "TRIGGER") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (curnode.data.id === edge.data("source")) {
|
||||||
|
console.log("Found matching trigger source: ", curnode)
|
||||||
|
if (curnode.data.app_name !== "Shuffle Workflow" && curnode.data.app_name !== "User Input") {
|
||||||
|
// If it's started, READD the edge
|
||||||
|
if (curnode.data.status === "running") {
|
||||||
|
console.log("Edge is running - readd it: ", edge.data())
|
||||||
|
|
||||||
|
// Just making sure it's not running infinitely
|
||||||
|
var newdata = edge.data()
|
||||||
|
newdata.readded = true
|
||||||
|
|
||||||
|
try {
|
||||||
|
cy.add({
|
||||||
|
group: "edges",
|
||||||
|
data: newdata,
|
||||||
|
})
|
||||||
|
|
||||||
|
alert.error("You must STOP the trigger before deleting its branches")
|
||||||
|
} catch (e) {
|
||||||
|
console.log("Failed re-adding edge: ", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//status: "uninitialized",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
workflow.branches = workflow.branches.filter(
|
workflow.branches = workflow.branches.filter(
|
||||||
(a) => a.id !== edge.data().id
|
(a) => a.id !== edge.data().id
|
||||||
);
|
);
|
||||||
@@ -4814,11 +4857,7 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
|
|
||||||
const stopSchedule = (trigger, triggerindex) => {
|
const stopSchedule = (trigger, triggerindex) => {
|
||||||
fetch(
|
fetch(
|
||||||
globalUrl +
|
`${globalUrl}/api/v1/workflows/${props.match.params.key}/schedule/${trigger.id}`,
|
||||||
"/api/v1/workflows/" +
|
|
||||||
props.match.params.key +
|
|
||||||
"/schedule/" +
|
|
||||||
trigger.id,
|
|
||||||
{
|
{
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -4863,7 +4902,7 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
alert.info("Attempting to create schedule with name " + trigger.name);
|
alert.info("Creating schedule with name " + trigger.name);
|
||||||
const data = {
|
const data = {
|
||||||
name: trigger.name,
|
name: trigger.name,
|
||||||
frequency: workflow.triggers[triggerindex].parameters[0].value,
|
frequency: workflow.triggers[triggerindex].parameters[0].value,
|
||||||
@@ -4873,7 +4912,7 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
globalUrl + "/api/v1/workflows/" + props.match.params.key + "/schedule",
|
`${globalUrl}/api/v1/workflows/${props.match.params.key}/schedule`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
Reference in New Issue
Block a user