Fixed bug for multi-node copy pasting between workflows

This commit is contained in:
frikky
2021-11-03 03:26:09 +01:00
parent 6660372018
commit 69bf5f4a37
2 changed files with 30 additions and 8 deletions
+1 -1
View File
@@ -3,5 +3,5 @@ requests==2.25.1
MarkupSafe==2.0.1 MarkupSafe==2.0.1
liquidpy==0.7.2 liquidpy==0.7.2
flask[async]==2.0.2 flask[async]==2.0.2
waitress==2.0.0 #waitress==2.0.0
#flask==1.1.2 #flask==1.1.2
+29 -7
View File
@@ -1723,7 +1723,7 @@ const AngularWorkflow = (props) => {
} }
workflow.start = parentNode.data('id') workflow.start = parentNode.data('id')
setLastSaved(true) setLastSaved(false)
parentNode.data('isStartNode', true) parentNode.data('isStartNode', true)
} }
@@ -2161,6 +2161,7 @@ const AngularWorkflow = (props) => {
// Checks for errors in edges when they're added // Checks for errors in edges when they're added
const onEdgeAdded = (event) => { const onEdgeAdded = (event) => {
setLastSaved(false)
const edge = event.target.data() const edge = event.target.data()
var targetnode = workflow.triggers.findIndex(data => data.id === edge.target) var targetnode = workflow.triggers.findIndex(data => data.id === edge.target)
@@ -2280,6 +2281,7 @@ const AngularWorkflow = (props) => {
} }
const onNodeAdded = (event) => { const onNodeAdded = (event) => {
setLastSaved(false)
const node = event.target const node = event.target
const nodedata = event.target.data() const nodedata = event.target.data()
if (nodedata.finished === false || (nodedata.id !== undefined && nodedata.is_valid === undefined)) { if (nodedata.finished === false || (nodedata.id !== undefined && nodedata.is_valid === undefined)) {
@@ -2529,6 +2531,13 @@ const AngularWorkflow = (props) => {
case 67: case 67:
console.log(event) console.log(event)
if (event.ctrlKey) { if (event.ctrlKey) {
if (event.path !== undefined && event.path !== null && event.path.length > 0) {
if (event.path[0].localName !== "body") {
console.log("Skipping because body is not targeted")
return
}
}
console.log("CTRL+C") console.log("CTRL+C")
if (cy !== undefined) { if (cy !== undefined) {
var cydata = cy.$(':selected').jsons() var cydata = cy.$(':selected').jsons()
@@ -2556,7 +2565,7 @@ const AngularWorkflow = (props) => {
break; break;
case 86: case 86:
if (event.ctrlKey) { if (event.ctrlKey) {
console.log("CTRL+V") //console.log("CTRL+V")
// The below parts are handled in the function handlePaste() // The below parts are handled in the function handlePaste()
/* /*
@@ -2599,6 +2608,15 @@ const AngularWorkflow = (props) => {
} }
const handlePaste = (event) => { const handlePaste = (event) => {
//console.log(event)
if (event.path !== undefined && event.path !== null && event.path.length > 0) {
//console.log(event.path[0])
if (event.path[0].localName !== "body") {
//console.log("Skipping because body is not targeted")
return
}
}
event.preventDefault(); event.preventDefault();
const clipboard = (event.originalEvent || event).clipboardData.getData('text/plain'); const clipboard = (event.originalEvent || event).clipboardData.getData('text/plain');
//console.log("Text: ", clipboard) //console.log("Text: ", clipboard)
@@ -2619,8 +2637,8 @@ const AngularWorkflow = (props) => {
}) })
} }
} catch (e) { } catch (e) {
console.log(e) console.log("Error pasting: ", e)
alert.info("Failed parsing clipboard: ", e) //alert.info("Failed parsing clipboard: ", e)
} }
} }
@@ -3235,7 +3253,6 @@ const AngularWorkflow = (props) => {
const removeNode = () => { const removeNode = () => {
setSelectedApp({}) setSelectedApp({})
setSelectedAction({}) setSelectedAction({})
const selectedNode = cy.$(':selected') const selectedNode = cy.$(':selected')
if (selectedNode.data() === undefined) { if (selectedNode.data() === undefined) {
return return
@@ -7762,15 +7779,18 @@ const AngularWorkflow = (props) => {
validate.result = JSON.parse(validate.result) validate.result = JSON.parse(validate.result)
} }
var draggingDisabled = false
const codePopoutModal = !codeModalOpen ? null : const codePopoutModal = !codeModalOpen ? null :
<Draggable <Draggable
onStart={(event) => {
onStart={(e) => { console.log(event)
console.log(event.srcElement)
if (!dragging) { if (!dragging) {
console.log("START") console.log("START")
setDragging(true) setDragging(true)
} }
}} }}
disabled={draggingDisabled}
onStop={(e) => { onStop={(e) => {
console.log("STOP") console.log("STOP")
if (!dragging) { if (!dragging) {
@@ -7813,6 +7833,7 @@ const AngularWorkflow = (props) => {
}} }}
> >
<span id="top_bar">
<Tooltip title="Find successful execution" placement="top" style={{zIndex: 10011}}> <Tooltip title="Find successful execution" placement="top" style={{zIndex: 10011}}>
<IconButton style={{zIndex: 5000, position: "absolute", top: 34, right: 170,}} onClick={(e) => { <IconButton style={{zIndex: 5000, position: "absolute", top: 34, right: 170,}} onClick={(e) => {
e.preventDefault() e.preventDefault()
@@ -7866,6 +7887,7 @@ const AngularWorkflow = (props) => {
<CloseIcon style={{color: "white"}}/> <CloseIcon style={{color: "white"}}/>
</IconButton> </IconButton>
</Tooltip> </Tooltip>
</span>
<div style={{marginBottom: 40,}}> <div style={{marginBottom: 40,}}>
<div style={{display: "flex", marginBottom: 15,}}> <div style={{display: "flex", marginBottom: 15,}}>
{curapp === null ? null : <img alt={selectedResult.app_name} src={curapp === undefined ? "" : curapp.large_image} style={{marginRight: 20, width: imgsize, height: imgsize, border: `2px solid ${statusColor}`}} />} {curapp === null ? null : <img alt={selectedResult.app_name} src={curapp === undefined ? "" : curapp.large_image} style={{marginRight: 20, width: imgsize, height: imgsize, border: `2px solid ${statusColor}`}} />}