Updated some workflow issues

This commit is contained in:
Frikky
2024-06-24 15:28:21 +02:00
parent 7e72dbab76
commit e1f7a1e9d3
6 changed files with 119 additions and 85 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ require (
github.com/gorilla/mux v1.8.1 github.com/gorilla/mux v1.8.1
github.com/h2non/filetype v1.1.3 github.com/h2non/filetype v1.1.3
github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid v1.2.0
github.com/shuffle/shuffle-shared v0.6.47 github.com/shuffle/shuffle-shared v0.6.50
golang.org/x/crypto v0.22.0 golang.org/x/crypto v0.22.0
google.golang.org/api v0.176.1 google.golang.org/api v0.176.1
google.golang.org/grpc v1.63.2 google.golang.org/grpc v1.63.2
+2 -2
View File
@@ -1775,7 +1775,7 @@ const Billing = (props) => {
</div> </div>
</div> </div>
<Button <Button
variant="contained" variant="outlined"
color="primary" color="primary"
style={{ marginTop: 15, textTransform: 'none' }} style={{ marginTop: 15, textTransform: 'none' }}
onClick={addAlertThreshold} onClick={addAlertThreshold}
@@ -1783,7 +1783,7 @@ const Billing = (props) => {
Add Threshold Add Threshold
</Button> </Button>
<Button <Button
variant="contained" variant="outlined"
color="primary" color="primary"
style={{ marginTop: 15, textTransform: 'none', marginLeft: 20 }} style={{ marginTop: 15, textTransform: 'none', marginLeft: 20 }}
onClick={() => { HandleEditOrgForAlertThreshold(selectedOrganization.id) }} onClick={() => { HandleEditOrgForAlertThreshold(selectedOrganization.id) }}
+2 -1
View File
@@ -554,7 +554,8 @@ const Header = (props) => {
aria-haspopup="true" aria-haspopup="true"
onClick={(event) => { }} onClick={(event) => { }}
> >
<svg viewBox="0 0 256 199" width="256" height="199" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid" style={{height: 30, width: 30, }}><path d="M216.856 16.597A208.502 208.502 0 0 0 164.042 0c-2.275 4.113-4.933 9.645-6.766 14.046-19.692-2.961-39.203-2.961-58.533 0-1.832-4.4-4.55-9.933-6.846-14.046a207.809 207.809 0 0 0-52.855 16.638C5.618 67.147-3.443 116.4 1.087 164.956c22.169 16.555 43.653 26.612 64.775 33.193A161.094 161.094 0 0 0 79.735 175.3a136.413 136.413 0 0 1-21.846-10.632 108.636 108.636 0 0 0 5.356-4.237c42.122 19.702 87.89 19.702 129.51 0a131.66 131.66 0 0 0 5.355 4.237 136.07 136.07 0 0 1-21.886 10.653c4.006 8.02 8.638 15.67 13.873 22.848 21.142-6.58 42.646-16.637 64.815-33.213 5.316-56.288-9.08-105.09-38.056-148.36ZM85.474 135.095c-12.645 0-23.015-11.805-23.015-26.18s10.149-26.2 23.015-26.2c12.867 0 23.236 11.804 23.015 26.2.02 14.375-10.148 26.18-23.015 26.18Zm85.051 0c-12.645 0-23.014-11.805-23.014-26.18s10.148-26.2 23.014-26.2c12.867 0 23.236 11.804 23.015 26.2 0 14.375-10.148 26.18-23.015 26.18Z" fill="#5865F2"/></svg> <svg viewBox="0 0 256 199" width="256" height="199" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid" style={{height: 30, width: 30, }}><path d="M216.856 16.597A208.502 208.502 0 0 0 164.042 0c-2.275 4.113-4.933 9.645-6.766 14.046-19.692-2.961-39.203-2.961-58.533 0-1.832-4.4-4.55-9.933-6.846-14.046a207.809 207.809 0 0 0-52.855 16.638C5.618 67.147-3.443 116.4 1.087 164.956c22.169 16.555 43.653 26.612 64.775 33.193A161.094 161.094 0 0 0 79.735 175.3a136.413 136.413 0 0 1-21.846-10.632 108.636 108.636 0 0 0 5.356-4.237c42.122 19.702 87.89 19.702 129.51 0a131.66 131.66 0 0 0 5.355 4.237 136.07 136.07 0 0 1-21.886 10.653c4.006 8.02 8.638 15.67 13.873 22.848 21.142-6.58 42.646-16.637 64.815-33.213 5.316-56.288-9.08-105.09-38.056-148.36ZM85.474 135.095c-12.645 0-23.015-11.805-23.015-26.18s10.149-26.2 23.015-26.2c12.867 0 23.236 11.804 23.015 26.2.02 14.375-10.148 26.18-23.015 26.18Zm85.051 0c-12.645 0-23.014-11.805-23.014-26.18s10.148-26.2 23.014-26.2c12.867 0 23.236 11.804 23.015 26.2 0 14.375-10.148 26.18-23.015 26.18Z" fill="#dadae1"/></svg>
{/*#f865f2*/}
</IconButton> </IconButton>
</Tooltip> </Tooltip>
</a> </a>
+24 -6
View File
@@ -823,7 +823,7 @@ const ParsedAction = (props) => {
if (selectedAction.app_name === "Shuffle Tools" && selectedAction.name === "filter_list" && data.name === "input_list") { if (selectedAction.app_name === "Shuffle Tools" && selectedAction.name === "filter_list" && data.name === "input_list") {
//console.log("FILTER LIST!: ", event, count, data) //console.log("FILTER LIST!: ", event, count, data)
const parsedvalue = event.target.value const parsedvalue = event.target.value
if (parsedvalue.includes("#")) { if (parsedvalue.includes(".#")) {
const splitparsed = parsedvalue.split(".#.") const splitparsed = parsedvalue.split(".#.")
//console.log("Cant contain #: ", splitparsed) //console.log("Cant contain #: ", splitparsed)
if (splitparsed.length > 1) { if (splitparsed.length > 1) {
@@ -832,14 +832,30 @@ const ParsedAction = (props) => {
selectedActionParameters[count].value = splitparsed[0] selectedActionParameters[count].value = splitparsed[0]
selectedAction.parameters[count].value = splitparsed[0] selectedAction.parameters[count].value = splitparsed[0]
selectedActionParameters[1].value = splitparsed[1] selectedActionParameters[1].value = splitparsed[1]
selectedAction.parameters[1].value = splitparsed[1] selectedAction.parameters[1].value = splitparsed[1]
forceUpdate = true } else {
// Remove .# and after
const splitparsed = parsedvalue.split(".#")
data.value = splitparsed[0]
selectedActionParameters[0].value = splitparsed[0]
selectedAction.parameters[0].value = splitparsed[0]
selectedActionParameters[1].value = ""
selectedAction.parameters[1].value = ""
toast.warn("No value found in the list. Please select an item in the list to filter based on.")
} }
forceUpdate = true
selectedActionParameters[0].autocompleted = true
selectedAction.parameters[0].autocompleted = true
selectedActionParameters[1].autocompleted = true
selectedAction.parameters[1].autocompleted = true
} }
} }
setSelectedAction(selectedAction); setSelectedAction(selectedAction);
if (forceUpdate || viewForceUpdate === true) { if (forceUpdate || viewForceUpdate === true) {
setUpdate(Math.random()) setUpdate(Math.random())
} }
@@ -910,6 +926,7 @@ const ParsedAction = (props) => {
} }
} }
// bad detection mechanism probably // bad detection mechanism probably
if (event.target.value[event.target.value.length-1] === "." && actionlist.length > 0) { if (event.target.value[event.target.value.length-1] === "." && actionlist.length > 0) {
console.log("GET THE LAST ARGUMENT FOR NODE!") console.log("GET THE LAST ARGUMENT FOR NODE!")
@@ -3839,7 +3856,8 @@ const ParsedAction = (props) => {
newname = newname.slice(0, newname.length-5) newname = newname.slice(0, newname.length-5)
} }
selectedActionParameters[count].value += `{{ $${innerdata.name}.${newname} | size }}` //selectedActionParameters[count].value += `{{ $${innerdata.name}.${newname} | size }}`
selectedActionParameters[count].value += `$${innerdata.name}.${newname}`
selectedAction.parameters[count].value = selectedActionParameters[count].value; selectedAction.parameters[count].value = selectedActionParameters[count].value;
setSelectedAction(selectedAction); setSelectedAction(selectedAction);
setUpdate(Math.random()); setUpdate(Math.random());
+8 -2
View File
@@ -1568,6 +1568,11 @@ If you're interested, please let me know a time that works for you, or set up a
responseJson.lead_info !== null responseJson.lead_info !== null
) { ) {
var leads = []; var leads = [];
console.log("LEADINFO: ", responseJson.lead_info)
if (responseJson.lead_info.testing_shuffle) {
leads.push("testing shuffle");
}
if (responseJson.lead_info.contacted) { if (responseJson.lead_info.contacted) {
leads.push("contacted"); leads.push("contacted");
} }
@@ -3572,7 +3577,7 @@ If you're interested, please let me know a time that works for you, or set up a
<FormControl sx={{ m: 1, width: 300 }} style={{}}> <FormControl sx={{ m: 1, width: 300 }} style={{}}>
<InputLabel id="">Status</InputLabel> <InputLabel id="">Status</InputLabel>
<Select <Select
style={{ minWidth: 150, maxWidth: 150 }} style={{ minWidth: 150, maxWidth: 150, }}
labelId="multiselect-status" labelId="multiselect-status"
id="multiselect-status" id="multiselect-status"
multiple multiple
@@ -3583,9 +3588,10 @@ If you're interested, please let me know a time that works for you, or set up a
MenuProps={MenuProps} MenuProps={MenuProps}
> >
{[ {[
"testing shuffle",
"contacted", "contacted",
"lead", "lead",
"demo done", //"demo done",
"pov", "pov",
"customer", "customer",
"open source", "open source",
+82 -73
View File
@@ -5699,15 +5699,16 @@ const releaseToConnectLabel = "Release to Connect"
// Checks for errors in edges when they're added // Checks for errors in edges when they're added
const onEdgeAdded = (event) => { const onEdgeAdded = (event) => {
const edge = event.target.data() setLastSaved(false);
//console.log("EDGE ADDED!: ", edge) const edge = event.target.data();
//console.log("edge added: ", edge)
if (edge.source === undefined && edge.target === undefined) { if (edge.source === undefined && edge.target === undefined) {
// console.log("Edge source and target is undefined")
return return
} }
if (edge.readded === true) { if (edge.readded === true) {
// console.log("Readded edge - stopping") console.log("Readded edge - stopping")
event.target.data("readded", false) event.target.data("readded", false)
return return
@@ -5716,7 +5717,6 @@ const releaseToConnectLabel = "Release to Connect"
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) {
// console.log("Source or destination node is undefined")
} else { } else {
//console.log("Edge added: Is it a trigger? If so, check if it already has a branch and remove it: ", sourcenode.data()) //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") { if (sourcenode.data("type") === "TRIGGER") {
@@ -5729,17 +5729,17 @@ const releaseToConnectLabel = "Release to Connect"
console.log("Node: ", targetedge) console.log("Node: ", targetedge)
if (targetedge !== -1) { if (targetedge !== -1) {
event.target.remove()
//console.log("Found branch already!") //console.log("Found branch already!")
toast.error("Triggers can have exactly one target node") toast.error("Triggers can have exactly one target node")
event.target.remove()
return return
// name: "Shuffle Workflow", // name: "Shuffle Workflow",
// name: "User Input", // name: "User Input",
} else { } else {
// console.log("Node doesn't already have one") console.log("Node doesn't already have one")
} }
}, 50) }, 50)
} }
@@ -5753,10 +5753,6 @@ const releaseToConnectLabel = "Release to Connect"
} }
} }
if (edge.decorator === true) {
// console.log("Doing nothing to branch because decorator")
return
}
var targetnode = workflow.triggers.findIndex( var targetnode = workflow.triggers.findIndex(
(data) => data.id === edge.target (data) => data.id === edge.target
@@ -5774,7 +5770,7 @@ const releaseToConnectLabel = "Release to Connect"
if (eventTarget.data("isButton") === true) { if (eventTarget.data("isButton") === true) {
const parentNode = cy.getElementById(eventTarget.data("attachedTo")) const parentNode = cy.getElementById(eventTarget.data("attachedTo"))
event.target.remove() event.target.remove()
// console.log("Setting it to parentnode: ", parentNode.data()) console.log("Setting it to parentnode: ", parentNode.data())
if (parentNode !== undefined && parentNode !== null) { if (parentNode !== undefined && parentNode !== null) {
//event.target.data("target", eventTarget.data("attachedTo")) //event.target.data("target", eventTarget.data("attachedTo"))
@@ -5796,14 +5792,15 @@ const releaseToConnectLabel = "Release to Connect"
} }
} }
if (eventTarget.data("isDescriptor") === true || eventTarget.data("type") === "COMMENT") { if (
// console.log("Removing because of descriptor or comment") eventTarget.data("isDescriptor") === true ||
event.target.remove() eventTarget.data("type") === "COMMENT"
return ) {
console.log("Removing because of descriptor or comment")
event.target.remove();
return;
} }
setLastSaved(false)
targetnode = -1; targetnode = -1;
// Check if: // Check if:
@@ -5811,51 +5808,38 @@ const releaseToConnectLabel = "Release to Connect"
// dest == dest && source == source // dest == dest && source == source
// backend: check all children? to stop recursion // backend: check all children? to stop recursion
var found = false; var found = false;
const branches = cy.edges().jsons() for (let branchkey in workflow.branches) {
if (
const startNode = cy.nodes().jsons().find((node) => node.data.isStartNode === true) workflow.branches[branchkey].destination_id === edge.source &&
var startnodeId = workflow.start workflow.branches[branchkey].source_id === edge.target
if (startNode !== undefined && startNode !== null) { ) {
startnodeId = startNode.data.id toast("A branch in the opposite direction already exists");
} event.target.remove();
found = true;
//for (let branchkey in workflow.branches) { break;
for (let branchkey in branches) { } else if (
const branch = branches[branchkey].data workflow.branches[branchkey].destination_id === edge.target &&
workflow.branches[branchkey].source_id === edge.source
//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("That branch already exists");
toast("A branch in the opposite direction already exists") event.target.remove();
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 === -1) {
if (targetnode.type !== "TRIGGER") { if (targetnode.type !== "TRIGGER") {
toast("Can't make arrow to starting node") toast("Can't make arrow to starting node");
event.target.remove() event.target.remove();
break break;
} }
found = true; 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 // FIXME: Verify multi-target for triggers
// 1. Check if destination exists // 1. Check if destination exists
// 2. Check if source is a trigger // 2. Check if source is a trigger
@@ -5899,6 +5883,7 @@ const releaseToConnectLabel = "Release to Connect"
newdst !== null newdst !== null
) { ) {
const dstdata = RunAutocompleter(newdst.data()); const dstdata = RunAutocompleter(newdst.data());
//console.log("DST Autocompleter: ", dstdata);
} }
var newbranch = { var newbranch = {
@@ -12550,9 +12535,9 @@ const releaseToConnectLabel = "Release to Connect"
let mappingWithName = {} let mappingWithName = {}
let listWithValues = workflow.triggers[selectedTriggerIndex].parameters[5]?.value.split(";").filter(e => e).map(e => e.split("=")) let listWithValues = workflow.triggers[selectedTriggerIndex].parameters[5]?.value.split(";").filter(e => e).map(e => e.split("="))
console.log("LIST WITH VALUES: ", listWithValues) console.log("LIST WITH VALUES: ", listWithValues)
// if (listWithValues === undefined || listWithValues === null || listWithValues.length === 0) { if (listWithValues === undefined || listWithValues === null || listWithValues.length === 0) {
// return "no-overrides"; return "no-overrides";
// } }
for (let i = 0; i < listWithValues.length; i++) { for (let i = 0; i < listWithValues.length; i++) {
mappingWithName[listWithValues[i][0]] = listWithValues[i][1] mappingWithName[listWithValues[i][0]] = listWithValues[i][1]
@@ -15808,6 +15793,7 @@ const releaseToConnectLabel = "Release to Connect"
right: 0, right: 0,
left: isMobile ? 20 : leftBarSize + 20, left: isMobile ? 20 : leftBarSize + 20,
top: isMobile ? 30 : appBarSize + 20, top: isMobile ? 30 : appBarSize + 20,
pointerEvents: "none",
} }
@@ -15828,14 +15814,17 @@ const releaseToConnectLabel = "Release to Connect"
<div style={topBarStyle}> <div style={topBarStyle}>
<div style={{ <div style={{
margin: "0px 10px 0px 10px", margin: "0px 10px 0px 10px",
pointerEvents: "auto",
}}> }}>
<Breadcrumbs <Breadcrumbs
aria-label="breadcrumb" aria-label="breadcrumb"
separator="" separator=""
style={{ style={{
color: "white" color: "white",
pointerEvents: "auto",
}} }}
> >
<Link <Link
to="/workflows" to="/workflows"
style={{ textDecoration: "none", color: "inherit" }} style={{ textDecoration: "none", color: "inherit" }}
@@ -15852,6 +15841,7 @@ const releaseToConnectLabel = "Release to Connect"
</Link> </Link>
<h2 style={{ <h2 style={{
margin: 0, margin: 0,
pointerEvents: "none",
}}>{workflow.name}</h2> }}>{workflow.name}</h2>
</Breadcrumbs> </Breadcrumbs>
@@ -15859,7 +15849,7 @@ const releaseToConnectLabel = "Release to Connect"
isCorrectOrg ? null : isCorrectOrg ? null :
<Typography variant="body1"> <Typography variant="body1">
<b>Warning</b>: Change <span <b>Warning</b>: Change <span
style={{color: "#f85a3e", cursor: "pointer"}} style={{color: "#f85a3e", cursor: "pointer", pointerEvents: "auto", }}
onClick={() => { onClick={() => {
toast("Changing to correct organisation. Please wait a few seconds.") toast("Changing to correct organisation. Please wait a few seconds.")
@@ -16160,7 +16150,7 @@ const releaseToConnectLabel = "Release to Connect"
: null} : null}
</div> </div>
<div style={{display: "flex", marginLeft: 10, }}> <div style={{display: "flex", marginLeft: 10, pointerEvents: "auto", }}>
{parentWorkflows.slice(0,5).map((wf, index) => { {parentWorkflows.slice(0,5).map((wf, index) => {
return ( return (
<a href={`/workflows/${wf.id}`} target="_blank" rel="noopener noreferrer" key={index}> <a href={`/workflows/${wf.id}`} target="_blank" rel="noopener noreferrer" key={index}>
@@ -18472,7 +18462,7 @@ const releaseToConnectLabel = "Release to Connect"
</div> </div>
{foundnotifications > 0 ? {foundnotifications > 0 ?
<Tooltip title={"This workflow created " + foundnotifications + " notification(s). Click to explore them."} placement="top"> <Tooltip title={"This workflow created " + foundnotifications + " notification(s)"} placement="top">
<ErrorOutlineIcon <ErrorOutlineIcon
style={{color: "rgba(255,255,255,0.4)", marginTop: 10, marginRight: 10, }} style={{color: "rgba(255,255,255,0.4)", marginTop: 10, marginRight: 10, }}
onClick={(e) => { onClick={(e) => {
@@ -21484,11 +21474,7 @@ const releaseToConnectLabel = "Release to Connect"
//cy.remove('*') //cy.remove('*')
setElements([]) setElements([])
} }
// // Remove all edges
// cy.edges().remove()
// cy.nodes().remove()
// Remove all cy nodes // Remove all cy nodes
setTimeout(() => { setTimeout(() => {
setupGraph(newrevision) setupGraph(newrevision)
@@ -21725,6 +21711,8 @@ const releaseToConnectLabel = "Release to Connect"
const changeActionParameterCodeMirror = (event, count, data, actionlist) => { const changeActionParameterCodeMirror = (event, count, data, actionlist) => {
// Check if event.target.value is an array. If it is, split with comma // Check if event.target.value is an array. If it is, split with comma
console.log("1 - SELECTED ACTION: ", selectedAction)
console.log("1 - DATA: ", data)
if (data.startsWith("${") && data.endsWith("}")) { if (data.startsWith("${") && data.endsWith("}")) {
// PARAM FIX - Gonna use the ID field, even though it's a hack // PARAM FIX - Gonna use the ID field, even though it's a hack
@@ -21763,8 +21751,6 @@ const releaseToConnectLabel = "Release to Connect"
} }
if (event.target.value[event.target.value.length-1] === "." && actionlist.length > 0) { if (event.target.value[event.target.value.length-1] === "." && actionlist.length > 0) {
console.log("GET THE LAST ARGUMENT FOR NODE!")
var curstring = "" var curstring = ""
var record = false var record = false
for (let [key,keyval] in Object.entries(selectedAction.parameters[count].value)) { for (let [key,keyval] in Object.entries(selectedAction.parameters[count].value)) {
@@ -21779,7 +21765,6 @@ const releaseToConnectLabel = "Release to Connect"
} }
} }
//console.log("CURSTRING: ", curstring)
if (curstring.length > 0 && actionlist !== null) { if (curstring.length > 0 && actionlist !== null) {
// Search back in the action list // Search back in the action list
curstring = curstring.split(" ").join("_").toLowerCase() curstring = curstring.split(" ").join("_").toLowerCase()
@@ -21800,8 +21785,32 @@ const releaseToConnectLabel = "Release to Connect"
} }
} }
selectedAction.parameters[count].autocompleted = false console.log("2 - SELECTED ACTION: ", selectedAction)
selectedAction.parameters[count].value = data console.log("2 - DATA: ", data)
if (selectedAction.app_name === "Shuffle Tools" && selectedAction.name === "filter_list" && count === 0) {
const parsedvalue = data
console.log("Parsed value: ", parsedvalue)
if (parsedvalue.includes("#")) {
const splitparsed = parsedvalue.split(".#.")
//console.log("Cant contain #: ", splitparsed)
if (splitparsed.length > 1) {
console.log("IN HERE AY")
//data.value = splitparsed[0]
selectedAction.parameters[0].value = splitparsed[0]
selectedAction.parameters[1].value = splitparsed[1]
selectedAction.parameters[0].autocompleted = true
selectedAction.parameters[1].autocompleted = true
setUpdate(Math.random())
}
}
} else {
selectedAction.parameters[count].autocompleted = false
selectedAction.parameters[count].value = data
}
setSelectedAction(selectedAction) setSelectedAction(selectedAction)
//setUpdate(Math.random()) //setUpdate(Math.random())
} }