wip
This commit is contained in:
parent
9a164b984a
commit
5c2842c995
8 changed files with 330 additions and 26 deletions
|
|
@ -8,12 +8,13 @@ const html = htm.bind(h)
|
|||
export class Notes2 {
|
||||
constructor() {//{{{
|
||||
this.startNode = null
|
||||
this.tree = createRef()
|
||||
this.setStartNode()
|
||||
}//}}}
|
||||
render() {//{{{
|
||||
return html`
|
||||
<button onclick=${()=>API.logout()}>Log out</button>
|
||||
<${Tree} app=${this} />
|
||||
<button onclick=${() => API.logout()}>Log out</button>
|
||||
<${Tree} ref=${this.tree} app=${this} />
|
||||
`
|
||||
}//}}}
|
||||
setStartNode() {//{{{
|
||||
|
|
@ -26,7 +27,8 @@ export class Notes2 {
|
|||
const req = {}
|
||||
API.query('POST', '/node/tree', req)
|
||||
.then(response => {
|
||||
console.log(response)
|
||||
console.log(response.Nodes)
|
||||
nodeStore.add(response.Nodes)
|
||||
})
|
||||
.catch(e => console.log(e.type, e.error))
|
||||
}
|
||||
|
|
@ -51,8 +53,7 @@ class Tree extends Component {
|
|||
}//}}}
|
||||
|
||||
retrieve(callback = null) {//{{{
|
||||
const req = { StartNodeID: 0 }
|
||||
API.query('POST', '/node/tree', req)
|
||||
nodeStore.getTreeNodes()
|
||||
.then(res => {
|
||||
this.treeNodes = {}
|
||||
this.treeNodeComponents = {}
|
||||
|
|
@ -63,7 +64,7 @@ class Tree extends Component {
|
|||
// returned from the server to be sorted in such a way that
|
||||
// a parent node always appears before a child node.
|
||||
// The server uses a recursive SQL query delivering this.
|
||||
res.Nodes.forEach(nodeData => {
|
||||
res.forEach(nodeData => {
|
||||
let node = new Node(
|
||||
this,
|
||||
nodeData.ID,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue