feat: improve connection and table tree UX
This commit is contained in:
1 parent
efdea3b13d
commit
8bd1d4c2a8
6 files changed
+137
-28
No files matched your search
@@ -0,0 +1,13 @@
|
||||
import type { TreeNodeType } from "@/types/database";
|
||||
|
||||
export type TreeNodeRowAction = "open-data" | "toggle" | "none";
|
||||
|
||||
const dataNodeTypes = new Set<TreeNodeType>(["table", "view"]);
|
||||
const toggleLeafNodeTypes = new Set<TreeNodeType>(["redis-db", "mongo-collection"]);
|
||||
|
||||
export function treeNodeRowAction(type: TreeNodeType, canExpand: boolean): TreeNodeRowAction {
|
||||
if (dataNodeTypes.has(type)) return "open-data";
|
||||
if (toggleLeafNodeTypes.has(type)) return "toggle";
|
||||
if (canExpand) return "toggle";
|
||||
return "none";
|
||||
}
|
||||
Reference in new issue
Block a user