From c819885d2e5442ea600ea4809bb6fded90b4e3c1 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Mon, 6 Jul 2026 14:34:58 +0800 Subject: [PATCH] feat(docs): add JDBC plugin offline download --- docs/app/[lang]/drivers/DriversClient.tsx | 62 +++++++++++++++++++++-- docs/lib/agentRegistry.test.ts | 13 +++++ docs/lib/agentRegistry.ts | 17 +++++++ 3 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 docs/lib/agentRegistry.test.ts diff --git a/docs/app/[lang]/drivers/DriversClient.tsx b/docs/app/[lang]/drivers/DriversClient.tsx index 61f31c0ad..222670b7a 100644 --- a/docs/app/[lang]/drivers/DriversClient.tsx +++ b/docs/app/[lang]/drivers/DriversClient.tsx @@ -4,12 +4,16 @@ import { useCallback, useEffect, useMemo, useState } from "react"; import { useParams } from "next/navigation"; import { LandingNav } from "@/components/landing/LandingNav"; import { fetchAgentDownloadCatalog, formatSize, type AgentDownloadCatalog, type JreDisplayEntry, type NativeAgentDisplayEntry, type OfflineBundleEntry } from "@/lib/agentRegistry"; -import { AlertTriangle, Archive, Cpu, Database, Download, Loader2, Search, Terminal, X } from "lucide-react"; +import { AlertTriangle, Archive, Cpu, Database, Download, Loader2, Plug, Search, Terminal, X } from "lucide-react"; const i18n = { en: { title: "Offline Driver Downloads", subtitle: "Download database drivers and JRE packages for offline use. Search for the exact resource your air-gapped environment needs.", + jdbcPlugin: "JDBC Plugin", + jdbcPluginDesc: "Install this optional DBX sidecar before using custom JDBC connections. Database vendor JDBC driver JARs still need to be imported separately.", + jdbcPluginFile: "Plugin package", + jdbcPluginInstallHint: "Import this ZIP in DBX from Settings > Driver Manager > JDBC Drivers > Local Install.", bundles: "Offline Bundles", bundlesDesc: "Platform-specific ZIP packages that include the agent registry, database drivers, native agents, and the matching JRE.", drivers: "Database Drivers", @@ -22,6 +26,7 @@ const i18n = { error: "Unable to load driver catalog. Please check your network connection.", retry: "Retry", download: "Download", + installMethod: "Install", version: "Version", size: "Size", requiresJre: "Requires JRE", @@ -37,6 +42,10 @@ const i18n = { cn: { title: "离线驱动下载", subtitle: "下载数据库驱动和 JRE 离线包。搜索内网环境需要的资源,在有网机器下载后传输。", + jdbcPlugin: "JDBC 插件", + jdbcPluginDesc: "使用自定义 JDBC 连接前先安装这个 DBX 可选插件。数据库厂商的 JDBC Driver JAR 仍需单独导入。", + jdbcPluginFile: "插件包", + jdbcPluginInstallHint: "在 DBX 的“设置 > 驱动管理 > JDBC 驱动 > 本地安装”中导入这个 ZIP。", bundles: "整包下载", bundlesDesc: "按平台提供的 ZIP 离线包,包含 Agent registry、数据库驱动、原生 Agent 和匹配的 JRE。", drivers: "数据库驱动", @@ -49,6 +58,7 @@ const i18n = { error: "加载驱动列表失败,请检查网络连接。", retry: "重试", download: "下载", + installMethod: "安装方式", version: "版本", size: "大小", requiresJre: "依赖 JRE", @@ -63,7 +73,7 @@ const i18n = { }, }; -type ActiveTab = "bundles" | "drivers" | "native" | "jre"; +type ActiveTab = "bundles" | "drivers" | "native" | "jre" | "jdbcPlugin"; function platformKey(j: JreDisplayEntry): string { return `${j.jreKey}-${j.platformKey}`; @@ -127,6 +137,7 @@ export function DriversClient() { const drivers = catalog?.drivers ?? []; const nativeAgents = catalog?.nativeAgents ?? []; const jres = catalog?.jres ?? []; + const jdbcPlugin = catalog?.jdbcPlugin; const normalizedSearch = searchQuery.trim().toLowerCase(); const filteredBundles = useMemo(() => bundles.filter((bundle) => matchesSearch([bundle.platformLabel, bundle.platformKey, bundle.filename, formatSize(bundle.size)], normalizedSearch)), [bundles, normalizedSearch]); @@ -179,9 +190,10 @@ export function DriversClient() { ); const filteredJres = useMemo(() => jres.filter((j) => matchesSearch([j.platformLabel, j.platformKey, j.jreVersion, j.jreKey, formatSize(j.info.size)], normalizedSearch)), [jres, normalizedSearch]); + const filteredJdbcPlugin = useMemo(() => (jdbcPlugin && matchesSearch([jdbcPlugin.label, jdbcPlugin.filename, jdbcPlugin.url, t.jdbcPlugin, t.jdbcPluginDesc], normalizedSearch) ? [jdbcPlugin] : []), [jdbcPlugin, normalizedSearch, t.jdbcPlugin, t.jdbcPluginDesc]); - const activeCount = activeTab === "bundles" ? filteredBundles.length : activeTab === "drivers" ? filteredDrivers.length : activeTab === "native" ? filteredNativeGroups.length : filteredJres.length; - const activeTotal = activeTab === "bundles" ? bundles.length : activeTab === "drivers" ? drivers.length : activeTab === "native" ? nativeGroups.length : jres.length; + const activeCount = activeTab === "bundles" ? filteredBundles.length : activeTab === "drivers" ? filteredDrivers.length : activeTab === "native" ? filteredNativeGroups.length : activeTab === "jre" ? filteredJres.length : filteredJdbcPlugin.length; + const activeTotal = activeTab === "bundles" ? bundles.length : activeTab === "drivers" ? drivers.length : activeTab === "native" ? nativeGroups.length : activeTab === "jre" ? jres.length : jdbcPlugin ? 1 : 0; return (
@@ -242,6 +254,10 @@ export function DriversClient() { {t.jre} +
@@ -265,6 +281,44 @@ export function DriversClient() {
+ {activeTab === "jdbcPlugin" && ( + <> +

{t.jdbcPluginDesc}

+ + + + + + + + + + {filteredJdbcPlugin.map((plugin) => ( + + + + + + + ))} + +
{t.jdbcPluginFile}{t.filename}{t.installMethod} +
+
+ {plugin.label} + ZIP +
+

{t.jdbcPluginInstallHint}

+
{plugin.filename}{t.jdbcPluginInstallHint} + + + {t.download} + +
+ {filteredJdbcPlugin.length === 0 &&
{t.noResults}
} + + )} + {activeTab === "bundles" && ( <>

{t.bundlesDesc}

diff --git a/docs/lib/agentRegistry.test.ts b/docs/lib/agentRegistry.test.ts new file mode 100644 index 000000000..ec6b4cf94 --- /dev/null +++ b/docs/lib/agentRegistry.test.ts @@ -0,0 +1,13 @@ +import assert from "node:assert/strict"; +import { test } from "vitest"; +import { buildAgentDownloadCatalog } from "./agentRegistry"; + +test("offline download catalog includes the JDBC plugin ZIP", () => { + const catalog = buildAgentDownloadCatalog([]); + + assert.deepEqual(catalog.jdbcPlugin, { + label: "DBX JDBC Plugin", + filename: "dbx-jdbc-plugin-latest.zip", + url: "https://dl.dbxio.com/releases/latest/dbx-jdbc-plugin-latest.zip", + }); +}); diff --git a/docs/lib/agentRegistry.ts b/docs/lib/agentRegistry.ts index a0ea60e85..223d526a2 100644 --- a/docs/lib/agentRegistry.ts +++ b/docs/lib/agentRegistry.ts @@ -50,7 +50,14 @@ export interface NativeAgentDisplayEntry { info: ArtifactInfo; } +export interface JdbcPluginDownloadEntry { + label: string; + filename: string; + url: string; +} + export interface AgentDownloadCatalog { + jdbcPlugin: JdbcPluginDownloadEntry; bundles: OfflineBundleEntry[]; drivers: DriverDisplayEntry[]; jres: JreDisplayEntry[]; @@ -58,6 +65,7 @@ export interface AgentDownloadCatalog { } const AGENTS_LATEST_RELEASE_API_URL = "https://api.github.com/repos/t8y2/dbx/releases/tags/agents-latest"; +const JDBC_PLUGIN_DOWNLOAD_URL = "https://dl.dbxio.com/releases/latest/dbx-jdbc-plugin-latest.zip"; const MIN_APP_VERSION = "0.6.0"; const driverVersionMap = driverVersions as Record; const nativeDriverKeys = new Set(["oracle", "xugu"]); @@ -149,6 +157,7 @@ export async function fetchAgentDownloadCatalog(): Promise {