mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
visgraph: fix body in POST relationship query
This commit is contained in:
parent
024531fbe1
commit
6b31bf225a
@ -62,7 +62,7 @@
|
|||||||
</VueMultiselect>
|
</VueMultiselect>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="relation && relation.title && relation.reverseTitle">
|
<div v-if="relation && relation.title && relation.reverseTitle">
|
||||||
<p class="text-center" v-if="reverse">
|
<p class="text-start" v-if="reverse">
|
||||||
{{ $t('visgraph.relation_from_to_like', [
|
{{ $t('visgraph.relation_from_to_like', [
|
||||||
getPerson(modal.data.to).text,
|
getPerson(modal.data.to).text,
|
||||||
getPerson(modal.data.from).text,
|
getPerson(modal.data.from).text,
|
||||||
@ -75,7 +75,7 @@
|
|||||||
relation.reverseTitle.fr.toLowerCase(),
|
relation.reverseTitle.fr.toLowerCase(),
|
||||||
])}}
|
])}}
|
||||||
</p>
|
</p>
|
||||||
<p class="text-center" v-else>
|
<p class="text-start" v-else>
|
||||||
{{ $t('visgraph.relation_from_to_like', [
|
{{ $t('visgraph.relation_from_to_like', [
|
||||||
getPerson(modal.data.from).text,
|
getPerson(modal.data.from).text,
|
||||||
getPerson(modal.data.to).text,
|
getPerson(modal.data.to).text,
|
||||||
@ -102,7 +102,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<button class="btn" :class="modal.button.class" @click="modal.showModal = false">
|
<button class="btn" :class="modal.button.class" @click="submitRelationship">
|
||||||
{{ $t(modal.button.text)}}</button>
|
{{ $t(modal.button.text)}}</button>
|
||||||
</template>
|
</template>
|
||||||
</modal>
|
</modal>
|
||||||
@ -115,7 +115,7 @@ import vis from 'vis-network/dist/vis-network'
|
|||||||
import { mapState, mapGetters } from "vuex"
|
import { mapState, mapGetters } from "vuex"
|
||||||
import Modal from 'ChillMainAssets/vuejs/_components/Modal'
|
import Modal from 'ChillMainAssets/vuejs/_components/Modal'
|
||||||
import VueMultiselect from 'vue-multiselect'
|
import VueMultiselect from 'vue-multiselect'
|
||||||
import { getRelationsList } from "./api";
|
import { getRelationsList, postRelationship } from "./api";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "App",
|
name: "App",
|
||||||
@ -192,7 +192,7 @@ export default {
|
|||||||
return this.relation
|
return this.relation
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
console.log('setter relation', value) // <=== InternalError: too much recursion
|
//console.log('setter relation', value) // <=== InternalError: too much recursion
|
||||||
this.relation = value
|
this.relation = value
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -202,7 +202,7 @@ export default {
|
|||||||
return this.reverse
|
return this.reverse
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
console.log('setter reverse', value) // <=== InternalError: too much recursion
|
//console.log('setter reverse', value) // <=== InternalError: too much recursion
|
||||||
this.reverse = value
|
this.reverse = value
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -299,6 +299,21 @@ export default {
|
|||||||
getPerson(idtext) {
|
getPerson(idtext) {
|
||||||
let person = this.persons.filter(p => p.id === idtext)
|
let person = this.persons.filter(p => p.id === idtext)
|
||||||
return person[0]
|
return person[0]
|
||||||
|
},
|
||||||
|
submitRelationship() {
|
||||||
|
console.log('submitRelationship')
|
||||||
|
return postRelationship(
|
||||||
|
this.getPerson(this.modal.data.from),
|
||||||
|
this.getPerson(this.modal.data.to),
|
||||||
|
this.relation,
|
||||||
|
this.reverse
|
||||||
|
)
|
||||||
|
.then(response => new Promise(resolve =>{
|
||||||
|
console.log('', response)
|
||||||
|
modal.showModal = false
|
||||||
|
resolve()
|
||||||
|
}))
|
||||||
|
.catch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,4 +332,7 @@ div#visgraph-legend {
|
|||||||
div.post-menu.legend {
|
div.post-menu.legend {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.modal-mask {
|
||||||
|
background-color: rgba(0, 0, 0, 0.25);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -120,18 +120,21 @@ const getRelationsList = () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @function postRelationship
|
* @function postRelationship
|
||||||
* @param person
|
* @param fromPerson
|
||||||
|
* @param toPerson
|
||||||
|
* @param relation
|
||||||
|
* @param reverse
|
||||||
* @returns {Promise<Response>}
|
* @returns {Promise<Response>}
|
||||||
*/
|
*/
|
||||||
const postRelationship = (person) => {
|
const postRelationship = (fromPerson, toPerson, relation, reverse) => {
|
||||||
//console.log('postRelationship', person.id)
|
|
||||||
return postFetch(
|
return postFetch(
|
||||||
`/api/1.0/relations/relationship.json`,
|
`/api/1.0/relations/relationship.json`,
|
||||||
{
|
{
|
||||||
from: { type: 'person', id: 0 },
|
type: 'relationship',
|
||||||
to: { type: 'person', id: 0 },
|
fromPerson: { type: 'person', id: fromPerson._id },
|
||||||
relation: { type: 'relation', id: 0 },
|
toPerson: { type: 'person', id: toPerson._id },
|
||||||
reverse: bool
|
relation: { type: 'relation', id: relation.id },
|
||||||
|
reverse: reverse
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ const visMessages = {
|
|||||||
delete_relationship_link: "Êtes-vous sûr ?",
|
delete_relationship_link: "Êtes-vous sûr ?",
|
||||||
delete_confirmation_text: "Vous allez supprimer le lien entre ces 2 usagers.",
|
delete_confirmation_text: "Vous allez supprimer le lien entre ces 2 usagers.",
|
||||||
reverse_relation: "Inverser la relation",
|
reverse_relation: "Inverser la relation",
|
||||||
relation_from_to_like: "{0} est {2} de {1}",
|
relation_from_to_like: "{0}, {2} de {1}",
|
||||||
},
|
},
|
||||||
edit: 'Éditer',
|
edit: 'Éditer',
|
||||||
del: 'Supprimer',
|
del: 'Supprimer',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user