Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nodenoggin vue3 duplicate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adam Procter
nodenoggin vue3 duplicate
Commits
9210e290
Commit
9210e290
authored
3 years ago
by
Adam Procter
Browse files
Options
Downloads
Plain Diff
Merge branch 'stayConnected' into main
parents
1f954112
8f0cb3a0
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/MyNodes.vue
+6
-4
6 additions, 4 deletions
src/components/MyNodes.vue
src/store/modules/mynodes.js
+23
-9
23 additions, 9 deletions
src/store/modules/mynodes.js
src/store/modules/setup.js
+5
-4
5 additions, 4 deletions
src/store/modules/setup.js
with
34 additions
and
17 deletions
src/components/MyNodes.vue
+
6
−
4
View file @
9210e290
...
@@ -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
)
{
...
...
This diff is collapsed.
Click to expand it.
src/store/modules/mynodes.js
+
23
−
9
View file @
9210e290
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
=
{}
This diff is collapsed.
Click to expand it.
src/store/modules/setup.js
+
5
−
4
View file @
9210e290
...
@@ -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
(
'
get
N
odes
'
,
null
,
{
root
:
true
})
vuexContext
.
dispatch
(
'
get
Myn
odes
'
,
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
=
{}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment