From a6efd83268293c5a58acaac96af46e07c8e1b32b Mon Sep 17 00:00:00 2001 From: Adam Procter <adamprocter@researchnot.es> Date: Mon, 7 Dec 2020 20:35:37 +0000 Subject: [PATCH] fixes to new node rendering --- app/src/components/CardsLayer.vue | 16 +++++++++++++--- app/src/components/ListLayer.vue | 16 ++++++++++++---- app/src/components/NodesLayer.vue | 18 ++++++++++++------ app/src/components/OtherNodeslayer.vue | 8 +++++++- app/src/experimental/ModeToolbar.vue | 3 ++- app/src/views/Organise.vue | 2 ++ 6 files changed, 48 insertions(+), 15 deletions(-) diff --git a/app/src/components/CardsLayer.vue b/app/src/components/CardsLayer.vue index 0ec9a4d..3bb166b 100644 --- a/app/src/components/CardsLayer.vue +++ b/app/src/components/CardsLayer.vue @@ -1,6 +1,6 @@ <template> <div class="grid"> - <div v-for="(nodes, index) in nodes_filtered" v-bind:key="index"> + <div v-for="(nodes, index) in $options.myArray" v-bind:key="index"> <form class="nodes"> <template v-if="nodes.read_mode == false"> <textarea @@ -60,6 +60,7 @@ export default { data: function () { return { localreadmode: false, + myArray: null, } }, @@ -81,13 +82,22 @@ export default { }, // this is to stop sync chasing bug - myArray: null, - mounted() { + + created() { //access the custom option using $options + setTimeout(this.loadData, 500) this.$options.myArray = this.nodes_filtered }, + updated() { + setTimeout(this.loadData, 300) + }, + methods: { + loadData() { + this.$options.myArray = this.nodes_filtered + this.$forceUpdate() + }, editNode(e) { var nodeid = e.target.id var nodetext = e.target.value diff --git a/app/src/components/ListLayer.vue b/app/src/components/ListLayer.vue index fe48288..7ddea2a 100644 --- a/app/src/components/ListLayer.vue +++ b/app/src/components/ListLayer.vue @@ -1,6 +1,6 @@ <template> <div> - <div v-for="(nodes, index) in nodes_filtered" v-bind:key="index"> + <div v-for="(nodes, index) in $options.myArray" v-bind:key="index"> <form class="nodes"> <template v-if="nodes.read_mode == false"> <textarea @@ -61,6 +61,7 @@ export default { data: function () { return { localreadmode: false, + myArray: null, } }, @@ -73,6 +74,7 @@ export default { myNodes: (state) => state.myNodes, configPositions: (state) => state.configPositions, configEmoji: (state) => state.configEmoji, + // toolmode: (state) => state.ui.mode, }), nodes_filtered: function () { @@ -82,14 +84,20 @@ export default { }, }, - // this is to stop sync chasing bug - myArray: null, mounted() { - //access the custom option using $options + setTimeout(this.loadData, 500) this.$options.myArray = this.nodes_filtered }, + updated() { + setTimeout(this.loadData, 300) + }, + methods: { + loadData() { + this.$options.myArray = this.nodes_filtered + this.$forceUpdate() + }, editNode(e) { var nodeid = e.target.id var nodetext = e.target.value diff --git a/app/src/components/NodesLayer.vue b/app/src/components/NodesLayer.vue index 308d863..5e99922 100644 --- a/app/src/components/NodesLayer.vue +++ b/app/src/components/NodesLayer.vue @@ -172,7 +172,8 @@ export default { localreadmode: false, mode: '', nodeid: String, - // firstload: true, + myArray: null, + positionsArray: null, } }, @@ -219,25 +220,30 @@ export default { }, }, // this is to stop sync chasing bug - myArray: null, - positionsArray: null, - // NOTE: ok as created here but NOT if this is the first view to load + created() { //access the custom option using $options + setTimeout(this.loadData, 2000) this.$options.myArray = this.nodes_filtered this.$options.positionsArray = this.positions_filtered }, updated() { this.$options.positionsArray = this.positions_filtered - + if (this.toolmode == 'addNode') { - this.$options.myArray = this.nodes_filtered + setTimeout(this.loadData, 300) + // this.$options.myArray = this.nodes_filtered this.$store.commit('ui/setMode', 'select') } }, methods: { + loadData() { + this.$options.myArray = this.nodes_filtered + this.$options.positionsArray = this.positions_filtered + this.$forceUpdate() + }, onActivated(e) { this.nodeid = e var i diff --git a/app/src/components/OtherNodeslayer.vue b/app/src/components/OtherNodeslayer.vue index 4bea445..6fb64f6 100644 --- a/app/src/components/OtherNodeslayer.vue +++ b/app/src/components/OtherNodeslayer.vue @@ -240,6 +240,8 @@ export default { search: '', pickupz: 1, nodeid: String, + + positionsArray: null, } }, @@ -272,10 +274,10 @@ export default { }, }, - positionsArray: null, // NOTE: ok as created here but NOT if this is the first view to load created() { //access the custom option using $options + setTimeout(this.loadData, 1000) this.$options.positionsArray = this.positions_filtered }, @@ -284,6 +286,10 @@ export default { }, methods: { + loadData() { + this.$options.positionsArray = this.positions_filtered + this.$forceUpdate() + }, onActivated(e) { this.nodeid = e var i diff --git a/app/src/experimental/ModeToolbar.vue b/app/src/experimental/ModeToolbar.vue index 103cefc..57b1e74 100644 --- a/app/src/experimental/ModeToolbar.vue +++ b/app/src/experimental/ModeToolbar.vue @@ -49,7 +49,8 @@ export default { } } if (mode == 'addNode') { - this.$store.dispatch('addNode') + this.$emit('add-node') + // this.$store.dispatch('addNode') } if (mode == 'upload') { this.$emit('upload-added') diff --git a/app/src/views/Organise.vue b/app/src/views/Organise.vue index 77df061..f0325ac 100644 --- a/app/src/views/Organise.vue +++ b/app/src/views/Organise.vue @@ -61,6 +61,7 @@ @copy-done="copyDone()" @draw-on="drawOn()" @draw-off="drawOff()" + @add-node="addNode()" /> <ViewToolbar /> <UploadLayer @@ -192,6 +193,7 @@ export default { // This is here to support the shortcuts addNode() { this.$store.dispatch('addNode') + this.$forceUpdate() }, selectMode(mode) { this.$store.commit('ui/setMode', mode) -- GitLab