Merge branch '16108-favorites' refs #16108
[arvados-workbench2.git] / src / store / tree-picker / tree-picker.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { Tree } from "~/models/tree";
6 import { TreeItemStatus } from '~/components/tree/tree';
7 export type TreePicker = { [key: string]: Tree<any> };
8
9 export const getTreePicker = <Value = {}>(id: string) => (state: TreePicker): Tree<Value> | undefined => state[id];
10
11 export const createTreePickerNode = (data: { nodeId: string, value: any }) => ({
12     ...data,
13     selected: false,
14     collapsed: true,
15     status: TreeItemStatus.INITIAL
16 });