mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-23 16:13:50 +00:00
visgraph: pass context to modals
This commit is contained in:
@@ -23,16 +23,37 @@
|
||||
<teleport to="body">
|
||||
<modal v-if="modal.showModal" :modalDialogClass="modal.modalDialogClass" @close="modal.showModal = false">
|
||||
<template v-slot:header>
|
||||
<h2 class="modal-title">Créer un lien de filiation</h2>
|
||||
<h2 class="modal-title">{{ $t(modal.title) }}</h2>
|
||||
</template>
|
||||
<template v-slot:body>
|
||||
|
||||
|
||||
|
||||
<div v-if="modal.action === 'delete'">
|
||||
<p>
|
||||
{{ $t('visgraph.delete_confirmation_text') }}
|
||||
</p>
|
||||
</div>
|
||||
<div v-else>
|
||||
<form>
|
||||
{{ modal.data.id }}
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
{{ modal.data.from }}
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
{{ modal.data.to }}
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
phrase
|
||||
</p>
|
||||
<div>
|
||||
toggle reverse
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
<template v-slot:footer>
|
||||
<button class="btn btn-create" @click="modal.showModal = false">
|
||||
{{ $t('action.save')}}</button>
|
||||
<button class="btn" :class="modal.button.class" @click="modal.showModal = false">
|
||||
{{ $t(modal.button.text)}}</button>
|
||||
</template>
|
||||
</modal>
|
||||
</teleport>
|
||||
@@ -55,7 +76,14 @@ export default {
|
||||
checkedLayers: [],
|
||||
modal: {
|
||||
showModal: false,
|
||||
modalDialogClass: "modal-dialog-scrollable modal-md"
|
||||
modalDialogClass: "modal-dialog-scrollable modal-md",
|
||||
title: null,
|
||||
action: null,
|
||||
data: {},
|
||||
button: {
|
||||
class: null,
|
||||
text: null
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
@@ -105,14 +133,14 @@ export default {
|
||||
|
||||
},
|
||||
created() {
|
||||
eventHub.on('add-relationship-link', this.addRelationshipLink)
|
||||
eventHub.on('edit-relationship-link', this.editRelationshipLink)
|
||||
eventHub.on('delete-relationship-link', this.deleteRelationshipLink)
|
||||
eventHub.on('add-relationship-modal', this.addRelationshipModal)
|
||||
eventHub.on('edit-relationship-modal', this.editRelationshipModal)
|
||||
eventHub.on('delete-relationship-modal', this.deleteRelationshipModal)
|
||||
},
|
||||
unmounted() {
|
||||
eventHub.off('add-relationship-link', this.addRelationshipLink)
|
||||
eventHub.off('edit-relationship-link', this.editRelationshipLink)
|
||||
eventHub.off('delete-relationship-link', this.deleteRelationshipLink)
|
||||
eventHub.off('add-relationship-modal', this.addRelationshipModal)
|
||||
eventHub.off('edit-relationship-modal', this.editRelationshipModal)
|
||||
eventHub.off('delete-relationship-modal', this.deleteRelationshipModal)
|
||||
},
|
||||
mounted() {
|
||||
console.log('=== mounted: init graph')
|
||||
@@ -150,16 +178,31 @@ export default {
|
||||
this.$store.commit('addExcludedNode', id)
|
||||
},
|
||||
|
||||
addRelationshipLink(edgeData) {
|
||||
console.log('==> addRelationshipLink <=======================', edgeData)
|
||||
addRelationshipModal(edgeData) {
|
||||
console.log('==> addRelationshipModal <=======================', edgeData)
|
||||
this.modal.data = edgeData
|
||||
this.modal.action = 'create'
|
||||
this.modal.title = 'visgraph.add_relationship_link'
|
||||
this.modal.button.class = 'btn-create'
|
||||
this.modal.button.text = 'action.create'
|
||||
this.modal.showModal = true
|
||||
},
|
||||
editRelationshipLink(edgeData) {
|
||||
console.log('==> editRelationshipLink <=======================', edgeData)
|
||||
editRelationshipModal(edgeData) {
|
||||
console.log('==> editRelationshipModal <=======================', edgeData)
|
||||
this.modal.data = edgeData
|
||||
this.modal.action = 'edit'
|
||||
this.modal.title = 'visgraph.edit_relationship_link'
|
||||
this.modal.button.class = 'btn-edit'
|
||||
this.modal.button.text = 'action.edit'
|
||||
this.modal.showModal = true
|
||||
},
|
||||
deleteRelationshipLink(edgeData) {
|
||||
console.log('==> deleteRelationshipLink <=======================', edgeData)
|
||||
deleteRelationshipModal(edgeData) {
|
||||
console.log('==> deleteRelationshipModal <=======================', edgeData)
|
||||
this.modal.data = edgeData
|
||||
this.modal.action = 'delete'
|
||||
this.modal.title = 'visgraph.delete_relationship_link'
|
||||
this.modal.button.class = 'btn-delete'
|
||||
this.modal.button.text = 'action.delete'
|
||||
this.modal.showModal = true
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user