|
@@ -51,7 +51,6 @@
|
|
|
class="flow-selector"
|
|
|
:class="{'flow-selector--selecting':(selector)?true:false}"
|
|
|
v-bind="selector"/>
|
|
|
-
|
|
|
</flow-pan-zoom>
|
|
|
</svg>
|
|
|
<div class="flow-container__control">
|
|
@@ -140,11 +139,24 @@ export default {
|
|
|
const fromOutput = refFrom.outputPos(0) // only 1 output
|
|
|
const toInput = refTo.inputPos(link.in)
|
|
|
|
|
|
+ let color = null
|
|
|
+ if (this.activity[nodeFrom.id]) {
|
|
|
+ if (this.activity[nodeFrom.id].status === 'running') {
|
|
|
+ color = 'blue'
|
|
|
+ }
|
|
|
+ if (this.activity[nodeFrom.id].status === 'finish') {
|
|
|
+ color = 'green'
|
|
|
+ }
|
|
|
+ if (this.activity[nodeFrom.id].status === 'error') {
|
|
|
+ color = 'red'
|
|
|
+ }
|
|
|
+ }
|
|
|
return {
|
|
|
x1: nodeFrom.x + fromOutput.x,
|
|
|
y1: nodeFrom.y + fromOutput.y,
|
|
|
x2: nodeTo.x + toInput.x,
|
|
|
- y2: nodeTo.y + toInput.y
|
|
|
+ y2: nodeTo.y + toInput.y,
|
|
|
+ color: color
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -206,9 +218,26 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
keyDown (ev) {
|
|
|
+ if (document.activeElement && document.activeElement.matches('input,textarea')) return
|
|
|
if (ev.shiftKey) {
|
|
|
this.linking = true
|
|
|
}
|
|
|
+
|
|
|
+ let single = null
|
|
|
+ const selectionIds = Object.keys(this.nodeSelection)
|
|
|
+ if (selectionIds.length === 1) { single = this.nodeSelection[selectionIds[0]] }
|
|
|
+ switch (ev.key) {
|
|
|
+ case 'Enter':
|
|
|
+ if (!single) { return }
|
|
|
+ this.$emit('nodeInspect', single)
|
|
|
+ break
|
|
|
+ case 'Delete':
|
|
|
+ if (!this.nodeSelection) { return }
|
|
|
+ for (let k in this.nodeSelection) {
|
|
|
+ this.nodeRemove(this.nodeSelection[k])
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
},
|
|
|
keyUp (ev) {
|
|
|
if (!ev.shiftKey) {
|
|
@@ -309,11 +338,8 @@ export default {
|
|
|
document.activeElement && document.activeElement.blur()
|
|
|
const tnode = this.nodeData.nodes[i]
|
|
|
if (ev.button === 1) {
|
|
|
+ this.nodeRemove(tnode)
|
|
|
// remove related links
|
|
|
- this.nodeData.links = this.nodeData.links.filter(l => l.from !== tnode.id && l.to !== tnode.id)
|
|
|
- this.nodeData.nodes.splice(i, 1)
|
|
|
- this.sendFlowEvent('nodeRemove', tnode)
|
|
|
- this.sendDocumentUpdate()
|
|
|
return
|
|
|
}
|
|
|
if (ev.button !== 0) return // first button
|
|
@@ -354,6 +380,14 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ nodeRemove (node) {
|
|
|
+ const i = this.nodeData.nodes.indexOf(node)
|
|
|
+ if (i === -1) return
|
|
|
+ this.nodeData.links = this.nodeData.links.filter(l => l.from !== node.id && l.to !== node.id)
|
|
|
+ this.nodeData.nodes.splice(i, 1)
|
|
|
+ this.sendFlowEvent('nodeRemove', node)
|
|
|
+ this.sendDocumentUpdate()
|
|
|
+ },
|
|
|
nodeAdd (src, x = 100, y = 100) {
|
|
|
const newNode = {
|
|
|
id: utils.guid(),
|
|
@@ -376,7 +410,7 @@ export default {
|
|
|
this.sendDocumentUpdate()
|
|
|
},
|
|
|
linkPointerClick (ev, link) {
|
|
|
- if (ev.button !== 1) return
|
|
|
+ console.log('Link click')
|
|
|
ev.preventDefault()
|
|
|
this.linkRemove(link)
|
|
|
},
|