diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vue index cfc1c26b03..46fb68a8a8 100644 --- a/apps/desktop/src/components/connection/ConnectionDialog.vue +++ b/apps/desktop/src/components/connection/ConnectionDialog.vue @@ -4110,8 +4110,9 @@ function connectionConfigForSubmit(id: string, generatedName = "", validatePlugi config.keepalive_interval_secs = form.value.keepalive_interval_secs; config.read_only = form.value.read_only; config.save_password = form.value.save_password; - config.is_production = form.value.is_production; - config.production_databases = form.value.production_databases; + // 生产保护只拦截 SQL/数据编辑路径,插件连接走不到;表单已隐藏该区块,提交时清掉历史残留标志。 + config.is_production = false; + config.production_databases = []; } else { config = { ...formValueForSubmit(), id } as LegacyConnectionConfig; } @@ -9027,7 +9028,7 @@ function openExternalUrl(url: string) {

-
+
diff --git a/apps/desktop/src/lib/__tests__/connection/connectionDialogProductionSection.spec.ts b/apps/desktop/src/lib/__tests__/connection/connectionDialogProductionSection.spec.ts new file mode 100644 index 0000000000..052f115782 --- /dev/null +++ b/apps/desktop/src/lib/__tests__/connection/connectionDialogProductionSection.spec.ts @@ -0,0 +1,18 @@ +import { readFileSync } from "node:fs"; +import { describe, expect, it } from "vitest"; + +const dialogSource = readFileSync(new URL("../../../components/connection/ConnectionDialog.vue", import.meta.url), "utf8"); + +describe("ConnectionDialog production protection section", () => { + it("hides the production protection section for plugin connections", () => { + expect(dialogSource).toContain('
'); + }); + + it("clears stale production flags when submitting plugin connections", () => { + const submitFn = dialogSource.slice(dialogSource.indexOf("function connectionConfigForSubmit")); + const pluginBranch = submitFn.slice(0, submitFn.indexOf("} else {")); + expect(pluginBranch).toContain("config.is_production = false;"); + expect(pluginBranch).toContain("config.production_databases = [];"); + expect(pluginBranch).not.toContain("config.is_production = form.value.is_production;"); + }); +});