feat(backup): show connection groups in backup selector
This commit is contained in:
1 parent
087351f73f
commit
dd708fc052
2 files changed
+25
No files matched your search
@@ -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>
|
||||
|
||||
+23
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user