prepare vue_visgraph component, with store, dataset and display basic graph

This commit is contained in:
2021-10-18 15:47:57 +02:00
parent 8be11314c3
commit 1b0c19a68f
11 changed files with 250 additions and 59 deletions

View File

@@ -0,0 +1,47 @@
import { createStore } from 'vuex'
import { getHousehold, getCourse, getRelationship } from './api'
const debug = process.env.NODE_ENV !== 'production'
const store = createStore({
strict: debug,
state: {
persons: [],
households: [],
courses: [],
relationships: [],
},
getters: {
getNodes() {
let nodes = [];
state.households.forEach(h => {
nodes.push(h)
});
return nodes
},
getEdges() {
}
},
mutations: {
addPerson(state, person) {
person.label = person.text // vis need label
state.persons.push(person)
}
},
actions: {
addPerson({ commit }, person) {
//console.log('addPerson', person)
commit('addPerson', person)
},
fetchInfoForPerson({ commit }, person) {
console.log('fetchInfoForPerson', person)
getHousehold(person)
getCourse(person)
getRelationship(person)
},
}
});
export { store }