visgraph: improve nodes that are hidden when uncheck layer

- a new getter count links by node. before exclude person, check first if node has others visible links
- links id are rewrote to serve count links getter
- unfold and expand only folded person
This commit is contained in:
2021-11-05 14:35:23 +01:00
parent 9494bdee2a
commit bfcd420cdf
3 changed files with 59 additions and 35 deletions

View File

@@ -140,7 +140,10 @@ export default {
}
},
computed: {
...mapGetters(['nodes', 'edges']),
...mapGetters(['nodes', 'edges',
// not used
'isInWhitelist', 'isHouseholdLoading', 'isCourseLoaded', 'isRelationshipLoaded', 'isPersonLoaded', 'isExcludedNode', 'countLinksByNode', 'getParticipationsByCourse', 'getMembersByHousehold', 'getFoldedPersons',
]),
...mapState(['households', 'courses', 'excludedNodesIds', 'persons',
// not used
'links', 'relationships', 'whitelistIds', 'personLoadedIds', 'householdLoadingIds', 'courseLoadedIds', 'relationshipLoadedIds',
@@ -234,16 +237,15 @@ export default {
if (data.nodes.length > 1) {
throw 'Multi selection is not allowed. Disable it in options.interaction !'
}
let nodeType = splitId(data.nodes[0], 'type')
switch (nodeType) {
let node = data.nodes[0]
// test
console.log(
splitId('accompanying_period_124', 'id')
)
//this.countLinksByNode(node)
let nodeType = splitId(node, 'type')
switch (nodeType) {
case 'person':
let person = this.nodes.filter(n => n.id === data.nodes[0])[0]
let person = this.nodes.filter(n => n.id === node)[0]
console.log('@@@@@@ event on selected Node', person.id)
if (person.label === null) {
this.$store.commit('unfoldPerson', person)
@@ -252,14 +254,14 @@ export default {
break
case 'household':
let household = this.nodes.filter(n => n.id === data.nodes[0])[0]
let household = this.nodes.filter(n => n.id === node)[0]
console.log('@@@@@@ event on selected Node', household.id)
this.$store.dispatch('unfoldPersonsByHousehold', household)
this.forceUpdateComponent()
break
case 'accompanying_period':
let course = this.nodes.filter(n => n.id === data.nodes[0])[0]
let course = this.nodes.filter(n => n.id === node)[0]
console.log('@@@@@@ event on selected Node', course.id)
this.$store.dispatch('unfoldPersonsByCourse', course)
this.forceUpdateComponent()