diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue index 087208fdd..a50783ac3 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue @@ -234,14 +234,13 @@ export default { }, listenOnGraph() { window.network.on('selectNode', (data) => { - if (data.nodes.length > 1) { throw 'Multi selection is not allowed. Disable it in options.interaction !' } let node = data.nodes[0] - let nodeType = splitId(node, 'type') switch (nodeType) { + case 'person': let person = this.nodes.filter(n => n.id === node)[0] console.log('@@@@@@ event on selected Node', person.id) @@ -269,6 +268,25 @@ export default { throw 'event is undefined for this type of node' } }) + window.network.on('selectEdge', (data) => { + if (data.nodes.length !== 0 && data.edges.length !== 1) { + return false + } + let linkType = splitId(data.edges[0], 'link') //<------ Uncaught TypeError: id is undefined + if (linkType.startsWith('relationship')) { + console.log('@@@@@ event on selected Edge', data) + console.log('linkType relationship') + this.editRelationshipModal(data) //<------ you are here, and data is wrong ! + } + /* Disabled + if (linkType.startsWith('household')) { + console.log('linkType household') + } else + if (linkType.startsWith('accompanying_period')) { + console.log('linkType accompanying_period') + } else + */ + }) }, forceUpdateComponent() { //console.log('!! forceUpdateComponent !!') diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js index 9ea670784..011f83977 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js @@ -8,7 +8,7 @@ import { TinyEmitter } from "tiny-emitter"; * cfr. https://github.com/almende/vis/issues/2524#issuecomment-307108271 */ -//console.log('@@@ init eventHub App @@@') +console.log('@@@ init eventHub App @@@') window.eventHub = new TinyEmitter() window.network = {} @@ -75,7 +75,7 @@ window.options = { }, interaction: { hover: true, - multiselect: false, + multiselect: true, navigationButtons: false, }, manipulation: {