Skip to content
Snippets Groups Projects
Commit 1f8c77c9 authored by Adam Procter's avatar Adam Procter
Browse files

Merge branch 'main' into futurenogg

parents cfa31622 9210e290
Branches
No related tags found
No related merge requests found
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<script> <script>
// @ is an alias to /src // @ is an alias to /src
import { mapState } from 'vuex' import { mapState } from 'vuex'
// import marked from 'marked' // import marked from 'marked'
export default { export default {
...@@ -42,6 +43,7 @@ export default { ...@@ -42,6 +43,7 @@ export default {
computed: { computed: {
...mapState({ ...mapState({
// TODO: Can you filter here instead ?
myNodes: (state) => state.myNodes, myNodes: (state) => state.myNodes,
}), }),
...@@ -54,6 +56,7 @@ export default { ...@@ -54,6 +56,7 @@ export default {
mounted() { mounted() {
setTimeout(this.loadData, 500) setTimeout(this.loadData, 500)
//console.log(this.microcosmName.microcosmName)
// NOT SURE THIS IS DOING ANYTHING ??? // NOT SURE THIS IS DOING ANYTHING ???
// const unwatch = this.$watch('nodesFiltered', (value) => { // const unwatch = this.$watch('nodesFiltered', (value) => {
// this.$options.myArray = this.nodesFiltered // this.$options.myArray = this.nodesFiltered
...@@ -70,7 +73,6 @@ export default { ...@@ -70,7 +73,6 @@ export default {
added: { added: {
deep: true, deep: true,
handler() { handler() {
console.log('add happened')
setTimeout(this.loadData, 500) setTimeout(this.loadData, 500)
}, },
}, },
...@@ -78,10 +80,10 @@ export default { ...@@ -78,10 +80,10 @@ export default {
methods: { methods: {
loadData() { loadData() {
console.log('loading data') // console.log('loading data')
this.myArray = this.nodesFiltered this.myArray = this.nodesFiltered
console.log(this.myArray) // console.log(this.myArray)
this.$forceUpdate() // this.$forceUpdate()
}, },
editNode(e) { editNode(e) {
......
var pouchdb var pouchdb
var deviceName var deviceName
//var microcosmName
// var e
export const state = { export const state = {
myNodes: [], myNodes: [],
activeNode: {}, activeNode: {},
lastMicrocosm: '',
lastdeviceName: '',
} }
export const mutations = { export const mutations = {
...@@ -51,6 +55,7 @@ export const mutations = { ...@@ -51,6 +55,7 @@ export const mutations = {
}) })
}) })
.catch(function (err) { .catch(function (err) {
// TODO: Does this situation ever hit 404 ?
console.log(err) console.log(err)
if (err.status == 404) { if (err.status == 404) {
var uniqueid = var uniqueid =
...@@ -75,7 +80,7 @@ export const mutations = { ...@@ -75,7 +80,7 @@ export const mutations = {
} }
}) })
}, },
GET_NODES() { GET_MY_NODES() {
// console.log('called ' + deviceName) // console.log('called ' + deviceName)
pouchdb pouchdb
.get(deviceName) .get(deviceName)
...@@ -88,9 +93,10 @@ export const mutations = { ...@@ -88,9 +93,10 @@ export const mutations = {
.catch(function (err) { .catch(function (err) {
console.log(err) console.log(err)
}) })
// TODO: Get other nodes from all other devices
}, },
// TODO: Get other nodes from all other devices
EDIT_NODE(state, e) { EDIT_NODE(state, e) {
var i var i
for (i = 0; i < Object.keys(state.myNodes).length; i++) { for (i = 0; i < Object.keys(state.myNodes).length; i++) {
...@@ -130,9 +136,8 @@ export const actions = { ...@@ -130,9 +136,8 @@ export const actions = {
commit('ADD_NODE', e) commit('ADD_NODE', e)
}, },
getNodes: ({ commit }, e) => { getMynodes: ({ commit }, e) => {
console.log('getting nodes as you added one') commit('GET_MY_NODES', e)
commit('GET_NODES', e)
}, },
editNode: ({ commit }, { nodeid, nodetext }) => { editNode: ({ commit }, { nodeid, nodetext }) => {
...@@ -140,11 +145,20 @@ export const actions = { ...@@ -140,11 +145,20 @@ export const actions = {
}, },
getMicrocosm(vuexContext) { getMicrocosm(vuexContext) {
// var lastmicrocosm = localStorage.getItem('nogg_microcosm')
// pouchdb = new PouchDB(lastmicrocosm)
// deviceName = localStorage.getItem('nogg_name')
//vuexContext.dispatch('startDB', null, { root: true })
deviceName = vuexContext.rootState.setup.deviceName deviceName = vuexContext.rootState.setup.deviceName
// microcosmName = vuexContext.rootState.setup.microcosmName
pouchdb = vuexContext.rootState.setup.pouchdb pouchdb = vuexContext.rootState.setup.pouchdb
// if (deviceName == '') {
// vuexContext.dispatch('setMicrocosm', e, { root: true })
// } else {
// //
// this.microcosm = microcosmName
// this.deviceName = deviceName
// e = (this.devicename, this.microcosm)
// // this.pouchdb = pouchdb
// }
}, },
} }
export const getters = {}
...@@ -74,7 +74,7 @@ export const actions = { ...@@ -74,7 +74,7 @@ export const actions = {
// } // }
pouchdb.replicate.from(remote).on('complete', function () { pouchdb.replicate.from(remote).on('complete', function () {
// GET_MYNODES from myNodes.js ACTION // GET_MYNODES from myNodes.js ACTION
vuexContext.dispatch('getNodes', null, { root: true }) vuexContext.dispatch('getMynodes', null, { root: true })
pouchdb pouchdb
.sync(state.remoteAddress, { .sync(state.remoteAddress, {
live: true, live: true,
...@@ -82,12 +82,12 @@ export const actions = { ...@@ -82,12 +82,12 @@ export const actions = {
retry: true, retry: true,
}) })
.on('change', function () { .on('change', function () {
console.log('change happened') // console.log('change happened')
vuexContext.dispatch('getNodes', null, { root: true }) // vuexContext.dispatch('getNodes', null, { root: true })
}) })
.on('paused', function () {}) .on('paused', function () {})
.on('active', function () { .on('active', function () {
vuexContext.dispatch('getNodes', null, { root: true }) // vuexContext.dispatch('getNodes', null, { root: true })
}) })
.on('denied', function () {}) .on('denied', function () {})
.on('complete', function () {}) .on('complete', function () {})
...@@ -97,3 +97,4 @@ export const actions = { ...@@ -97,3 +97,4 @@ export const actions = {
}) })
}, },
} }
export const getters = {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment