fix(transfer): support gbase jdbc connections

This commit is contained in:
zipg authored and GitHub committed 2026-08-31 14:03:54 +08:00
1 parent 0c8b796c8c
commit d459628141
9 files changed
+240 -13

No files matched your search

@@ -21,6 +21,7 @@ import TransferTaskTree from "@/components/transfer/TransferTaskTree.vue";
import type { DatabaseType } from "@/types/database";
import type { TransferTask, TransferTaskConfig } from "@/types/database";
import { isSchemaAware, supportsTransfer } from "@/lib/database/databaseCapabilities";
import { effectiveDatabaseTypeForConnection } from "@/lib/database/jdbcDialect";
import { isDorisFamilyCatalogCapable } from "@/lib/database/databaseFeatureSupport";
import { decodeTransferDatabaseOption, encodeTransferDatabaseOptions, isSameTransferDatabase, isTransferDatabaseSelected, normalizeTransferCatalog } from "@/lib/database/dataTransferSelection";
import { formatDatabaseLabel } from "@/lib/database/defaultDatabase";
@@ -59,7 +60,7 @@ const transferDialogStyle = {
const store = useConnectionStore();
const sqlConnections = computed(() => store.connections.filter((c) => supportsTransfer(c.db_type)));
const sqlConnections = computed(() => store.connections.filter((c) => supportsTransfer(effectiveDatabaseTypeForConnection(c))));
// Source state
const sourceConnectionId = ref("");
@@ -114,7 +115,7 @@ const treeDisabledGroups = computed<TransferObjectKind[]>(() => {
}
const sourceConfig = store.getConfig(sourceConnectionId.value);
const targetConfig = store.getConfig(targetConnectionId.value);
const allowed = crossFamilyTransferableKinds(sourceConfig?.db_type, targetConfig?.db_type);
const allowed = crossFamilyTransferableKinds(effectiveDatabaseTypeForConnection(sourceConfig), effectiveDatabaseTypeForConnection(targetConfig));
return presentKinds.filter((k) => k !== "TABLE" && !allowed.includes(k));
});
@@ -132,9 +133,9 @@ const showCrossFamilyViewHint = computed(() => {
const targetConfig = store.getConfig(targetConnectionId.value);
if (transferContent.value === "dataOnly") return false;
if (!sourceConfig || !targetConfig) return false;
const allowed = crossFamilyTransferableKinds(sourceConfig.db_type, targetConfig.db_type);
const allowed = crossFamilyTransferableKinds(effectiveDatabaseTypeForConnection(sourceConfig), effectiveDatabaseTypeForConnection(targetConfig));
if (!allowed.includes("VIEW")) return false;
return !isSameTransferFamily(sourceConfig.db_type, targetConfig.db_type) && (selectedObjects.value.VIEW?.size ?? 0) > 0;
return !isSameTransferFamily(effectiveDatabaseTypeForConnection(sourceConfig), effectiveDatabaseTypeForConnection(targetConfig)) && (selectedObjects.value.VIEW?.size ?? 0) > 0;
});
const pendingSourceSchemaPrefill = ref("");
const pendingSelectedTablesPrefill = ref<string[] | null>(null);
@@ -408,7 +409,7 @@ async function loadObjects(isCancelled: () => boolean = () => false) {
const config = store.getConfig(connectionId);
const needsSchema = isSchemaAware(config?.db_type);
const schema = needsSchema && schemaValue ? schemaValue : database;
const kinds = transferObjectKindsForDatabase(config?.db_type);
const kinds = transferObjectKindsForDatabase(effectiveDatabaseTypeForConnection(config));
const groups: Partial<Record<TransferObjectKind, string[]>> = {};
for (const kind of kinds) {
try {
@@ -67,7 +67,7 @@ describe("DataTransferDialog transfer prefill", () => {
});
it("routes table-only database kinds through the table-list request", () => {
expect(dialogSource).toContain("const kinds = transferObjectKindsForDatabase(config?.db_type)");
expect(dialogSource).toContain("const kinds = transferObjectKindsForDatabase(effectiveDatabaseTypeForConnection(config))");
expect(dialogSource).toContain("for (const kind of kinds)");
expect(dialogSource).toContain('if (kind === "TABLE")');
expect(dialogSource).toContain("await api.listTables(connectionId, database, schema");
@@ -75,7 +75,7 @@ describe("DataTransferDialog transfer prefill", () => {
it("keeps MongoDB collection loading ahead of the generic object-kind path", () => {
const mongoCollectionBranch = dialogSource.indexOf("if (isMongoConnection(connectionId))");
const genericObjectKinds = dialogSource.indexOf("const kinds = transferObjectKindsForDatabase(config?.db_type)");
const genericObjectKinds = dialogSource.indexOf("const kinds = transferObjectKindsForDatabase(effectiveDatabaseTypeForConnection(config))");
expect(mongoCollectionBranch).toBeGreaterThan(-1);
expect(dialogSource).toContain("await api.mongoListCollections(connectionId, database)");