Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

feat(driver): honor selected driver download source

二丫讲梵f6ecd3c881a4
diff --git a/apps/desktop/src/components/config/DriverStoreDialog.vue b/apps/desktop/src/components/config/DriverStoreDialog.vue
index 07944992b4..f35e1a3eca 100644
--- a/apps/desktop/src/components/config/DriverStoreDialog.vue
+++ b/apps/desktop/src/components/config/DriverStoreDialog.vue
@@ -239,6 +239,7 @@ const usageSummary = computed(() => {
];
});
const canClearDownloadCache = computed(() => !clearingDownloadCache.value && installing.value === null && !upgradingAll.value && reinstallingJre.value === null && downloadCacheBytes.value > 0);
+const downloadSourceBusy = computed(() => refreshing.value || installing.value !== null || upgradingAll.value || queuedDriverInstalls.value.length > 0 || reinstallingJre.value !== null);
const jreUsageByKey = computed(() => {
const map = new Map<string, number>();
for (const item of driverStoreUsage.value?.jres || []) {
@@ -330,6 +331,13 @@ async function forceRefresh() {
}
}
+function setUpdateDownloadSource(value: unknown) {
+ if (value !== "official" && value !== "cnb" && value !== "atomgit") return;
+ if (value === settingsStore.editorSettings.updateDownloadSource) return;
+ settingsStore.updateEditorSettings({ updateDownloadSource: value });
+ void forceRefresh().catch(() => undefined);
+}
+
async function loadJavaRuntimeConfig() {
const config = await api.getAgentJavaRuntimeConfig();
javaRuntimeConfig.value = config;
@@ -1143,7 +1151,20 @@ watch(driverStoreTab, (tab) => {
{{ t("driverStore.storageTab") }}
</TabsTrigger>
</TabsList>
- <div v-if="driverStoreTab !== 'storage'" class="flex items-center gap-2">
+ <div v-if="driverStoreTab !== 'storage'" class="flex flex-wrap items-center gap-2">
+ <div v-if="driverStoreTab === 'agent' && !isWeb" class="flex items-center gap-1.5">
+ <span class="text-xs text-muted-foreground">{{ t("settings.updateDownloadSource") }}</span>
+ <Select :model-value="settingsStore.editorSettings.updateDownloadSource" :disabled="downloadSourceBusy" @update:model-value="setUpdateDownloadSource">
+ <SelectTrigger class="h-7 w-[160px] rounded-[6px] text-xs">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="official">{{ t("settings.updateDownloadSourceOfficial") }}</SelectItem>
+ <SelectItem value="cnb">{{ t("settings.updateDownloadSourceCnb") }}</SelectItem>
+ <SelectItem value="atomgit">{{ t("settings.updateDownloadSourceAtomgit") }}</SelectItem>
+ </SelectContent>
+ </Select>
+ </div>
<Button variant="ghost" size="sm" class="h-7 rounded-[6px] text-xs gap-1 text-muted-foreground" :disabled="importingZip" @click="importOfflineZip">
<FileUp class="h-3.5 w-3.5" />
{{ importingZip ? t("driverStore.importing") : t("driverStore.importOfflinePackage") }}
diff --git a/packages/app-tests/driverDownloadSource.test.ts b/packages/app-tests/driverDownloadSource.test.ts
new file mode 100644
index 0000000000..c175e46e47
--- /dev/null
+++ b/packages/app-tests/driverDownloadSource.test.ts
@@ -0,0 +1,23 @@
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import { test } from "vitest";
+
+function source(relativePath: string): string {
+ return readFileSync(path.resolve(relativePath), "utf8");
+}
+
+test("shares the configured download source with agent driver management", () => {
+ const driverStore = source("apps/desktop/src/components/config/DriverStoreDialog.vue");
+ const backendApi = source("apps/desktop/src/lib/backend/api.ts");
+
+ assert.match(driverStore, /driverStoreTab === 'agent' && !isWeb/);
+ assert.match(driverStore, /:model-value="settingsStore\.editorSettings\.updateDownloadSource"/);
+ assert.match(driverStore, /settingsStore\.updateEditorSettings\(\{ updateDownloadSource: value \}\)/);
+ assert.match(driverStore, /void forceRefresh\(\)\.catch\(\(\) => undefined\)/);
+
+ assert.match(backendApi, /backend\.listInstalledAgents\(useSettingsStore\(\)\.editorSettings\.updateDownloadSource\)/);
+ assert.match(backendApi, /backend\.installAgent\(dbType, useSettingsStore\(\)\.editorSettings\.updateDownloadSource\)/);
+ assert.match(backendApi, /backend\.upgradeAllAgents\(useSettingsStore\(\)\.editorSettings\.updateDownloadSource\)/);
+ assert.match(backendApi, /backend\.reinstallJre\(jreKey, useSettingsStore\(\)\.editorSettings\.updateDownloadSource\)/);
+});