Merge branch '1.4.0' into tenzir

This commit is contained in:
Frikky
2024-04-30 19:26:52 +02:00
committed by GitHub
20 changed files with 3367 additions and 1118 deletions
+87 -56
View File
@@ -120,9 +120,12 @@ import {
Add as AddIcon,
} from "@mui/icons-material";
import * as cytoscape from "cytoscape";
import * as edgehandles from "cytoscape-edgehandles";
//import * as cytoscape from "cytoscape";
import cytoscape from "cytoscape";
import edgehandles from "cytoscape-edgehandles";
import CytoscapeComponent from "react-cytoscapejs";
import Draggable from "react-draggable";
import cytoscapestyle from "../defaultCytoscapeStyle.jsx";
import ShuffleCodeEditor from "../components/ShuffleCodeEditor1.jsx";
@@ -137,6 +140,8 @@ import ExtraApps from "../components/ExtraApps.jsx"
import EditWorkflow from "../components/EditWorkflow.jsx"
// import AppStats from "../components/AppStats.jsx";
cytoscape.use(edgehandles);
export const triggers = [
{
name: "Webhook",
@@ -236,15 +241,7 @@ export const triggers = [
},
];
// http://apps.cytoscape.org/apps/yfileslayoutalgorithms
cytoscape.use(edgehandles);
//cytoscape.use(clipboard);
//cytoscape.use(undoRedo);
//cytoscape.use(cxtmenu);
// Adds specific text to items
//import popper from 'cytoscape-popper';
//cytoscape.use(popper);
// https://stackoverflow.com/questions/19014250/rerender-view-on-browser-resize-with-react
function useWindowSize() {
@@ -592,7 +589,27 @@ const AngularWorkflow = (defaultprops) => {
]
}*/
]
}]
},{
"name": "Communication",
"description": "Available actions for communication",
"label": "Communication",
"parameters": [{
"name": "action",
"value": "list_messages",
"options": [
"list_messages",
"send_message",
],
"required": true,
},
{
"name": "fields",
"value": "",
"required": false,
"multiline": true,
}]
},
]
}]
/*
@@ -685,7 +702,7 @@ const AngularWorkflow = (defaultprops) => {
props.userdata.active_org !== undefined
? props.userdata.active_org.cloud_sync === true
: false;
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io";
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io" || window.location.host === "migration.shuffler.io";
const appBarSize = isCloud ? 75 : 72;
const triggerEnvironments = isCloud ? ["cloud"] : ["onprem", "cloud"];
@@ -3996,42 +4013,50 @@ const AngularWorkflow = (defaultprops) => {
workflow.actions.push(newNodeData);
const sourcebranches = workflow.branches.filter(
(foundbranch) => foundbranch.source_id === parentNode.data("id")
);
const destinationbranches = workflow.branches.filter(
(foundbranch) =>
foundbranch.destination_id === parentNode.data("id")
);
const sourcebranches = workflow.branches.filter((foundbranch) => foundbranch.source_id === parentNode.data("id"))
const destinationbranches = workflow.branches.filter((foundbranch) => foundbranch.destination_id === parentNode.data("id"))
for (var sourceBranchesKey in sourcebranches) {
var newbranch = JSON.parse(JSON.stringify(sourcebranches[sourceBranchesKey]));
newbranch.id = uuidv4();
newbranch.source_id = newNodeData.id;
newbranch._id = newbranch.id;
newbranch.source = newbranch.source_id;
newbranch.target = newbranch.destination_id;
cy.add({
group: "edges",
data: newbranch,
});
newbranch.id = uuidv4()
newbranch.source_id = newNodeData.id
newbranch._id = newbranch.id
newbranch.source = newbranch.source_id
newbranch.target = newbranch.destination_id
cy.add({
group: "edges",
data: newbranch,
})
}
for (var destinationBranchesKey in destinationbranches) {
var newbranch = JSON.parse(
JSON.stringify(destinationbranches[destinationBranchesKey])
);
newbranch.id = uuidv4();
newbranch.destination_id = newNodeData.id;
var newbranch = JSON.parse(JSON.stringify(destinationbranches[destinationBranchesKey]))
newbranch._id = newbranch.id;
newbranch.source = newbranch.source_id;
newbranch.target = newbranch.destination_id;
cy.add({
group: "edges",
data: newbranch,
});
const sourcenode = cy.getElementById(newbranch.source_id)
if (sourcenode !== null && sourcenode !== undefined) {
const sourcedata = sourcenode.data()
if (sourcedata.trigger_type !== "SUBFLOW" && sourcedata.trigger_type !== "USERINPUT") {
continue
}
}
newbranch.id = uuidv4()
newbranch.destination_id = newNodeData.id
newbranch._id = newbranch.id
newbranch.source = newbranch.source_id
newbranch.target = newbranch.destination_id
cy.add({
group: "edges",
data: newbranch,
})
}
//event.target.unselect();
@@ -4783,7 +4808,7 @@ const AngularWorkflow = (defaultprops) => {
event.target.remove()
//console.log("Found branch already!")
toast("Triggers can have exactly one target node")
toast.error("Triggers can have exactly one target node")
return
@@ -5194,7 +5219,7 @@ const AngularWorkflow = (defaultprops) => {
data: newdata,
})
toast("You must STOP the trigger before deleting its branches")
toast.error("You must STOP the trigger before deleting its branches")
} catch (e) {
console.log("Failed re-adding edge: ", e)
}
@@ -13130,7 +13155,7 @@ const AngularWorkflow = (defaultprops) => {
if (trigger.id === undefined) {
return;
}
fetch(globalUrl + "/api/v1/hooks/" + trigger.id + "/delete", {
method: "DELETE",
headers: {
@@ -13143,32 +13168,34 @@ const AngularWorkflow = (defaultprops) => {
if (response.status !== 200) {
console.log("Status not 200 for stream results :O!");
}
return response.json();
})
.then((responseJson) => {
if (!responseJson.success) {
if (responseJson.reason !== undefined) {
toast("Failed to stop webhook: " + responseJson.reason);
}
} else {
toast("Successfully stopped webhook");
}
if (workflow.triggers[triggerindex] !== undefined) {
workflow.triggers[triggerindex].status = "stopped";
}
if (responseJson.success) {
// Set the status
saveWorkflow(workflow);
} else {
if (responseJson.reason !== undefined) {
toast("Failed stopping webhook: " + responseJson.reason);
}
}
trigger.status = "stopped";
setWorkflow(workflow);
setSelectedTrigger(trigger);
setWorkflow(workflow);
saveWorkflow(workflow);
})
.catch((error) => {
//toast(error.toString());
toast("Delete webhook error. Contact support or check logs if this persists.")
toast(
"Delete webhook error. Contact support or check logs if this persists.",
);
});
};
// POST to /api/v1/workflows
const createWorkflow = (workflow, trigger_index) => {
@@ -17221,6 +17248,10 @@ const AngularWorkflow = (defaultprops) => {
return "Run this workflow in a local environment to increase the timeout. Go to https://shuffler.io/admin?tab=environments to create an environment to connect to"
}
if (stringjson.toLowerCase().includes("invalid header")) {
return "A header or authentication token in the app is invalid. Check the app's configuration"
}
return ""
}