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(desktop): improve legacy WebView compatibility

知食分子513c3011fc7a
diff --git a/apps/desktop/public/connection-dialog-legacy.css b/apps/desktop/public/connection-dialog-legacy.css
index 0af2f5d488..63534dbd9c 100644
--- a/apps/desktop/public/connection-dialog-legacy.css
+++ b/apps/desktop/public/connection-dialog-legacy.css
@@ -90,6 +90,19 @@
align-content: start !important;
}
+ html.dbx-legacy-webview [data-slot="dialog-content"].connection-dialog-content--config .connection-dialog-footer {
+ flex-direction: row !important;
+ align-items: center !important;
+ justify-content: flex-end !important;
+ flex-wrap: nowrap !important;
+ }
+
+ html.dbx-legacy-webview [data-slot="dialog-content"].connection-dialog-content--config .connection-dialog-test-status {
+ flex: 1 1 12rem !important;
+ min-width: 12rem !important;
+ width: auto !important;
+ }
+
html.dbx-legacy-webview [data-slot="dialog-content"].connection-dialog-content--config .connection-url-params-row--compact {
align-items: center !important;
}
diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vue
index 086bd5aed4..da157718e8 100644
--- a/apps/desktop/src/components/connection/ConnectionDialog.vue
+++ b/apps/desktop/src/components/connection/ConnectionDialog.vue
@@ -8180,8 +8180,8 @@ function openExternalUrl(url: string) {
</Tabs>
</div>
- <DialogFooter class="flex min-w-0 shrink-0 items-center gap-2 sm:flex-nowrap">
- <div class="mr-auto flex min-w-0 flex-1 basis-0 items-center gap-2 overflow-hidden">
+ <DialogFooter class="connection-dialog-footer flex min-w-0 shrink-0 items-center gap-2 sm:flex-nowrap">
+ <div class="connection-dialog-test-status mr-auto flex min-w-0 flex-1 basis-0 items-center gap-2 overflow-hidden">
<Button v-if="!editingId" variant="outline" class="shrink-0" :disabled="isSaving" @click="backToDatabasePicker">
<ArrowLeft class="h-4 w-4" />
{{ t("connection.back") }}
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
index 6388e931e0..ee85096de1 100644
--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue
+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
@@ -6243,15 +6243,15 @@ onUnmounted(() => {
<div class="space-y-2">
<Label>{{ t("settings.mcpConfig") }}</Label>
<Tabs v-model="mcpConfigTab" class="space-y-3">
- <TabsList class="h-auto min-h-8 w-full min-w-0 max-w-full justify-start gap-1 overflow-x-auto overflow-y-hidden overscroll-x-contain group-data-horizontal/tabs:h-auto">
- <TabsTrigger value="claude" class="h-7 flex-none shrink-0 px-2.5">Claude Code</TabsTrigger>
- <TabsTrigger value="cursor" class="h-7 flex-none shrink-0 px-2.5">Cursor</TabsTrigger>
- <TabsTrigger value="trae" class="h-7 flex-none shrink-0 px-2.5">TRAE</TabsTrigger>
- <TabsTrigger value="vscode" class="h-7 flex-none shrink-0 px-2.5">VS Code</TabsTrigger>
- <TabsTrigger value="windsurf" class="h-7 flex-none shrink-0 px-2.5">Windsurf</TabsTrigger>
- <TabsTrigger value="codex" class="h-7 flex-none shrink-0 px-2.5">Codex</TabsTrigger>
- <TabsTrigger value="opencode" class="h-7 flex-none shrink-0 px-2.5">OpenCode</TabsTrigger>
- <TabsTrigger value="cherry-studio" class="h-7 flex-none shrink-0 px-2.5">Cherry Studio</TabsTrigger>
+ <TabsList class="settings-mcp-config-tabs h-auto min-h-8 w-full min-w-0 max-w-full justify-start gap-1 overflow-x-auto overflow-y-hidden overscroll-x-contain group-data-horizontal/tabs:h-auto">
+ <TabsTrigger value="claude" class="settings-mcp-config-tab h-7 flex-none shrink-0 px-2.5">Claude Code</TabsTrigger>
+ <TabsTrigger value="cursor" class="settings-mcp-config-tab h-7 flex-none shrink-0 px-2.5">Cursor</TabsTrigger>
+ <TabsTrigger value="trae" class="settings-mcp-config-tab h-7 flex-none shrink-0 px-2.5">TRAE</TabsTrigger>
+ <TabsTrigger value="vscode" class="settings-mcp-config-tab h-7 flex-none shrink-0 px-2.5">VS Code</TabsTrigger>
+ <TabsTrigger value="windsurf" class="settings-mcp-config-tab h-7 flex-none shrink-0 px-2.5">Windsurf</TabsTrigger>
+ <TabsTrigger value="codex" class="settings-mcp-config-tab h-7 flex-none shrink-0 px-2.5">Codex</TabsTrigger>
+ <TabsTrigger value="opencode" class="settings-mcp-config-tab h-7 flex-none shrink-0 px-2.5">OpenCode</TabsTrigger>
+ <TabsTrigger value="cherry-studio" class="settings-mcp-config-tab h-7 flex-none shrink-0 px-2.5">Cherry Studio</TabsTrigger>
</TabsList>
<TabsContent value="claude" class="m-0">
@@ -6821,6 +6821,28 @@ html.dbx-legacy-webview .settings-layout .settings-export-number-input::-webkit-
opacity: 1 !important;
}
+html.dbx-legacy-webview .settings-layout .settings-mcp-config-tabs {
+ display: flex !important;
+ flex-direction: row !important;
+ align-items: center !important;
+ justify-content: flex-start !important;
+ gap: 0.25rem !important;
+ overflow-x: auto !important;
+ overflow-y: hidden !important;
+ white-space: nowrap !important;
+}
+
+html.dbx-legacy-webview .settings-layout .settings-mcp-config-tab {
+ display: inline-flex !important;
+ flex: 0 0 auto !important;
+ width: max-content !important;
+ min-width: max-content !important;
+ max-width: none !important;
+ padding-left: 0.625rem !important;
+ padding-right: 0.625rem !important;
+ white-space: nowrap !important;
+}
+
html.dbx-legacy-webview .settings-ai-back-button {
margin-left: -0.625rem !important;
}
diff --git a/apps/desktop/src/components/sidebar/ConnectionTree.vue b/apps/desktop/src/components/sidebar/ConnectionTree.vue
index dee191e03d..fe31d1210e 100644
--- a/apps/desktop/src/components/sidebar/ConnectionTree.vue
+++ b/apps/desktop/src/components/sidebar/ConnectionTree.vue
@@ -2224,6 +2224,28 @@ defineExpose({ focusSearch, createNewGroup, collapseAllTreeNodes });
background: color-mix(in oklch, var(--foreground) 48%, transparent);
}
+html.dbx-legacy-webview .sidebar-tree-scrollbar {
+ opacity: 0.9;
+}
+
+html.dbx-legacy-webview .sidebar-tree-scrollbar__thumb {
+ background: rgba(82, 82, 82, 0.42);
+}
+
+html.dbx-legacy-webview.dark .sidebar-tree-scrollbar__thumb {
+ background: rgba(212, 212, 216, 0.42);
+}
+
+html.dbx-legacy-webview .sidebar-tree-scrollbar:hover .sidebar-tree-scrollbar__thumb,
+html.dbx-legacy-webview .sidebar-tree-scrollbar--dragging .sidebar-tree-scrollbar__thumb {
+ background: rgba(82, 82, 82, 0.62);
+}
+
+html.dbx-legacy-webview.dark .sidebar-tree-scrollbar:hover .sidebar-tree-scrollbar__thumb,
+html.dbx-legacy-webview.dark .sidebar-tree-scrollbar--dragging .sidebar-tree-scrollbar__thumb {
+ background: rgba(212, 212, 216, 0.62);
+}
+
.sidebar-tree-horizontal-scrollbar {
position: absolute;
right: 0;
diff --git a/apps/desktop/src/styles/__tests__/legacyWebviewFallback.spec.ts b/apps/desktop/src/styles/__tests__/legacyWebviewFallback.spec.ts
index 8703764891..ca4c348fbc 100644
--- a/apps/desktop/src/styles/__tests__/legacyWebviewFallback.spec.ts
+++ b/apps/desktop/src/styles/__tests__/legacyWebviewFallback.spec.ts
@@ -110,6 +110,12 @@ describe("legacy WebView CSS fallbacks", () => {
expect(connectionDialogLegacyCss).toContain("height: 720px !important;");
expect(connectionDialogLegacyCss).toContain('[data-slot="dialog-content"].connection-dialog-content--config .connection-form-body');
expect(connectionDialogLegacyCss).toContain("align-content: start !important;");
+ expect(connectionDialogSource).toContain("connection-dialog-footer");
+ expect(connectionDialogSource).toContain("connection-dialog-test-status");
+ expect(connectionDialogLegacyCss).toContain('[data-slot="dialog-content"].connection-dialog-content--config .connection-dialog-footer');
+ expect(connectionDialogLegacyCss).toContain("flex-wrap: nowrap !important;");
+ expect(connectionDialogLegacyCss).toContain('[data-slot="dialog-content"].connection-dialog-content--config .connection-dialog-test-status');
+ expect(connectionDialogLegacyCss).toContain("min-width: 12rem !important;");
expect(connectionDialogSource).toContain("connection-url-params-row--compact");
expect(connectionDialogSource).toContain("connection-url-params-row--with-hint");
expect(connectionDialogSource).toContain("connection-url-params-label");
@@ -123,6 +129,17 @@ describe("legacy WebView CSS fallbacks", () => {
expect(connectionDialogSource).not.toContain("@media (min-width: 640px)");
});
+ it("keeps the sidebar table tree scrollbar unchanged outside legacy WebViews", () => {
+ expect(connectionTreeSource).toContain('class="sidebar-tree-scrollbar"');
+ expect(connectionTreeSource).toMatch(/\.sidebar-tree-scrollbar \{[\s\S]*?opacity: 0;/);
+ expect(connectionTreeSource).toContain("html.dbx-legacy-webview .sidebar-tree-scrollbar");
+ expect(connectionTreeSource).toMatch(/html\.dbx-legacy-webview \.sidebar-tree-scrollbar \{[\s\S]*?opacity: 0\.9;/);
+ expect(connectionTreeSource).toContain("html.dbx-legacy-webview .sidebar-tree-scrollbar__thumb");
+ expect(connectionTreeSource).toContain("background: rgba(82, 82, 82, 0.42);");
+ expect(connectionTreeSource).toContain("html.dbx-legacy-webview.dark .sidebar-tree-scrollbar__thumb");
+ expect(connectionTreeSource).toContain("background: rgba(212, 212, 216, 0.42);");
+ });
+
it("keeps selected tiles readable in WebViews without color-mix support", () => {
const fallbackStart = globalsCss.indexOf("@supports not (background-color: color-mix(in srgb, black 10%, transparent))");
const choiceFallback = globalsCss.indexOf(".dbx-choice-selected", fallbackStart);
@@ -262,6 +279,13 @@ describe("legacy WebView CSS fallbacks", () => {
expect(fallback).toContain("line-height: 1.25rem !important;");
expect(fallback).toContain("-webkit-appearance: inner-spin-button !important;");
expect(fallback).toContain("::-webkit-inner-spin-button");
+ expect(editorSettingsDialogSource).toContain("settings-mcp-config-tabs");
+ expect(editorSettingsDialogSource).toContain("settings-mcp-config-tab");
+ expect(fallback).toContain(".settings-layout .settings-mcp-config-tabs");
+ expect(fallback).toContain("gap: 0.25rem !important;");
+ expect(fallback).toContain(".settings-layout .settings-mcp-config-tab");
+ expect(fallback).toContain("flex: 0 0 auto !important;");
+ expect(fallback).toContain("min-width: max-content !important;");
expect(editorSettingsDialogSource).toContain('class="settings-ai-back-button"');
expect(fallback).toContain(".settings-ai-back-button");
expect(fallback).toContain("margin-left: -0.625rem !important;");