fix(connection): respect oracle driver profile hints

This commit is contained in:
t8y2 2026-05-23 08:35:45 +08:00
parent 5537fa1b3c
commit 370701a82b
4 changed files with 31 additions and 3 deletions

View File

@ -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 "";

View File

@ -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;
}

View File

@ -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);
});

View File

@ -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/);
});