|
|
@@ -281,7 +281,7 @@ const EditPipeline = () => { |
|
|
const getFirstWorkflow = (val) => { |
|
|
const getFirstWorkflow = (val) => { |
|
|
getWorkflowById(val).then((ret) => { |
|
|
getWorkflowById(val).then((ret) => { |
|
|
if (ret && ret.data) { |
|
|
if (ret && ret.data) { |
|
|
setGlobalParam(ret.data.global_param); |
|
|
|
|
|
|
|
|
setGlobalParam(ret.data.global_param || []); |
|
|
} |
|
|
} |
|
|
if (graph && ret.data && ret.data.dag) { |
|
|
if (graph && ret.data && ret.data.dag) { |
|
|
getGraphData(JSON.parse(ret.data.dag)); |
|
|
getGraphData(JSON.parse(ret.data.dag)); |
|
|
@@ -393,6 +393,8 @@ const EditPipeline = () => { |
|
|
// 上下各3,左右各1 |
|
|
// 上下各3,左右各1 |
|
|
[0.5, 0], |
|
|
[0.5, 0], |
|
|
[0.5, 1], |
|
|
[0.5, 1], |
|
|
|
|
|
[0, 0.5], |
|
|
|
|
|
[1, 0.5], |
|
|
] |
|
|
] |
|
|
); |
|
|
); |
|
|
}, |
|
|
}, |
|
|
@@ -456,6 +458,7 @@ const EditPipeline = () => { |
|
|
anchorPointIdx: i, // flag the idx of the anchor-point circle |
|
|
anchorPointIdx: i, // flag the idx of the anchor-point circle |
|
|
links: 0, // cache the number of edges connected to this shape |
|
|
links: 0, // cache the number of edges connected to this shape |
|
|
visible: false, // invisible by default, shows up when links > 1 or the node is in showAnchors state |
|
|
visible: false, // invisible by default, shows up when links > 1 or the node is in showAnchors state |
|
|
|
|
|
draggable: true, |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
return image; |
|
|
return image; |
|
|
@@ -503,7 +506,7 @@ const EditPipeline = () => { |
|
|
// config the shouldBegin and shouldEnd to make sure the create-edge is began and ended at anchor-point circles |
|
|
// config the shouldBegin and shouldEnd to make sure the create-edge is began and ended at anchor-point circles |
|
|
{ |
|
|
{ |
|
|
type: 'create-edge', |
|
|
type: 'create-edge', |
|
|
// trigger: 'drag', |
|
|
|
|
|
|
|
|
trigger: 'drag', |
|
|
shouldBegin: (e) => { |
|
|
shouldBegin: (e) => { |
|
|
// avoid beginning at other shapes on the node |
|
|
// avoid beginning at other shapes on the node |
|
|
if (e.target && e.target.get('name') !== 'anchor-point') return false; |
|
|
if (e.target && e.target.get('name') !== 'anchor-point') return false; |
|
|
@@ -619,16 +622,24 @@ const EditPipeline = () => { |
|
|
fitView: true, |
|
|
fitView: true, |
|
|
fitViewPadding: [320, 320, 220, 320], |
|
|
fitViewPadding: [320, 320, 220, 320], |
|
|
}); |
|
|
}); |
|
|
graph.on('dblclick', (e) => { |
|
|
|
|
|
console.log(e.item); |
|
|
|
|
|
if (e.item) { |
|
|
|
|
|
graph.setItemState(e.item, 'nodeClicked', true); |
|
|
|
|
|
handlerClick(e); |
|
|
|
|
|
|
|
|
// graph.on('dblclick', (e) => { |
|
|
|
|
|
// console.log(e.item); |
|
|
|
|
|
// if (e.item) { |
|
|
|
|
|
// graph.setItemState(e.item, 'nodeClicked', true); |
|
|
|
|
|
// handlerClick(e); |
|
|
|
|
|
// } |
|
|
|
|
|
// }); |
|
|
|
|
|
graph.on('node:click', (e) => { |
|
|
|
|
|
console.log(e.target.get('name')); |
|
|
|
|
|
if (e.target.get('name') === 'anchor-point') { |
|
|
|
|
|
// create edge |
|
|
|
|
|
} else { |
|
|
|
|
|
if (e.item) { |
|
|
|
|
|
graph.setItemState(e.item, 'nodeClicked', true); |
|
|
|
|
|
handlerClick(e); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
graph.on('click', (e) => { |
|
|
|
|
|
console.log(e.item); |
|
|
|
|
|
}); |
|
|
|
|
|
graph.on('aftercreateedge', (e) => { |
|
|
graph.on('aftercreateedge', (e) => { |
|
|
// update the sourceAnchor and targetAnchor for the newly added edge |
|
|
// update the sourceAnchor and targetAnchor for the newly added edge |
|
|
graph.updateItem(e.edge, { |
|
|
graph.updateItem(e.edge, { |
|
|
@@ -666,6 +677,39 @@ const EditPipeline = () => { |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
graph.on('node:dragenter', (e) => { |
|
|
|
|
|
console.log(e.target.get('name')); |
|
|
|
|
|
console.log('node:dragenter'); |
|
|
|
|
|
graph.setItemState(e.item, 'nodeSelected', true); |
|
|
|
|
|
graph.updateItem(e.item, { |
|
|
|
|
|
// 节点的样式 |
|
|
|
|
|
style: { |
|
|
|
|
|
stroke: '#1664ff', |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
graph.on('node:dragleave', (e) => { |
|
|
|
|
|
console.log(e.target.get('name')); |
|
|
|
|
|
console.log('node:dragleave'); |
|
|
|
|
|
graph.setItemState(e.item, 'nodeSelected', false); |
|
|
|
|
|
graph.updateItem(e.item, { |
|
|
|
|
|
// 节点的样式 |
|
|
|
|
|
style: { |
|
|
|
|
|
stroke: 'transparent', |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
graph.on('node:dragstart', (e) => { |
|
|
|
|
|
console.log('node:dragstart'); |
|
|
|
|
|
graph.setItemState(e.item, 'nodeSelected', true); |
|
|
|
|
|
graph.updateItem(e.item, { |
|
|
|
|
|
// 节点的样式 |
|
|
|
|
|
style: { |
|
|
|
|
|
stroke: '#1664ff', |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
graph.on('afterremoveitem', (e) => { |
|
|
graph.on('afterremoveitem', (e) => { |
|
|
if (e.item && e.item.source && e.item.target) { |
|
|
if (e.item && e.item.source && e.item.target) { |
|
|
const sourceNode = graph.findById(e.item.source); |
|
|
const sourceNode = graph.findById(e.item.source); |
|
|
|