feat: improve connection and table tree UX

This commit is contained in:
SuLea-IT committed 2026-05-04 11:49:28 +08:00
1 parent efdea3b13d
commit 8bd1d4c2a8
6 files changed
+137 -28

No files matched your search

+13
View File
@@ -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";
}