From 370701a82b4e9997a0f0325b383eac6fe31d39a5 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Sat, 23 May 2026 08:35:45 +0800 Subject: [PATCH] fix(connection): respect oracle driver profile hints --- .../connection/ConnectionDialog.vue | 2 +- .../desktop/src/lib/agentDriverInstallHint.ts | 4 ++- .../app-tests/agentDriverInstallHint.test.ts | 26 +++++++++++++++++++ .../app-tests/webRuntimeCompatibility.test.ts | 2 +- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vue index 9e890b006c..d77657d170 100644 --- a/apps/desktop/src/components/connection/ConnectionDialog.vue +++ b/apps/desktop/src/components/connection/ConnectionDialog.vue @@ -552,7 +552,7 @@ const canUseProxy = computed( () => form.value.db_type !== "sqlite" && form.value.db_type !== "duckdb" && form.value.db_type !== "access", ); const shouldShowAgentDriverInstallHint = computed(() => - showAgentDriverInstallHint(form.value.db_type, agentDrivers.value), + showAgentDriverInstallHint(form.value.db_type, agentDrivers.value, selectedType.value), ); const testResultMessage = computed(() => { if (!testResult.value) return ""; diff --git a/apps/desktop/src/lib/agentDriverInstallHint.ts b/apps/desktop/src/lib/agentDriverInstallHint.ts index 809bbc086c..c79cddc504 100644 --- a/apps/desktop/src/lib/agentDriverInstallHint.ts +++ b/apps/desktop/src/lib/agentDriverInstallHint.ts @@ -9,7 +9,9 @@ export interface AgentDriverInstallState { export function showAgentDriverInstallHint( dbType: DatabaseType | undefined, drivers: readonly AgentDriverInstallState[], + driverProfile?: string, ): boolean { if (!supportsDriverManagement(dbType)) return false; - return drivers.find((driver) => driver.db_type === dbType)?.installed !== true; + const driverKey = dbType === "oracle" && driverProfile === "oracle-10g" ? "oracle-10g" : dbType; + return drivers.find((driver) => driver.db_type === driverKey)?.installed !== true; } diff --git a/packages/app-tests/agentDriverInstallHint.test.ts b/packages/app-tests/agentDriverInstallHint.test.ts index 7a9788c915..30942fea0a 100644 --- a/packages/app-tests/agentDriverInstallHint.test.ts +++ b/packages/app-tests/agentDriverInstallHint.test.ts @@ -21,3 +21,29 @@ test("shows the agent driver install hint for Access when missing", () => { test("does not show agent driver install hints for built-in database types", () => { assert.equal(showAgentDriverInstallHint("mysql", [{ db_type: "informix", installed: false }]), false); }); + +test("uses the selected Oracle driver profile for install hints", () => { + assert.equal( + showAgentDriverInstallHint( + "oracle", + [ + { db_type: "oracle", installed: false }, + { db_type: "oracle-10g", installed: true }, + ], + "oracle-10g", + ), + false, + ); + assert.equal( + showAgentDriverInstallHint( + "oracle", + [ + { db_type: "oracle", installed: true }, + { db_type: "oracle-10g", installed: false }, + ], + "oracle", + ), + false, + ); + assert.equal(showAgentDriverInstallHint("oracle", [{ db_type: "oracle", installed: false }], "oracle"), true); +}); diff --git a/packages/app-tests/webRuntimeCompatibility.test.ts b/packages/app-tests/webRuntimeCompatibility.test.ts index a9acacd297..cd87bc4ed3 100644 --- a/packages/app-tests/webRuntimeCompatibility.test.ts +++ b/packages/app-tests/webRuntimeCompatibility.test.ts @@ -20,7 +20,7 @@ test("web runtime handles driver store open events", () => { }); test("web runtime can show driver install hints", () => { - assert.match(connectionDialogSource, /showAgentDriverInstallHint\(form\.value\.db_type, agentDrivers\.value\)/); + assert.match(connectionDialogSource, /showAgentDriverInstallHint\(form\.value\.db_type, agentDrivers\.value, selectedType\.value\)/); assert.doesNotMatch(connectionDialogSource, /isDesktop &&\s+showAgentDriverInstallHint/); });