diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue index 312b5d722..3cd3de56d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue @@ -5,7 +5,7 @@
- -
@@ -211,12 +204,6 @@ export default { return this.checkedLayers }, - /* - toggleIdPerson() { - console.log('toggleIdPerson') - }, - */ - relation: { get() { return this.modal.data.relation @@ -249,6 +236,8 @@ export default { // Instanciate vis objects in separate window variables, see vis-network.js window.network = new vis.Network(this.container, this.visgraph_data, window.options) }, + + // events listenOnGraph() { window.network.on('selectNode', (data) => { if (data.nodes.length > 1) { @@ -300,7 +289,7 @@ export default { console.log('@@@@@ event on selected Edge', data.edges.length, linkType, data) if (linkType.startsWith('relationship')) { - console.log('linkType relationship') + //console.log('linkType relationship') let relationships = this.edges.filter(l => l.id === link) if (relationships.length > 1) { @@ -308,7 +297,7 @@ export default { } let relationship = relationships[0] - console.log(relationship) + //console.log(relationship) this.editRelationshipModal({ from: relationship.from, @@ -318,20 +307,12 @@ export default { reverse: relationship.reverse }) } - /* Disabled - if (linkType.startsWith('household')) { - console.log('linkType household') - } else - if (linkType.startsWith('accompanying_period')) { - console.log('linkType accompanying_period') - } else - */ }) }, listenStepsToAddRelationship(person) { console.log(' @@> listenStep', this.listenPersonFlag) if (this.listenPersonFlag === 'step2') { - console.log(' @@> person 2', person) + //console.log(' @@> person 2', person) this.newEdgeData.to = person.id this.addRelationshipModal(this.newEdgeData) this.displayHelpMessage = false @@ -339,11 +320,13 @@ export default { this.newEdgeData = {} } if (this.listenPersonFlag === 'step1') { - console.log(' @@> person 1', person) + //console.log(' @@> person 1', person) this.newEdgeData.from = person.id this.listenPersonFlag = 'step2' } }, + + // force refresh forceUpdateComponent() { //console.log('!! forceUpdateComponent !!') this.$forceUpdate() @@ -374,7 +357,7 @@ export default { /// control Modal addRelationshipModal(edgeData) { - console.log('==- addRelationshipModal', edgeData) + //console.log('==- addRelationshipModal', edgeData) this.modal.data.from = edgeData.from this.modal.data.to = edgeData.to this.modal.action = 'create' @@ -387,7 +370,7 @@ export default { this.modal.data = edgeData this.relation = this.modal.data.relation this.reverse = this.modal.data.reverse - console.log('==- editRelationshipModal', this.modal.data) + //console.log('==- editRelationshipModal', this.modal.data) this.modal.action = 'edit' this.modal.title = 'visgraph.edit_relationship_link' this.modal.button.class = 'btn-edit' @@ -395,6 +378,7 @@ export default { this.modal.showModal = true }, + // form resetForm() { console.log('==- reset Form') this.modal.data = { @@ -409,6 +393,7 @@ export default { this.modal.button.class = null this.modal.button.text = null }, + getRelationsList() { //console.log('fetch relationsList') return getRelationsList().then(relations => new Promise(resolve => { @@ -421,32 +406,33 @@ export default { //console.log('customLabel', value) return (value.title && value.reverseTitle) ? `${value.title.fr} ↔ ${value.reverseTitle.fr}` : '' }, - - getPerson(idtext) { - let person = this.persons.filter(p => p.id === idtext) + getPerson(id) { + let person = this.persons.filter(p => p.id === id) return person[0] }, - newRelationshipLinkButton() { + // actions + createRelationship() { this.displayHelpMessage = true this.listenPersonFlag = 'step1' console.log(' @@> switch listener to create link mode:', this.listenPersonFlag) }, dropRelationship() { - console.log('delete', this.modal.data) + //console.log('delete', this.modal.data) deleteRelationship(this.modal.data) + .catch() this.$store.commit('removeLink', this.modal.data.id) this.modal.showModal = false this.resetForm() }, submitRelationship() { - console.log('submitRelationship with action', this.modal.action) + console.log('submitRelationship', this.modal.action) switch (this.modal.action) { case 'create': return postRelationship(this.modal.data) .then(relationship => new Promise(resolve => { - console.log('post response', relationship) + console.log('post relationship response', relationship) this.$store.dispatch('addLinkFromRelationship', relationship) this.modal.showModal = false this.resetForm() @@ -457,7 +443,7 @@ export default { case 'edit': return patchRelationship(this.modal.data) .then(relationship => new Promise(resolve => { - console.log('patch relationship', relationship) + console.log('patch relationship response', relationship) this.$store.commit('updateLink', relationship) this.modal.showModal = false this.resetForm() @@ -471,6 +457,7 @@ export default { } }, + /* /// Tiny emitter events created() { eventHub.on('add-relationship-modal', this.addRelationshipModal) @@ -482,6 +469,7 @@ export default { eventHub.off('edit-relationship-modal', this.editRelationshipModal) eventHub.off('delete-relationship-modal', this.deleteRelationshipModal) } + */ } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/store.js index edde88f1f..d9f6b5b03 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/store.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/store.js @@ -216,11 +216,11 @@ const store = createStore({ //// excluded addExcludedNode(state, id) { - console.log('==> exclude list: +', id) + //console.log('==> exclude list: +', id) state.excludedNodesIds.push(id) }, removeExcludedNode(state, id) { - console.log('<== exclude list: -', id) + //console.log('<== exclude list: -', id) state.excludedNodesIds = state.excludedNodesIds.filter(e => e !== id) }, 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 cf3dc1baa..082d35b15 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js @@ -1,5 +1,5 @@ import { visMessages } from './i18n' -import { TinyEmitter } from "tiny-emitter"; +//import { TinyEmitter } from "tiny-emitter"; /** * Vis-network initial data/configuration script @@ -8,8 +8,8 @@ import { TinyEmitter } from "tiny-emitter"; * cfr. https://github.com/almende/vis/issues/2524#issuecomment-307108271 */ -console.log('@@@ init eventHub App @@@') -window.eventHub = new TinyEmitter() +//console.log('@@@ init eventHub App @@@') +//window.eventHub = new TinyEmitter() window.network = {} @@ -82,8 +82,11 @@ window.options = { enabled: false, initiallyActive: false, addNode: false, - //editNode: function(nodeData, callback) { callback(nodeData) }, //disabled if undefined deleteNode: false, + /* + //disabled if undefined + //editNode: function(nodeData, callback) { callback(nodeData) }, + // TODO see alternative with 'Manipulation methods to use the manipulation system without GUI.' addEdge: function(edgeData, callback) { if ( @@ -111,6 +114,7 @@ window.options = { callback(edgeData) } // end TODO + */ }, nodes: { borderWidth: 1,