fix(export): show all dameng databases in export dropdown

This commit is contained in:
高桥凉介 authored and GitHub committed 2026-08-07 13:48:10 +08:00
1 parent 143fd96c3f
commit 9bb1b7aa91
10 files changed
+143 -33

No files matched your search

@@ -177,16 +177,17 @@ describe("namespace options", () => {
expect(namespaceOptionsAreSchemas({ db_type: "postgres" })).toBe(false);
});
it("does not expand the global database options composable to Dameng schemas", async () => {
it("expands Dameng schemas via listSchemas", async () => {
mocks.getConfig.mockReturnValue({ db_type: "dameng" });
mocks.listDatabases.mockResolvedValue([]);
mocks.listSchemas.mockResolvedValue(["APP_USER", "REPORTING", "SYS"]);
const { databaseOptions, loadDatabaseOptions } = useDatabaseOptions();
await loadDatabaseOptions("connection-1");
expect(databaseOptions.value["connection-1"]).toEqual([]);
expect(mocks.listDatabases).toHaveBeenCalledWith("connection-1");
expect(mocks.listSchemas).not.toHaveBeenCalled();
// 达梦现在通过 listSchemas 获取 schema 列表,SYS 作为系统 schema 被过滤掉
expect(databaseOptions.value["connection-1"]).toEqual(["APP_USER", "REPORTING"]);
expect(mocks.listSchemas).toHaveBeenCalledWith("connection-1", "", true);
expect(mocks.listDatabases).not.toHaveBeenCalled();
});
});
@@ -96,6 +96,9 @@ export function useDatabaseOptions() {
);
} else if (connection.db_type === "mongodb") {
databaseOptions.value[connectionId] = filterDatabaseNamesForConnection(await api.mongoListDatabases(connectionId), connection);
} else if (connection.db_type === "dameng") {
// 达梦的"数据库"概念对应 schema,使用 listSchemas 获取 schema 列表
databaseOptions.value[connectionId] = await fetchNamespaceOptionsForConnection(connectionId, connection);
} else if (catalog && isDorisFamilyCatalogCapable(connection?.db_type, connection?.driver_profile)) {
const dbs = await api.listDorisCatalogDatabases(connectionId, catalog);
databaseOptions.value[connectionId] = databaseOptionsForConnection(