mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-23 16:13:50 +00:00
visgraph: prepare PATCH relationship when submitting (wip)
This commit is contained in:
@@ -305,19 +305,43 @@ export default {
|
||||
},
|
||||
|
||||
submitRelationship() {
|
||||
console.log('submitRelationship')
|
||||
if (this.modal.action !== 'delete') {
|
||||
return postRelationship(
|
||||
this.getPerson(this.modal.data.from), this.getPerson(this.modal.data.to), this.relation, this.reverse
|
||||
)
|
||||
.then(relationship => new Promise(resolve => {
|
||||
console.log('post response', relationship)
|
||||
this.$store.dispatch('addLinkFromRelationship', adapt2vis(relationship))
|
||||
this.modal.showModal = false
|
||||
this.resetForm()
|
||||
resolve()
|
||||
}))
|
||||
.catch()
|
||||
console.log('submitRelationship with action', this.modal.action)
|
||||
switch (this.modal.action) {
|
||||
|
||||
case 'create':
|
||||
return postRelationship(
|
||||
this.getPerson(this.modal.data.from), this.getPerson(this.modal.data.to), this.relation, this.reverse
|
||||
)
|
||||
.then(relationship => new Promise(resolve => {
|
||||
console.log('post response', relationship)
|
||||
this.$store.dispatch('addLinkFromRelationship', adapt2vis(relationship))
|
||||
this.modal.showModal = false
|
||||
this.resetForm()
|
||||
resolve()
|
||||
}))
|
||||
.catch()
|
||||
|
||||
case 'edit':
|
||||
/// TODO
|
||||
// récupérer la relationship,
|
||||
// la modifier,
|
||||
// patcher en reconstruisant le body,
|
||||
// récupérer la réponse,
|
||||
// mettre le link (edge) à jour
|
||||
return patchRelationship(relationship)
|
||||
.then(response => new Promise(resolve => {
|
||||
console.log('patch response', response)
|
||||
this.$store.dispatch('updateLinkFromRelationship', adapt2vis(response))
|
||||
this.modal.showModal = false
|
||||
this.resetForm()
|
||||
resolve()
|
||||
}))
|
||||
.catch()
|
||||
|
||||
case 'delete':
|
||||
break
|
||||
default:
|
||||
throw "undefined action"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user