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(settings): stabilize MCP permission layout

t8y28d68a527a01b
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
index 7b968df1c3..b93f337309 100644
--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue
+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
@@ -4924,12 +4924,19 @@ onUnmounted(cleanupPreviewEditor);
</label>
</div>
</fieldset>
- <p class="flex items-start gap-1.5 text-xs" :class="mcpExecutionMode === 'high_risk_write' ? 'text-amber-600 dark:text-amber-400' : 'text-muted-foreground'">
- <AlertTriangle v-if="mcpExecutionMode === 'high_risk_write'" class="mt-0.5 h-3.5 w-3.5 shrink-0" />
- <span v-if="mcpExecutionMode === 'read_only'">{{ t("settings.mcpExecutionModeReadOnlyDescription") }}</span>
- <span v-else-if="mcpExecutionMode === 'safe_write'">{{ t("settings.mcpExecutionModeSafeWriteDescription") }}</span>
- <span v-else>{{ t("settings.mcpExecutionModeHighRiskWriteDescription") }}</span>
- </p>
+ <!-- Keep every translation in one grid cell so mode changes cannot reflow the capability matrix. -->
+ <div data-mcp-execution-mode-description class="grid text-xs">
+ <p class="col-start-1 row-start-1 text-muted-foreground" :class="mcpExecutionMode === 'read_only' ? 'visible' : 'invisible'">
+ {{ t("settings.mcpExecutionModeReadOnlyDescription") }}
+ </p>
+ <p class="col-start-1 row-start-1 text-muted-foreground" :class="mcpExecutionMode === 'safe_write' ? 'visible' : 'invisible'">
+ {{ t("settings.mcpExecutionModeSafeWriteDescription") }}
+ </p>
+ <p class="col-start-1 row-start-1 flex items-start gap-1.5 text-amber-600 dark:text-amber-400" :class="mcpExecutionMode === 'high_risk_write' ? 'visible' : 'invisible'">
+ <AlertTriangle class="mt-0.5 h-3.5 w-3.5 shrink-0" />
+ <span>{{ t("settings.mcpExecutionModeHighRiskWriteDescription") }}</span>
+ </p>
+ </div>
<div class="space-y-1.5">
<div class="space-y-0.5">
<p class="text-xs font-medium">{{ t("settings.mcpCapabilityTitle") }}</p>
diff --git a/apps/desktop/src/lib/__tests__/mcp/mcpPolicySelection.spec.ts b/apps/desktop/src/lib/__tests__/mcp/mcpPolicySelection.spec.ts
index 94fb084ffb..a72b0249d7 100644
--- a/apps/desktop/src/lib/__tests__/mcp/mcpPolicySelection.spec.ts
+++ b/apps/desktop/src/lib/__tests__/mcp/mcpPolicySelection.spec.ts
@@ -91,6 +91,18 @@ describe("MCP policy settings state", () => {
expect(loadingStart).toBeLessThan(policyLoad);
expect(loadingEnd).toBeGreaterThan(policyLoad);
});
+
+ it("keeps translated mode descriptions in one responsive layout track", () => {
+ const descriptionStart = settingsDialogSource.indexOf("data-mcp-execution-mode-description");
+ const descriptionEnd = settingsDialogSource.indexOf("settings.mcpCapabilityTitle", descriptionStart);
+ const descriptionSource = settingsDialogSource.slice(descriptionStart, descriptionEnd);
+
+ expect(descriptionStart).toBeGreaterThan(-1);
+ expect(descriptionEnd).toBeGreaterThan(descriptionStart);
+ expect(descriptionSource).toContain('class="grid text-xs"');
+ expect(descriptionSource.match(/col-start-1 row-start-1/g)).toHaveLength(3);
+ expect(descriptionSource.match(/\? 'visible' : 'invisible'/g)).toHaveLength(3);
+ });
});
describe("MCP connection search", () => {