Skip to content
Snippets Groups Projects
Commit 2984b526 authored by ap2x07's avatar ap2x07
Browse files

more on node adding

parent 99f0d3ed
Branches
No related tags found
No related merge requests found
...@@ -28,7 +28,7 @@ export default { ...@@ -28,7 +28,7 @@ export default {
}), }),
shortcuts('c', function () { shortcuts('c', function () {
// c key was pressed // c key was pressed
console.log('connection mode') console.log('c key was pressed')
}), }),
], ],
......
<template> <template>
<div v-for="(nodes, index) in myArray" v-bind:key="index"> <div v-for="(nodes, index) in myArray" v-bind:key="index">
<form class="nodes"> <form class="nodes">
<p>{{ nodes.node_id }}</p>
<template v-if="nodes.node_readmode == false"> <template v-if="nodes.node_readmode == false">
<textarea <textarea
v-model="nodes.node_text" v-model="nodes.node_text"
...@@ -100,4 +98,8 @@ export default { ...@@ -100,4 +98,8 @@ export default {
margin-top: 1em; margin-top: 1em;
margin-left: 0.5em; margin-left: 0.5em;
} }
textarea {
width: 95%;
}
</style> </style>
...@@ -43,6 +43,7 @@ export const mutations = { ...@@ -43,6 +43,7 @@ export const mutations = {
// this was to set quick focus on new nodes // this was to set quick focus on new nodes
// i think... need to check old code // i think... need to check old code
state.activeNode = newNode state.activeNode = newNode
this.getNodes()
}) })
}) })
.catch(function (err) { .catch(function (err) {
...@@ -76,6 +77,7 @@ export const mutations = { ...@@ -76,6 +77,7 @@ export const mutations = {
}) })
}, },
GET_NODES() { GET_NODES() {
// console.log('called ' + deviceName)
pouchdb pouchdb
.get(deviceName) .get(deviceName)
.then(function (doc) { .then(function (doc) {
...@@ -137,7 +139,11 @@ export const actions = { ...@@ -137,7 +139,11 @@ export const actions = {
}, },
getMicrocosm(vuexContext) { getMicrocosm(vuexContext) {
pouchdb = vuexContext.rootState.setup.pouchdb // 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
pouchdb = vuexContext.rootState.setup.pouchdb
}, },
} }
...@@ -14,6 +14,9 @@ export const mutations = { ...@@ -14,6 +14,9 @@ export const mutations = {
SET_MICROCOSM(state, e) { SET_MICROCOSM(state, e) {
state.deviceName = e.devicename state.deviceName = e.devicename
state.microcosmName = e.microcosm state.microcosmName = e.microcosm
// if (state.microcosmName == '') {
// console.log('empty')
// }
pouchdb = new PouchDB(state.microcosmName) pouchdb = new PouchDB(state.microcosmName)
state.pouchdb = pouchdb state.pouchdb = pouchdb
...@@ -65,11 +68,15 @@ export const actions = { ...@@ -65,11 +68,15 @@ export const actions = {
}, },
startDB: (vuexContext) => { startDB: (vuexContext) => {
// if (pouchdb == undefined) {
// var lastmicrocosm = localStorage.getItem('nogg_microcosm')
// pouchdb = new PouchDB(lastmicrocosm)
// }
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('getNodes', null, { root: true })
pouchdb pouchdb
.sync(remote, { .sync(state.remoteAddress, {
live: true, live: true,
since: 'now', since: 'now',
retry: true, retry: true,
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment