feat(sidebar): 添加展开全部功能并支持多语言

- 新增 loadAllObjectGroupChildren 函数以加载所有对象组子项
- 在侧边栏菜单中添加“展开全部”选项
- 更新多语言文件以支持“展开全部”文本
This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-06-26 09:54:20 +08:00
1 parent 058bbf72cc
commit ad6e13dba8
9 files changed
+51

No files matched your search

@@ -10,6 +10,7 @@ import {
Eye,
ChevronRight,
ChevronDown,
ChevronsDown,
Loader2,
FolderOpen,
FolderClosed,
@@ -599,6 +600,14 @@ async function loadMoreObjectGroupChildren() {
}
}
async function loadAllObjectGroupChildren() {
try {
await connectionStore.loadAllObjectGroupChildren(props.node);
} catch (e: any) {
toast(t("connection.connectFailed", { message: translateBackendError(t, e?.message || String(e)) }), 5000);
}
}
function visibleTreeNodes(): TreeNode[] {
if (sidebarTreeContext) return sidebarTreeContext.getVisibleNodes();
return flattenTree(connectionStore.treeNodes).map((item) => item.node);
@@ -3958,6 +3967,7 @@ function treeItemMenuItems(): ContextMenuItem[] {
// 9. Group Labels (group-columns, group-tables, etc.)
if (isGroupLabel(node)) {
const hasGroupCreateAction = (node.type === "group-tables" && canCreateTable.value) || (node.type === "group-views" && !!node.connectionId && !!node.database);
const canLoadAllObjectGroup = node.type === "group-tables" || node.type === "group-views" || node.type === "group-materialized-views";
if (node.type === "group-tables" && canCreateTable.value) {
items.push({ label: t("contextMenu.createTable"), action: createTable, icon: Plus });
}
@@ -3967,6 +3977,14 @@ function treeItemMenuItems(): ContextMenuItem[] {
if (hasGroupCreateAction) {
items.push({ label: "", separator: true });
}
if (canLoadAllObjectGroup) {
items.push({
label: t("contextMenu.expandAll"),
action: loadAllObjectGroupChildren,
icon: ChevronsDown,
disabled: node.isLoading,
});
}
if (node.type !== "group-partitions") {
items.push({
label: t("contextMenu.refreshChildren"),