Attach isLeaf info (#260)

This commit is contained in:
Chenlei Hu
2024-07-29 17:49:57 -04:00
committed by GitHub
parent 7d75cc99ba
commit 73f4e5143d
2 changed files with 7 additions and 6 deletions

View File

@@ -260,6 +260,7 @@ export const useNodeDefStore = defineStore('nodeDef', {
const root: TreeNode = {
key: 'root',
label: 'Nodes',
leaf: false,
children: []
}
for (const nodeDef of Object.values(state.nodeDefsByName)) {
@@ -270,7 +271,7 @@ export const useNodeDefStore = defineStore('nodeDef', {
key += `/${part}`
let next = current.children.find((child) => child.label === part)
if (!next) {
next = { key, label: part, children: [] }
next = { key, label: part, children: [], leaf: false }
current.children.push(next)
}
current = next
@@ -278,7 +279,8 @@ export const useNodeDefStore = defineStore('nodeDef', {
current.children.push({
label: nodeDef.display_name,
data: nodeDef,
key: `${key}/${nodeDef.name}`
key: `${key}/${nodeDef.name}`,
leaf: true
})
}
return root