mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
visgraph: open vue modal when adding/editing edge
This commit is contained in:
parent
5d995115ba
commit
d3a08149f0
@ -4,7 +4,6 @@
|
|||||||
<teleport to="#visgraph-legend">
|
<teleport to="#visgraph-legend">
|
||||||
<div class="my-4 post-menu legend">
|
<div class="my-4 post-menu legend">
|
||||||
<h3>{{ $t('visgraph.Legend')}}</h3>
|
<h3>{{ $t('visgraph.Legend')}}</h3>
|
||||||
|
|
||||||
<div class="list-group">
|
<div class="list-group">
|
||||||
<label class="list-group-item" v-for="layer in legendLayers">
|
<label class="list-group-item" v-for="layer in legendLayers">
|
||||||
<input
|
<input
|
||||||
@ -20,18 +19,44 @@
|
|||||||
</div>
|
</div>
|
||||||
<button class="btn btn-sm btn-outline-secondary" @click="refreshNetwork">{{ $t('action.refresh') }}</button>
|
<button class="btn btn-sm btn-outline-secondary" @click="refreshNetwork">{{ $t('action.refresh') }}</button>
|
||||||
</teleport>
|
</teleport>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
</template>
|
||||||
|
<template v-slot:body>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<template v-slot:footer>
|
||||||
|
<button class="btn btn-create" @click="modal.showModal = false">
|
||||||
|
{{ $t('action.save')}}</button>
|
||||||
|
</template>
|
||||||
|
</modal>
|
||||||
|
</teleport>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import vis from 'vis-network/dist/vis-network'
|
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'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "App",
|
name: "App",
|
||||||
|
components: {
|
||||||
|
Modal,
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
container: '',
|
container: '',
|
||||||
checkedLayers: [],
|
checkedLayers: [],
|
||||||
|
modal: {
|
||||||
|
showModal: false,
|
||||||
|
modalDialogClass: "modal-dialog-scrollable modal-md"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -81,9 +106,13 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
eventHub.on('add-relationship-link', this.addRelationshipLink)
|
eventHub.on('add-relationship-link', this.addRelationshipLink)
|
||||||
|
eventHub.on('edit-relationship-link', this.editRelationshipLink)
|
||||||
|
eventHub.on('delete-relationship-link', this.deleteRelationshipLink)
|
||||||
},
|
},
|
||||||
unmounted() {
|
unmounted() {
|
||||||
eventHub.off('add-relationship-link', this.addRelationshipLink)
|
eventHub.off('add-relationship-link', this.addRelationshipLink)
|
||||||
|
eventHub.off('edit-relationship-link', this.editRelationshipLink)
|
||||||
|
eventHub.off('delete-relationship-link', this.deleteRelationshipLink)
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
console.log('=== mounted: init graph')
|
console.log('=== mounted: init graph')
|
||||||
@ -120,12 +149,18 @@ export default {
|
|||||||
this.checkedLayers = this.checkedLayers.filter(i => i !== id)
|
this.checkedLayers = this.checkedLayers.filter(i => i !== id)
|
||||||
this.$store.commit('addExcludedNode', id)
|
this.$store.commit('addExcludedNode', id)
|
||||||
},
|
},
|
||||||
clickOnNode(callback) {
|
|
||||||
console.log('** click on node **')
|
|
||||||
window.network.on('click', callback)
|
|
||||||
},
|
|
||||||
addRelationshipLink(edgeData) {
|
addRelationshipLink(edgeData) {
|
||||||
console.log('==> addRelationshipLink <=======================', edgeData)
|
console.log('==> addRelationshipLink <=======================', edgeData)
|
||||||
|
this.modal.showModal = true
|
||||||
|
},
|
||||||
|
editRelationshipLink(edgeData) {
|
||||||
|
console.log('==> editRelationshipLink <=======================', edgeData)
|
||||||
|
this.modal.showModal = true
|
||||||
|
},
|
||||||
|
deleteRelationshipLink(edgeData) {
|
||||||
|
console.log('==> deleteRelationshipLink <=======================', edgeData)
|
||||||
|
this.modal.showModal = true
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -88,16 +88,15 @@ window.options = {
|
|||||||
initiallyActive: true,
|
initiallyActive: true,
|
||||||
addNode: function(nodeData, callback) {
|
addNode: function(nodeData, callback) {
|
||||||
console.log('addNode', nodeData)
|
console.log('addNode', nodeData)
|
||||||
nodeData.label = 'hello world'
|
//callback(nodeData) disabled
|
||||||
callback(nodeData)
|
|
||||||
},
|
},
|
||||||
editNode: function(nodeData, callback) {
|
editNode: function(nodeData, callback) {
|
||||||
console.log('editNode', nodeData)
|
console.log('editNode', nodeData)
|
||||||
callback(nodeData)
|
//callback(nodeData) disabled
|
||||||
},
|
},
|
||||||
deleteNode: function(nodeData, callback) {
|
deleteNode: function(nodeData, callback) {
|
||||||
console.log('deleteNode', nodeData)
|
console.log('deleteNode', nodeData)
|
||||||
callback(nodeData)
|
//callback(nodeData) disabled
|
||||||
},
|
},
|
||||||
addEdge: function(edgeData, callback) {
|
addEdge: function(edgeData, callback) {
|
||||||
if (
|
if (
|
||||||
@ -110,11 +109,18 @@ window.options = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
editEdge: function(edgeData, callback) {
|
editEdge: function(edgeData, callback) {
|
||||||
console.log('editNode', edgeData)
|
if (
|
||||||
callback(edgeData)
|
splitId(edgeData.from,'type') === 'person'
|
||||||
|
&& splitId(edgeData.to,'type') === 'person'
|
||||||
|
) {
|
||||||
|
console.log('editEdge', edgeData)
|
||||||
|
eventHub.emit('edit-relationship-link', edgeData)
|
||||||
|
callback(edgeData)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
deleteEdge: function(edgeData, callback) {
|
deleteEdge: function(edgeData, callback) {
|
||||||
console.log('deleteNode', edgeData)
|
console.log('deleteEdge', edgeData) // array with edges id
|
||||||
|
eventHub.emit('delete-relationship-link', edgeData)
|
||||||
callback(edgeData)
|
callback(edgeData)
|
||||||
},
|
},
|
||||||
controlNodeStyle: {
|
controlNodeStyle: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user