visgraph: post, patch and delete relationship link works!

This commit is contained in:
2021-11-09 19:54:01 +01:00
parent d6da6a5d9d
commit b392bc9e65
4 changed files with 78 additions and 39 deletions

View File

@@ -160,6 +160,30 @@ const store = createStore({
addLink(state, link) {
state.links.push(link)
},
updateLink(state, link) {
console.log('updateLink', link)
let link_ = {
from: `person_${link.fromPerson.id}`,
to: `person_${link.toPerson.id}`,
id: 'relationship_' + splitId(link.id,'id')
+ '-person_' + link.fromPerson.id + '-person_' + link.toPerson.id,
arrows: getRelationshipDirection(link),
color: 'lightblue',
font: { color: '#33839d' },
dashes: true,
label: getRelationshipLabel(link),
title: getRelationshipTitle(link),
relation: link.relation,
reverse: link.reverse
}
// find row position and replace by updatedLink
state.links.splice(
state.links.findIndex(item => item.id === link_.id), 1, link_
)
},
removeLink(state, link_id) {
state.links = state.links.filter(l => l.id !== link_id)
},
//// id markers
markInWhitelist(state, person) {