More work on special pages
This commit is contained in:
parent
da7999fb24
commit
15bd742ef7
3 changed files with 158 additions and 69 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { ROOT_NODE, ORPHANED_NODE , DELETED_NODE} from 'node_store'
|
||||
import { ROOT_NODE, ORPHANED_NODE, DELETED_NODE } from 'node_store'
|
||||
import { Node } from 'node'
|
||||
import { CustomHTMLElement } from './lib/custom_html_element.mjs'
|
||||
import { Color, Solver } from './lib/css_colorize.mjs'
|
||||
|
|
@ -161,11 +161,22 @@ export class N2Sidebar extends CustomHTMLElement {
|
|||
const deletednode = await nodeStore.get(DELETED_NODE)
|
||||
const deletedtreenode = new SpecialNodeDeleted(this, deletednode, null)
|
||||
|
||||
const orphanednode = await nodeStore.get(ORPHANED_NODE)
|
||||
const orphanedtreenode = new SpecialNodeOrphaned(this, orphanednode, null)
|
||||
|
||||
startnode._sibling_after = deletednode
|
||||
deletednode._sibling_before = startnode
|
||||
|
||||
deletednode._sibling_after = orphanednode
|
||||
orphanednode._sibling_before = deletednode
|
||||
|
||||
this.treeNodeComponents[startnode.UUID] = starttreenode
|
||||
this.treeNodeComponents[deletednode.UUID] = deletedtreenode
|
||||
this.treeNodeComponents[orphanednode.UUID] = orphanedtreenode
|
||||
|
||||
this.elTreenodes.appendChild(await starttreenode.render())
|
||||
this.elTreenodes.appendChild(await deletedtreenode.render())
|
||||
this.elTreenodes.appendChild(await orphanedtreenode.render())
|
||||
|
||||
// Notify the application that the initial tree is rendered (with children)
|
||||
// and that initial node selection can take place. App will check URL to
|
||||
|
|
@ -677,11 +688,16 @@ export class N2TreeNode extends CustomHTMLElement {
|
|||
if (this.node.UUID === ROOT_NODE)
|
||||
this.setImgSrc(this.elExpand, `/images/${window._VERSION}/icon_home.svg`)
|
||||
|
||||
else if (this.node.UUID === '00000000-0000-0000-0000-000000000002') {
|
||||
else if (this.node.UUID === DELETED_NODE) {
|
||||
this.setImgSrc(this.elExpand, `/images/${window._VERSION}/leaf_deleted.svg`)
|
||||
this.elExpand.classList.add('deleted')
|
||||
}
|
||||
|
||||
else if (this.node.UUID === ORPHANED_NODE) {
|
||||
this.setImgSrc(this.elExpand, `/images/${window._VERSION}/leaf_orphaned.svg`)
|
||||
this.elExpand.classList.add('deleted')
|
||||
}
|
||||
|
||||
else if (!this.node.hasChildren())
|
||||
this.setImgSrc(this.elExpand, `/images/${window._VERSION}/leaf.svg`)
|
||||
else if (this.sidebar.getNodeExpanded(this.node.UUID))
|
||||
|
|
@ -724,8 +740,16 @@ class SpecialNodeDeleted extends N2TreeNode {
|
|||
}//}}}
|
||||
}
|
||||
|
||||
class SpecialNodeOrphaned extends N2TreeNode {
|
||||
constructor(sidebar, node, parent) {//{{{
|
||||
super(sidebar, node, parent)
|
||||
this.removeAttribute('draggable')
|
||||
}//}}}
|
||||
}
|
||||
|
||||
customElements.define('n2-sidebar', N2Sidebar)
|
||||
customElements.define('n2-treenode', N2TreeNode)
|
||||
customElements.define('n2-specialnodedeleted', SpecialNodeDeleted)
|
||||
customElements.define('n2-specialnodeorphaned', SpecialNodeOrphaned)
|
||||
|
||||
// vim: foldmethod=marker
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue