15407: Fixes node's properties & info handling.
[arvados-workbench2.git] / src / models / tree.ts
index 8b71692b1c8bf8211c606573f99a8876a6392aab..60a95342eedbbe6b8337f16c84ea896e6f978dcd 100644 (file)
@@ -27,7 +27,8 @@ export enum TreeNodeStatus {
 export enum TreePickerId {
     PROJECTS = 'Projects',
     SHARED_WITH_ME = 'Shared with me',
-    FAVORITES = 'Favorites'
+    FAVORITES = 'Favorites',
+    PUBLIC_FAVORITES = 'Public Favorites'
 }
 
 export const createTree = <T>(): Tree<T> => ({});
@@ -98,6 +99,9 @@ export const getNodeDescendants = (id: string, limit = Infinity) => <T>(tree: Tr
 export const countNodes = <T>(tree: Tree<T>) =>
     getNodeDescendantsIds('')(tree).length;
 
+export const countChildren = (id: string) => <T>(tree: Tree<T>) =>
+    getNodeChildren('')(tree).length;
+
 export const getNodeDescendantsIds = (id: string, limit = Infinity) => <T>(tree: Tree<T>): string[] => {
     const node = getNode(id)(tree);
     const children = node ? node.children :