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。

fix(jdbc): allow offline plugin updates after installation

t8y2bd08fb630473
diff --git a/apps/desktop/src/components/config/DriverStoreDialog.vue b/apps/desktop/src/components/config/DriverStoreDialog.vue
index e0270c260e..ef0241b8db 100644
--- a/apps/desktop/src/components/config/DriverStoreDialog.vue
+++ b/apps/desktop/src/components/config/DriverStoreDialog.vue
@@ -1348,7 +1348,7 @@ watch(driverStoreTab, (tab) => {
</SelectContent>
</Select>
</div>
- <Button variant="ghost" size="sm" class="h-7 rounded-md text-xs gap-1 text-muted-foreground" :disabled="agentImportBusy || installing !== null || upgradingAll || reinstallingJre !== null || queuedDriverInstalls.length > 0" @click="importOfflineZip">
+ <Button v-if="driverStoreTab === 'agent'" variant="ghost" size="sm" class="h-7 rounded-md text-xs gap-1 text-muted-foreground" :disabled="agentImportBusy || installing !== null || upgradingAll || reinstallingJre !== null || queuedDriverInstalls.length > 0" @click="importOfflineZip">
<Loader2 v-if="agentImportBusy" class="h-3.5 w-3.5 animate-spin" />
<FileUp v-else class="h-3.5 w-3.5" />
{{ agentImportBusy ? t("driverStore.importing") : t("driverStore.importOfflinePackage") }}
@@ -1744,7 +1744,7 @@ watch(driverStoreTab, (tab) => {
<Button v-else type="button" variant="default" class="rounded-md" :disabled="isInstallingJdbcPlugin" @click="installJdbcPlugin">
{{ isInstallingJdbcPlugin ? t("common.loading") : t("settings.jdbcPluginInstall") }}
</Button>
- <Button v-if="!jdbcPluginStatus?.installed" type="button" variant="outline" class="rounded-md" :disabled="isInstallingJdbcPlugin" @click="installJdbcPluginLocal">
+ <Button type="button" variant="outline" class="rounded-md" :disabled="isInstallingJdbcPlugin || isUninstallingJdbcPlugin" @click="installJdbcPluginLocal">
<FolderOpen class="h-3.5 w-3.5 mr-1" />
{{ t("driverStore.localInstall") }}
</Button>
diff --git a/packages/app-tests/jdbcPluginOfflineImport.test.ts b/packages/app-tests/jdbcPluginOfflineImport.test.ts
new file mode 100644
index 0000000000..c9466b9c30
--- /dev/null
+++ b/packages/app-tests/jdbcPluginOfflineImport.test.ts
@@ -0,0 +1,32 @@
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import { test } from "vitest";
+
+const driverStoreSource = readFileSync(path.resolve("apps/desktop/src/components/config/DriverStoreDialog.vue"), "utf8");
+
+function buttonOpeningTag(clickHandler: string): string {
+ const click = `@click="${clickHandler}"`;
+ const clickIndex = driverStoreSource.indexOf(click);
+ assert.notEqual(clickIndex, -1, `missing button for ${clickHandler}`);
+ const startIndex = driverStoreSource.lastIndexOf("<Button", clickIndex);
+ const endIndex = driverStoreSource.indexOf(">", clickIndex);
+ assert.notEqual(startIndex, -1, `missing button start for ${clickHandler}`);
+ assert.notEqual(endIndex, -1, `missing button end for ${clickHandler}`);
+ return driverStoreSource.slice(startIndex, endIndex + 1);
+}
+
+test("keeps Agent offline packages out of the JDBC tab", () => {
+ const agentOfflineButton = buttonOpeningTag("importOfflineZip");
+
+ assert.match(agentOfflineButton, /v-if="driverStoreTab === 'agent'"/);
+ assert.match(driverStoreSource, /api\.importAgentsFromZip\(selected, activeAgentOperationId\.value\)/);
+});
+
+test("keeps local JDBC plugin installation available after installation", () => {
+ const jdbcPluginLocalButton = buttonOpeningTag("installJdbcPluginLocal");
+
+ assert.doesNotMatch(jdbcPluginLocalButton, /v-if=/);
+ assert.match(jdbcPluginLocalButton, /:disabled="isInstallingJdbcPlugin \|\| isUninstallingJdbcPlugin"/);
+ assert.match(driverStoreSource, /api\.installJdbcPluginLocal\(selected\)/);
+});