From 9ef30e7f4da5cd503c182112456d9c2c205279d6 Mon Sep 17 00:00:00 2001 From: zipg Date: Tue, 14 Jul 2026 17:12:21 +0800 Subject: [PATCH] fix(gbase): detect offline GBase 8a driver --- .../lib/connection/agentDriverInstallHint.ts | 1 + .../app-tests/agentDriverInstallHint.test.ts | 22 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/lib/connection/agentDriverInstallHint.ts b/apps/desktop/src/lib/connection/agentDriverInstallHint.ts index 7318dfe348..53c7ddd4c4 100644 --- a/apps/desktop/src/lib/connection/agentDriverInstallHint.ts +++ b/apps/desktop/src/lib/connection/agentDriverInstallHint.ts @@ -11,6 +11,7 @@ export function agentDriverInstallKey(dbType: DatabaseType | undefined, driverPr if (dbType === "oracle") return "oracle"; if (dbType === "mongodb") return "mongodb"; if (dbType === "dameng") return "dameng"; + if (dbType === "gbase") return driverProfile === "gbase8s" ? "gbase8s" : "gbase8a"; if (dbType === "mq") return driverProfile === "kafka" ? "kafka" : undefined; return driverProfile && driverProfile !== dbType ? driverProfile : dbType; } diff --git a/packages/app-tests/agentDriverInstallHint.test.ts b/packages/app-tests/agentDriverInstallHint.test.ts index 47532cd6a0..d8db77f953 100644 --- a/packages/app-tests/agentDriverInstallHint.test.ts +++ b/packages/app-tests/agentDriverInstallHint.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { appendAgentDriverUpdateHint, hasAgentDriverUpdate, showAgentDriverInstallHint } from "../../apps/desktop/src/lib/connection/agentDriverInstallHint.ts"; +import { agentDriverInstallKey, appendAgentDriverUpdateHint, hasAgentDriverUpdate, showAgentDriverInstallHint } from "../../apps/desktop/src/lib/connection/agentDriverInstallHint.ts"; test("hides the agent driver install hint when the selected driver is installed", () => { assert.equal(showAgentDriverInstallHint("informix", [{ db_type: "informix", installed: true }]), false); @@ -29,7 +29,25 @@ test("uses the unified Oracle driver for legacy Oracle profiles", () => { assert.equal(showAgentDriverInstallHint("oracle", [{ db_type: "oracle", installed: false }], "oracle"), true); }); -test("uses selected non-Oracle agent driver profiles for install hints", () => { +test("uses the GBase 8a agent for generic, missing, and explicit 8a profiles", () => { + const drivers = [ + { db_type: "gbase8a", installed: true }, + { db_type: "gbase8s", installed: false }, + ]; + + assert.equal(showAgentDriverInstallHint("gbase", drivers), false); + assert.equal(showAgentDriverInstallHint("gbase", drivers, "gbase"), false); + assert.equal(showAgentDriverInstallHint("gbase", drivers, "gbase8a"), false); +}); + +test("maps GBase profiles to their matching agent driver keys", () => { + assert.equal(agentDriverInstallKey("gbase"), "gbase8a"); + assert.equal(agentDriverInstallKey("gbase", "gbase"), "gbase8a"); + assert.equal(agentDriverInstallKey("gbase", "gbase8a"), "gbase8a"); + assert.equal(agentDriverInstallKey("gbase", "gbase8s"), "gbase8s"); +}); + +test("uses the selected GBase 8s agent for install hints", () => { assert.equal( showAgentDriverInstallHint( "gbase",