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。

feat(backup): show connection groups in backup selector

CSXFanMengdd708fc0521e
diff --git a/apps/desktop/src/components/backup/DatabaseBackupConfigFields.vue b/apps/desktop/src/components/backup/DatabaseBackupConfigFields.vue
index 24677f19d0..53f3a17796 100644
--- a/apps/desktop/src/components/backup/DatabaseBackupConfigFields.vue
+++ b/apps/desktop/src/components/backup/DatabaseBackupConfigFields.vue
@@ -8,6 +8,7 @@ import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { HelpTooltip } from "@/components/ui/tooltip";
import { Check, ChevronDown, FolderOpen, Loader2, Search } from "@lucide/vue";
+import ConnectionGroupBadge from "@/components/connection/ConnectionGroupBadge.vue";
import { databaseBackupFileNamePatternIsValid, type DatabaseBackupExecutionConfig } from "@/lib/backup/scheduledDatabaseBackup";
import type { ConnectionConfig } from "@/types/database";
@@ -123,6 +124,7 @@ watch(
@click="selectConnection(connection.id)"
>
<Check class="h-4 w-4 shrink-0" :class="connection.id === draft.connectionId ? 'opacity-100' : 'opacity-0'" />
+ <ConnectionGroupBadge :connection-id="connection.id" />
<span class="min-w-0 flex-1 truncate">{{ connection.name }}</span>
</button>
<div v-if="filteredConnections.length === 0" class="px-2 py-2 text-sm text-muted-foreground">{{ t("databaseBackup.noMatchingConnections") }}</div>
diff --git a/apps/desktop/src/components/backup/__tests__/ScheduledDatabaseBackupSettings.spec.ts b/apps/desktop/src/components/backup/__tests__/ScheduledDatabaseBackupSettings.spec.ts
index cb1a421f5f..1b9bbdf69d 100644
--- a/apps/desktop/src/components/backup/__tests__/ScheduledDatabaseBackupSettings.spec.ts
+++ b/apps/desktop/src/components/backup/__tests__/ScheduledDatabaseBackupSettings.spec.ts
@@ -63,6 +63,16 @@ vi.mock("@/composables/useToast", () => ({
useToast: () => ({ toast: mocks.toast }),
}));
+vi.mock("@/components/connection/ConnectionGroupBadge.vue", async () => {
+ const { defineComponent, h } = await import("vue");
+ return {
+ default: defineComponent({
+ props: { connectionId: { type: String, required: true } },
+ setup: (props) => () => h("span", { "data-connection-group-badge": "", "data-connection-id": props.connectionId }),
+ }),
+ };
+});
+
vi.mock("@tauri-apps/plugin-dialog", () => ({
open: mocks.openDirectory,
}));
@@ -460,6 +470,19 @@ describe("ScheduledDatabaseBackupSettings schedule dialog", () => {
expect(currentDialog().querySelector<HTMLElement>("[data-backup-output-path-preview]")?.textContent).toContain("/backups/archive/");
});
+ it("shows connection group badges in the backup connection picker", async () => {
+ mocks.connections.push({ id: "mysql-primary", name: "Shared name", db_type: "mysql" }, { id: "mysql-archive", name: "Shared name", db_type: "mysql" });
+ await mountSettings();
+
+ addScheduleButton().click();
+ await flush();
+ currentDialog().querySelector<HTMLButtonElement>("[data-backup-connection-picker]")?.click();
+ await flush();
+
+ const connectionIds = Array.from(document.body.querySelectorAll<HTMLElement>("[data-connection-group-badge]")).map((badge) => badge.dataset.connectionId);
+ expect(connectionIds).toEqual(["mysql-primary", "mysql-archive"]);
+ });
+
it("opens an independent one-shot dialog without schedule fields", async () => {
mocks.connections.push({ id: "mysql-1", name: "Local MySQL", db_type: "mysql" });
await mountSettings();