25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(import): hide the data-tab import entry for unsupported engines
Abeautifulsnow8d32cf9ffae6
diff --git a/apps/desktop/src/components/layout/ContentArea.vue b/apps/desktop/src/components/layout/ContentArea.vueindex e5af3cdbf1..41d2dc4a26 100644--- a/apps/desktop/src/components/layout/ContentArea.vue+++ b/apps/desktop/src/components/layout/ContentArea.vue@@ -157,6 +157,7 @@ import { dataTabExecutionDatabase } from "@/lib/table/dataTabExecutionDatabase";import { formatShortcut } from "@/lib/editor/shortcutRegistry";import type { CodeMirrorSqlDialectName } from "@/lib/editor/codemirrorSqlDialect";import { codeMirrorSqlDialect, codeMirrorSqlDialectForConnection, effectiveDatabaseTypeForConnection } from "@/lib/database/jdbcDialect";+import { supportsTableImport } from "@/lib/database/databaseFeatureSupport";import { chartableColumnIndexes } from "@/lib/dataGrid/chartData";import { elasticsearchJsonResponseForResult } from "@/lib/elasticsearch/elasticsearchJsonResponse";import { elasticsearchProfileBodyForResult, parseElasticsearchProfile } from "@/lib/elasticsearch/elasticsearchProfile";@@ -337,6 +338,8 @@ const activeResultConnectionId = computed(() => activeResultExecutionTarget.valuconst activeResultDatabase = computed(() => activeResultExecutionTarget.value?.database ?? props.activeTab.database);const activeResultSchema = computed(() => activeResultExecutionTarget.value?.schema ?? props.activeTab.schema);const activeEffectiveDatabaseType = computed(() => effectiveDatabaseTypeForConnection(activeResultConnection.value));+// 表数据工具箱的「导入数据」与侧边栏、对象浏览器共用同一条能力判断:未适配导入的引擎(如 HANA)不出现入口。+const canOpenTableImport = computed(() => supportsTableImport(activeEffectiveDatabaseType.value));const activeVectorConnection = computed(() => connectionStore.getConfig(props.activeTab.connectionId) ?? props.activeConnection);const activeDataTabExecutionDatabase = computed(() => dataTabExecutionDatabase(props.activeConnection, props.activeTab.database, activeDataTabTableMeta.value?.catalog));const activeProductionContext = computed(() => productionContextForDatabase(props.activeConnection, props.activeTab.database));@@ -2079,7 +2082,7 @@ defineExpose({<Database class="h-4 w-4" />{{ t("tableToolbox.generateData") }}</DropdownMenuItem>- <DropdownMenuItem class="gap-2" @click="handleTableImport">+ <DropdownMenuItem v-if="canOpenTableImport" class="gap-2" @click="handleTableImport"><Download class="h-4 w-4" />{{ t("tableToolbox.importData") }}</DropdownMenuItem>diff --git a/apps/desktop/src/components/layout/__tests__/ContentArea.tableImportEntry.spec.ts b/apps/desktop/src/components/layout/__tests__/ContentArea.tableImportEntry.spec.tsnew file mode 100644index 0000000000..f476e24e0b--- /dev/null+++ b/apps/desktop/src/components/layout/__tests__/ContentArea.tableImportEntry.spec.ts@@ -0,0 +1,32 @@+import { readFileSync } from "node:fs";+import { describe, expect, it } from "vitest";++function read(relativePath: string) {+ return readFileSync(new URL(relativePath, import.meta.url), "utf8");+}++// 能打开「导入表数据」向导的三个入口。侧边栏的守卫在菜单宿主(SidebarTreeRuntimeHost.vue)里,+// 写入函数 composables/useSidebarTreeToolRuntime.ts 本身不带守卫,所以这里列的是入口界面而不是写入点。+const TABLE_IMPORT_ENTRY_SURFACES = ["../ContentArea.vue", "../../objects/ObjectBrowser.vue", "../../sidebar/SidebarTreeRuntimeHost.vue"];++describe("ContentArea table import entry", () => {+ it("gates the data-tab toolbox import item on the shared capability check", () => {+ const source = read("../ContentArea.vue");+ // HANA 的能力清单是 tableImport:false。入口不跟能力走时,向导仍能打开并停在「选项」步:+ // 目标表字段元数据取不回来,下一步恒为禁用(QA #hana-import 的复现路径)。+ expect(source).toContain("const canOpenTableImport = computed(");+ expect(source).toContain("supportsTableImport(activeEffectiveDatabaseType.value)");++ const item = source.indexOf('t("tableToolbox.importData")');+ expect(item).toBeGreaterThan(-1);+ const openTag = source.lastIndexOf("<DropdownMenuItem", item);+ expect(openTag).toBeGreaterThan(-1);+ expect(source.slice(openTag, item)).toContain('v-if="canOpenTableImport"');+ });++ it("keeps every entry surface consulting the same capability", () => {+ for (const surface of TABLE_IMPORT_ENTRY_SURFACES) {+ expect(read(surface), surface).toContain("supportsTableImport");+ }+ });+});