diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue index 0518a93d2..c10ef5122 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue @@ -1,8 +1,5 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/index.js index 0aeb032d5..332b6cf6c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/index.js @@ -3,16 +3,14 @@ import { store } from "./store.js" import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n' import { visMessages } from './i18n' import App from './App.vue' +import './vis-network' const i18n = _createI18n(visMessages) - const container = document.getElementById('relationship-graph') - const persons = JSON.parse(container.dataset.persons) persons.forEach(person => { store.dispatch('addPerson', person) - //store.dispatch('fetchInfoForPerson', person) }) const app = createApp({ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js new file mode 100644 index 000000000..f8e2a6724 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js @@ -0,0 +1,36 @@ +/* + * Vis-network initial data/configuration script + * Notes: + * Use window.network and window.options to avoid conflict between vue and vis + * cfr. https://github.com/almende/vis/issues/2524#issuecomment-307108271 + */ + +window.options = { + manipulation: { + enabled: true, + initiallyActive: true, + addNode: function(nodeData, callback) { + console.log('addNode', nodeData) + nodeData.label = 'hello world'; + callback(nodeData); + }, + editNode: function(nodeData, callback) { + console.log('editNode', nodeData) + callback(nodeData); + }, + addEdge: function(edgeData, callback) { + console.log('addEdge', edgeData) + callback(edgeData); + }, + editEdge: function(edgeData, callback) { + console.log('editNode', edgeData) + callback(edgeData); + }, + }, + nodes: { + physics: true + } +}; + +window.network = {}; +