From bd08fb6304734ed8fd1a61c21a8c940a461a3c26 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Mon, 10 Aug 2026 21:48:47 +0800 Subject: [PATCH] fix(jdbc): allow offline plugin updates after installation Closes #5807 --- .../components/config/DriverStoreDialog.vue | 4 +-- .../app-tests/jdbcPluginOfflineImport.test.ts | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 packages/app-tests/jdbcPluginOfflineImport.test.ts 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) => { - - 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("", 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\)/); +});