vue_visgraph: improve graph

This commit is contained in:
2021-10-29 12:06:59 +02:00
parent 1155555bb3
commit 1c60a5b51e
3 changed files with 56 additions and 36 deletions

View File

@@ -1,6 +1,6 @@
import { createStore } from 'vuex'
import { getHouseholdByPerson, getCoursesByPerson, getRelationshipsByPerson } from './api'
import { adapt2vis, getHouseholdLabel, getHouseholdWidth, getRelationshipLabel } from './vis-network'
import { adapt2vis, getHouseholdLabel, getHouseholdWidth, getRelationshipLabel, getRelationshipTitle } from './vis-network'
import { visMessages } from './i18n'
const debug = process.env.NODE_ENV !== 'production'
@@ -115,7 +115,6 @@ const store = createStore({
* 1) Add a person in state
* @param Person person
*/
addPerson({ commit, dispatch }, person) {
commit('markPersonLoaded', person.id)
commit('addPerson', person)
@@ -127,7 +126,9 @@ const store = createStore({
* @param Person person
*/
fetchInfoForPerson({ dispatch }, person) {
dispatch('fetchHouseholdForPerson', person)
if (null !== person.current_household_id) {
dispatch('fetchHouseholdForPerson', person)
}
dispatch('fetchCoursesByPerson', person)
dispatch('fetchRelationshipByPerson', person)
},
@@ -226,7 +227,7 @@ const store = createStore({
arrows: 'from',
color: 'orange',
font: { color: 'darkorange' },
label: visMessages.fr.visgraph.concerned,
//label: visMessages.fr.visgraph.concerned,
})
if (!getters.isPersonLoaded(p.person.id)) {
console.log(' person is not loaded', p.person.id)
@@ -277,9 +278,11 @@ const store = createStore({
to: `person_${r.toPerson.id}`,
id: 'r' + r.id + '_p' + r.fromPerson.id + '_p' + r.toPerson.id,
arrows: 'to',
color: 'lightblue', dashes: true,
color: 'lightblue',
font: { color: '#33839d' },
dashes: true,
label: getRelationshipLabel(r, false),
title: getRelationshipTitle(r),
})
for (let person of [r.fromPerson, r.toPerson]) {
if (!getters.isPersonLoaded(person.id)) {