From 61bd3cdf6243c1525b1ccdfa30c53e086e720d86 Mon Sep 17 00:00:00 2001 From: onenewcode Date: Fri, 11 Sep 2026 13:24:41 +0800 Subject: [PATCH] feat(elasticsearch): show index aliases on sidebar rows --- .../src/components/sidebar/TreeItem.vue | 17 +- apps/desktop/src/i18n/locales/az.ts | 1 + apps/desktop/src/i18n/locales/en.ts | 1 + apps/desktop/src/i18n/locales/es.ts | 1 + apps/desktop/src/i18n/locales/it.ts | 1 + apps/desktop/src/i18n/locales/ja.ts | 1 + apps/desktop/src/i18n/locales/ko.ts | 1 + apps/desktop/src/i18n/locales/pt-BR.ts | 1 + apps/desktop/src/i18n/locales/tr.ts | 1 + apps/desktop/src/i18n/locales/zh-CN.ts | 1 + apps/desktop/src/i18n/locales/zh-TW.ts | 1 + apps/desktop/src/lib/backend/http.ts | 2 +- apps/desktop/src/lib/backend/tauri.ts | 2 +- .../elasticsearchIndexActions.spec.ts | 8 +- .../lib/sidebar/elasticsearchIndexActions.ts | 7 +- .../connectionStore.elasticsearchOpen.spec.ts | 84 ++++- apps/desktop/src/stores/connectionStore.ts | 25 +- apps/desktop/src/types/database.ts | 1 + crates/dbx-core/src/db/easysearch_driver.rs | 6 + .../dbx-core/src/db/elasticsearch_driver.rs | 298 ++++++++++++++++-- crates/dbx-core/src/db/vector_driver.rs | 2 + crates/dbx-core/src/document_ops.rs | 21 +- 22 files changed, 432 insertions(+), 51 deletions(-) diff --git a/apps/desktop/src/components/sidebar/TreeItem.vue b/apps/desktop/src/components/sidebar/TreeItem.vue index 4f327d8f5e..e4d1a3596f 100644 --- a/apps/desktop/src/components/sidebar/TreeItem.vue +++ b/apps/desktop/src/components/sidebar/TreeItem.vue @@ -90,6 +90,7 @@ import { focusSidebarRenameInput } from "@/lib/sidebar/sidebarRenameFocus"; import { ensureSqlExtension, stripSqlExtension } from "@/lib/savedSql/savedSqlFileName"; import { savedSqlErrorMessage } from "@/lib/savedSql/savedSqlErrors"; import { useSavedSqlStore } from "@/stores/savedSqlStore"; +import { elasticsearchIndexAliasLabel } from "@/lib/sidebar/elasticsearchIndexActions"; import { isXuguPublicSynonymTreeNode, isXuguSchedulerJobTreeNode, xuguSchemaDisplayName } from "@/lib/sidebar/xuguPublicSynonyms"; import { xuguDatafileDetailRows, xuguTablespaceDetailRows } from "@/lib/sidebar/xuguTablespaces"; // --- Drag and Drop --- @@ -442,6 +443,7 @@ function treeNodeSecondaryValue(node: TreeNode): string | undefined { if (node.type === "type" && node.customTypeKind) return t(`customType.kinds.${node.customTypeKind}`); if (node.type === "type-member") return (node.meta as CustomTypeTreeMemberMeta | undefined)?.displayValue; if (node.type === "datafile") return node.xuguDatafilePath; + if (node.type === "elasticsearch-index") return elasticsearchIndexAliasLabel(node); return undefined; } @@ -604,6 +606,16 @@ const detailTooltip = computed(() => { })); return rows.length ? { rows } : null; } + if (node.type === "elasticsearch-index") { + const aliases = elasticsearchIndexAliasLabel(node); + if (!aliases) return null; + return { + rows: [ + { label: t("objects.name"), value: visibleLabel(node) }, + { label: t("tree.elasticsearchAlias"), value: aliases }, + ], + }; + } const comment = node.type === "column" && node.meta && "comment" in node.meta ? (node.meta as ColumnInfo).comment : node.comment; if (!comment || (node.type !== "schema" && node.type !== "table" && node.type !== "view" && node.type !== "column")) return null; const rows: DetailTooltipRow[] = [ @@ -1567,7 +1579,10 @@ function onKeydown(event: KeyboardEvent) { ]" >{{ visibleLabel(node) }} - {{ treeNodeSecondaryValue(node) }} + + + {{ treeNodeSecondaryValue(node) }} +