mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
prepare vue_visgraph component, with store, dataset and display basic graph
This commit is contained in:
@@ -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 }
|
Reference in New Issue
Block a user