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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
feat(cloud-sync): add bulk selection and group controls to backup dialog
Terry Yao25e1c6d25d3e
diff --git a/apps/desktop/src/components/editor/CloudSyncSelectionDialog.vue b/apps/desktop/src/components/editor/CloudSyncSelectionDialog.vueindex 56b36335cd..b49f09bd10 100644--- a/apps/desktop/src/components/editor/CloudSyncSelectionDialog.vue+++ b/apps/desktop/src/components/editor/CloudSyncSelectionDialog.vue@@ -1,10 +1,10 @@<script setup lang="ts">import { computed, ref, watch } from "vue";import { useI18n } from "vue-i18n";-import { FolderOpen } from "@lucide/vue";+import { ChevronDown, ChevronRight, FoldVertical, FolderOpen, ListChecks, ListX, UnfoldVertical } from "@lucide/vue";import { Button } from "@/components/ui/button";import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";-import type { SyncCatalogItem, SyncSelection, SyncSnapshotCatalog } from "@/lib/backend/api";+import type { PluginUiStorageItemRef, SyncCatalogItem, SyncSelection, SyncSnapshotCatalog } from "@/lib/backend/api";import { transferCategoryForKey, type SettingsTransferCategoryId } from "@/lib/settings/settingsTransfer";import { clonePluginData } from "@/lib/plugins/pluginData";@@ -32,6 +32,22 @@ const secretsPassphraseRequired = ref(false);const localExportPathRequired = ref(false);const isRestore = computed(() => props.mode === "restore");+const SYNC_GROUP_IDS = ["connections", "tunnels", "savedSql", "settings", "secrets", "workspace"] as const;+type SyncGroupId = (typeof SYNC_GROUP_IDS)[number];+const collapsedGroups = ref<Set<SyncGroupId>>(new Set(SYNC_GROUP_IDS));+const allGroupsCollapsed = computed(() => SYNC_GROUP_IDS.every((id) => collapsedGroups.value.has(id)));++function toggleGroup(id: SyncGroupId) {+ const next = new Set(collapsedGroups.value);+ if (next.has(id)) next.delete(id);+ else next.add(id);+ collapsedGroups.value = next;+}++function toggleAllGroups() {+ collapsedGroups.value = allGroupsCollapsed.value ? new Set() : new Set(SYNC_GROUP_IDS);+}+const backupSettingsCategoryOrder: readonly BackupSettingsCategoryId[] = ["appearance", "editor", "formatter", "navigation", "data", "shortcuts", "snippets", "ai"];const backupSettingsCategoryLabelKeys: Record<BackupSettingsCategoryId, string> = {appearance: "settings.appearanceTab",@@ -153,6 +169,54 @@ const backupSettingsCategories = computed(() => {});});+const savedSqlSummary = computed(() => {+ const catalog = props.catalog;+ return {+ selected: ids("savedSqlFolders").length + ids("savedSqlFiles").length,+ total: (catalog?.savedSqlFolders.length ?? 0) + (catalog?.savedSqlFiles.length ?? 0),+ };+});++const settingsSummary = computed(() => {+ let selected = 0;+ let total = 0;+ for (const category of backupSettingsCategories.value) {+ selected += category.selected;+ total += category.total;+ }+ return { selected, total };+});++// Connection/tunnel credentials render under their own groups but are encrypted items too, so the group aggregate counts all five buckets.+// Selected counts intersect with the catalog: a saved selection can keep ids that the snapshot does not actually carry (e.g. connections+// exported as secret-eligible that had no stored password), and those are not restorable items.+const secretsSummary = computed(() => {+ const catalog = props.catalog;+ if (!catalog) return { selected: 0, total: 0 };+ const aiTotal = catalog.aiConfigs.length;+ const pluginTotal = catalog.pluginUiStorage.length;+ const aiSelected = selection.value.aiConfigs === undefined ? aiTotal : catalog.aiConfigs.filter((item) => selection.value.aiConfigs?.includes(item.id)).length;+ const pluginSelected = selection.value.pluginUiStorage === undefined ? pluginTotal : catalog.pluginUiStorage.filter((item) => selection.value.pluginUiStorage?.some((entry) => entry.pluginId === item.pluginId && entry.key === item.key)).length;+ const selected = catalog.connectionSecrets.filter((id) => selection.value.connectionSecrets?.includes(id)).length + catalog.tunnelSecrets.filter((id) => selection.value.tunnelSecrets?.includes(id)).length + (selection.value.syncCredentials ? 1 : 0) + aiSelected + pluginSelected;+ const total = catalog.connectionSecrets.length + catalog.tunnelSecrets.length + 1 + aiTotal + pluginTotal;+ return { selected, total };+});++const workspaceSummary = computed(() => {+ const catalog = props.catalog;+ if (!catalog) return { selected: 0, total: 0 };+ return {+ selected: (selection.value.sidebarLayout ? 1 : 0) + (selection.value.pinnedTreeNodeIds ? 1 : 0),+ total: (catalog.hasSidebarLayout ? 1 : 0) + (catalog.hasPinnedTreeNodeIds ? 1 : 0),+ };+});++// Locked encrypted items use `undefined` to mean "include all of the remote data", so they count as selected via secretsSummary.+const hasAnySelection = computed(() => {+ const s = selection.value;+ return !!(s.connections?.length || s.tunnelProfiles?.length || s.savedSqlFolders?.length || s.savedSqlFiles?.length || s.desktopSettings?.length || s.editorSettings?.length || s.sidebarLayout || s.pinnedTreeNodeIds || secretsSummary.value.selected);+});+function emptySelection(): SyncSelection {return {connections: [],@@ -189,13 +253,15 @@ function resetFromCatalog() {desktopSettings: selectedSettings(saved?.desktopSettings, desktopSettings),editorSettings: selectedSettings(saved?.editorSettings, editorSettings),aiConfigs: saved?.aiConfigs ?? (catalog.aiConfigsLocked ? undefined : catalog.aiConfigs.map((item) => item.id)),- pluginUiStorage: saved?.pluginUiStorage ?? (catalog.pluginUiStorageLocked ? undefined : catalog.pluginUiStorage),+ // While locked the plugin items cannot be enumerated, so the selection is an aggregate "include all" flag.+ // The encrypted blob only contains what the saved selection covered, so `undefined` restores the same data.+ pluginUiStorage: catalog.pluginUiStorageLocked ? undefined : (saved?.pluginUiStorage ?? catalog.pluginUiStorage),sidebarLayout: saved?.sidebarLayout ?? catalog.hasSidebarLayout,pinnedTreeNodeIds: saved?.pinnedTreeNodeIds ?? catalog.hasPinnedTreeNodeIds,includeSecrets: props.secretsPassphraseAvailable === false ? false : (saved?.includeSecrets ?? (isRestore.value ? catalog.hasEncryptedSecrets : !!props.defaultIncludeSecrets)),syncCredentials: saved?.syncCredentials ?? (isRestore.value ? catalog.hasEncryptedSecrets : !!props.defaultIncludeSecrets),};- if (selection.value.includeSecrets && !saved) onSecretsChanged();+ if (selection.value.includeSecrets && !saved) fillMissingSecrets();}watch(@@ -204,6 +270,7 @@ watch(if (open) {secretsPassphraseRequired.value = false;localExportPathRequired.value = false;+ collapsedGroups.value = new Set(SYNC_GROUP_IDS);resetFromCatalog();}},@@ -214,10 +281,67 @@ function ids(key: "connections" | "connectionSecrets" | "tunnelProfiles" | "tunnreturn selection.value[key] ?? [];}-function allSelected(key: "connections" | "tunnelProfiles", items: SyncCatalogItem[]) {+function allSelected(key: "connections" | "tunnelProfiles" | "savedSqlFolders" | "savedSqlFiles" | "aiConfigs", items: SyncCatalogItem[]) {return items.length > 0 && items.every((item) => ids(key).includes(item.id));}+type SelectionState = "none" | "partial" | "all";++function selectionState(key: "connections" | "tunnelProfiles" | "savedSqlFolders" | "savedSqlFiles" | "aiConfigs", items: SyncCatalogItem[]): SelectionState {+ const selected = ids(key);+ const count = items.reduce((total, item) => total + (selected.includes(item.id) ? 1 : 0), 0);+ return count === 0 ? "none" : count === items.length ? "all" : "partial";+}++function summaryState(summary: { selected: number; total: number }): SelectionState {+ if (summary.total === 0 || summary.selected === 0) return "none";+ return summary.selected === summary.total ? "all" : "partial";+}++const aiConfigsState = computed<SelectionState>(() => {+ const catalog = props.catalog;+ if (!catalog) return "none";+ if (selection.value.aiConfigs === undefined) return catalog.aiConfigs.length === 0 ? "none" : "all";+ return selectionState("aiConfigs", catalog.aiConfigs);+});++const pluginUiStorageState = computed<SelectionState>(() => {+ const catalog = props.catalog;+ if (!catalog) return "none";+ const selected = selection.value.pluginUiStorage;+ const total = catalog.pluginUiStorage.length;+ if (selected === undefined) return total === 0 ? "none" : "all";+ const count = catalog.pluginUiStorage.filter((item) => selected.some((entry) => entry.pluginId === item.pluginId && entry.key === item.key)).length;+ return count === 0 ? "none" : count === total ? "all" : "partial";+});++const pluginUiGroups = computed(() => {+ const catalog = props.catalog;+ if (!catalog) return [];+ const groups = new Map<string, { pluginId: string; name: string; items: PluginUiStorageItemRef[] }>();+ for (const item of catalog.pluginUiStorage) {+ let group = groups.get(item.pluginId);+ if (!group) {+ group = { pluginId: item.pluginId, name: item.pluginName || item.pluginId, items: [] };+ groups.set(item.pluginId, group);+ }+ group.items.push(item);+ }+ return [...groups.values()];+});++// A locked selection is `undefined` and means "include all", so every item counts as selected.+function pluginGroupSelected(group: { items: PluginUiStorageItemRef[] }) {+ const selected = selection.value.pluginUiStorage;+ if (selected === undefined) return group.items.length;+ return group.items.filter((item) => selected.some((entry) => entry.pluginId === item.pluginId && entry.key === item.key)).length;+}++function pluginGroupState(group: { items: PluginUiStorageItemRef[] }): SelectionState {+ const selected = pluginGroupSelected(group);+ return selected === 0 ? "none" : selected === group.items.length ? "all" : "partial";+}+function toggleId(key: "connections" | "connectionSecrets" | "tunnelProfiles" | "tunnelSecrets" | "savedSqlFolders" | "savedSqlFiles" | "desktopSettings" | "editorSettings" | "aiConfigs", id: string) {const current = ids(key);selection.value[key] = current.includes(id) ? current.filter((item) => item !== id) : [...current, id];@@ -229,6 +353,30 @@ function toggleAll(key: "connections" | "tunnelProfiles" | "savedSqlFolders" | "selection.value[key] = isAllSelected ? [] : items.map((item) => item.id);}+function toggleSavedSql() {+ const catalog = props.catalog;+ if (!catalog) return;+ const include = summaryState(savedSqlSummary.value) !== "all";+ selection.value.savedSqlFolders = include ? catalog.savedSqlFolders.map((item) => item.id) : [];+ selection.value.savedSqlFiles = include ? catalog.savedSqlFiles.map((item) => item.id) : [];+}++function toggleAllSettings() {+ const catalog = props.catalog;+ if (!catalog) return;+ const include = summaryState(settingsSummary.value) !== "all";+ selection.value.desktopSettings = include ? selectableDesktopSettings(catalog).map((item) => item.id) : [];+ selection.value.editorSettings = include ? selectableEditorSettings(catalog).map((item) => item.id) : [];+}++function toggleWorkspace() {+ const catalog = props.catalog;+ if (!catalog) return;+ const include = summaryState(workspaceSummary.value) !== "all";+ selection.value.sidebarLayout = include && catalog.hasSidebarLayout;+ selection.value.pinnedTreeNodeIds = include && catalog.hasPinnedTreeNodeIds;+}+function toggleSettingsCategory(category: BackupSettingsCategoryId) {const catalog = props.catalog;const group = backupSettingsCategories.value.find((item) => item.id === category);@@ -248,52 +396,198 @@ function toggleSettingsCategory(category: BackupSettingsCategoryId) {selection.value.editorSettings = [...editorIds];}-function togglePluginItem(pluginId: string, key: string) {+function togglePluginItem(pluginId: string, key: string, event: Event) {const current = selection.value.pluginUiStorage ?? [];const exists = current.some((item) => item.pluginId === pluginId && item.key === key);+ if (!exists && !ensureSecretsEnabled()) {+ // State did not change, so Vue will not re-sync the checkbox the user just flipped; revert it manually.+ (event.target as HTMLInputElement).checked = false;+ return;+ }selection.value.pluginUiStorage = exists ? current.filter((item) => item.pluginId !== pluginId || item.key !== key) : [...current, props.catalog?.pluginUiStorage.find((item) => item.pluginId === pluginId && item.key === key)!];+ syncIncludeSecrets();+}++function togglePluginGroup(pluginId: string, event: Event) {+ const catalog = props.catalog;+ if (!catalog) return;+ const items = catalog.pluginUiStorage.filter((item) => item.pluginId === pluginId);+ const current = selection.value.pluginUiStorage ?? [];+ const allSelected = items.length > 0 && items.every((item) => current.some((entry) => entry.pluginId === item.pluginId && entry.key === item.key));+ if (!allSelected && !ensureSecretsEnabled()) {+ // State did not change, so Vue will not re-sync the checkbox the user just flipped; revert it manually.+ const input = event.target as HTMLInputElement;+ input.checked = false;+ input.indeterminate = pluginGroupState({ items }) === "partial";+ return;+ }+ const rest = current.filter((entry) => entry.pluginId !== pluginId);+ selection.value.pluginUiStorage = allSelected ? rest : [...rest, ...items];+ syncIncludeSecrets();}function togglePluginAll() {if (props.catalog?.pluginUiStorageLocked) {selection.value.pluginUiStorage = selection.value.pluginUiStorage === undefined ? [] : undefined;+ syncIncludeSecrets();return;}const all = props.catalog?.pluginUiStorage ?? [];selection.value.pluginUiStorage = selection.value.pluginUiStorage?.length === all.length ? [] : [...all];+ syncIncludeSecrets();}function toggleAllAiConfigs() {if (props.catalog?.aiConfigsLocked) {selection.value.aiConfigs = selection.value.aiConfigs === undefined ? [] : undefined;+ syncIncludeSecrets();return;}toggleAll("aiConfigs", props.catalog?.aiConfigs ?? []);+ syncIncludeSecrets();}-function onSecretsChanged(event?: Event) {- if (event) {- const includeSecrets = (event.target as HTMLInputElement).checked;- if (includeSecrets && props.secretsPassphraseAvailable === false) {- selection.value.includeSecrets = false;- secretsPassphraseRequired.value = true;- return;- }- selection.value.includeSecrets = includeSecrets;+// The encrypted group checkbox is an aggregate over its items: locked `undefined` selections count as "include all".+function secretsLeafSelected(): boolean {+ const s = selection.value;+ return !!(s.connectionSecrets?.length || s.tunnelSecrets?.length || s.syncCredentials || s.aiConfigs === undefined || (s.aiConfigs?.length ?? 0) > 0 || s.pluginUiStorage === undefined || (s.pluginUiStorage?.length ?? 0) > 0);+}++function syncIncludeSecrets() {+ selection.value.includeSecrets = secretsLeafSelected();+}++function setAllSecretsItems() {+ const catalog = props.catalog;+ if (!catalog) return;+ selection.value.connectionSecrets = [...catalog.connectionSecrets];+ selection.value.tunnelSecrets = [...catalog.tunnelSecrets];+ selection.value.aiConfigs = catalog.aiConfigsLocked ? undefined : catalog.aiConfigs.map((item) => item.id);+ selection.value.pluginUiStorage = catalog.pluginUiStorageLocked ? undefined : [...catalog.pluginUiStorage];+ selection.value.syncCredentials = true;+ selection.value.includeSecrets = true;+}++function clearAllSecretsItems() {+ selection.value.connectionSecrets = [];+ selection.value.tunnelSecrets = [];+ selection.value.aiConfigs = [];+ selection.value.pluginUiStorage = [];+ selection.value.syncCredentials = false;+ selection.value.includeSecrets = false;+}++function fillMissingSecrets() {+ const catalog = props.catalog;+ if (!catalog) return;+ if (!selection.value.connectionSecrets?.length) selection.value.connectionSecrets = [...catalog.connectionSecrets];+ if (!selection.value.tunnelSecrets?.length) selection.value.tunnelSecrets = [...catalog.tunnelSecrets];+ if (!selection.value.aiConfigs?.length && catalog.aiConfigs.length) selection.value.aiConfigs = catalog.aiConfigs.map((item) => item.id);+ if (!selection.value.pluginUiStorage?.length && !catalog.pluginUiStorageLocked) selection.value.pluginUiStorage = [...catalog.pluginUiStorage];+ selection.value.syncCredentials = true;+}++function onSecretsGroupChanged(event: Event) {+ const input = event.target as HTMLInputElement;+ if (summaryState(secretsSummary.value) === "all") {+ clearAllSecretsItems();secretsPassphraseRequired.value = false;+ return;}- if (!selection.value.includeSecrets || !props.catalog) return;- if (!selection.value.connectionSecrets?.length) selection.value.connectionSecrets = [...props.catalog.connectionSecrets];- if (!selection.value.tunnelSecrets?.length) selection.value.tunnelSecrets = [...props.catalog.tunnelSecrets];- if (!selection.value.aiConfigs?.length && props.catalog.aiConfigs.length) selection.value.aiConfigs = props.catalog.aiConfigs.map((item) => item.id);- if (!selection.value.pluginUiStorage?.length && !props.catalog.pluginUiStorageLocked) selection.value.pluginUiStorage = [...props.catalog.pluginUiStorage];- selection.value.syncCredentials = true;+ if (!ensureSecretsEnabled()) {+ // State did not change, so Vue will not re-sync the checkbox the user just flipped; revert it manually.+ input.checked = false;+ input.indeterminate = summaryState(secretsSummary.value) === "partial";+ return;+ }+ setAllSecretsItems();+}++// A secrets child can only take effect when the encrypted section is enabled; checking one turns the master switch on+// (same passphrase guard as the master checkbox), while unchecking stays allowed.+function ensureSecretsEnabled(): boolean {+ if (selection.value.includeSecrets) return true;+ if (props.secretsPassphraseAvailable === false) {+ secretsPassphraseRequired.value = true;+ return false;+ }+ secretsPassphraseRequired.value = false;+ selection.value.includeSecrets = true;+ return true;+}++function toggleSecretId(key: "connectionSecrets" | "tunnelSecrets" | "aiConfigs", id: string, event: Event) {+ if (!checked(key, id) && !ensureSecretsEnabled()) {+ // State did not change, so Vue will not re-sync the checkbox the user just flipped; revert it manually.+ (event.target as HTMLInputElement).checked = false;+ return;+ }+ toggleId(key, id);+ syncIncludeSecrets();+}++function onSyncCredentialsChanged(event: Event) {+ const input = event.target as HTMLInputElement;+ if (input.checked && !ensureSecretsEnabled()) {+ input.checked = false;+ return;+ }+ selection.value.syncCredentials = input.checked;+ syncIncludeSecrets();+}++function onAiConfigsToggleAll(event: Event) {+ if (aiConfigsState.value === "all" || ensureSecretsEnabled()) {+ toggleAllAiConfigs();+ return;+ }+ (event.target as HTMLInputElement).checked = false;+}++function onPluginToggleAll(event: Event) {+ if (pluginUiStorageState.value === "all" || ensureSecretsEnabled()) {+ togglePluginAll();+ return;+ }+ (event.target as HTMLInputElement).checked = false;}function checked(key: "connections" | "connectionSecrets" | "tunnelProfiles" | "tunnelSecrets" | "savedSqlFolders" | "savedSqlFiles" | "desktopSettings" | "editorSettings" | "aiConfigs", id: string) {return ids(key).includes(id);}+function selectAllItems() {+ const catalog = props.catalog;+ if (!catalog) return;+ // Encrypted items only make sense when the snapshot has them (restore) and the passphrase is available;+ // otherwise surface the same passphrase hint the encrypted checkbox would show.+ const wantsSecrets = !isRestore.value || catalog.hasEncryptedSecrets;+ const secretsAvailable = wantsSecrets && props.secretsPassphraseAvailable !== false;+ secretsPassphraseRequired.value = wantsSecrets && !secretsAvailable;+ selection.value = {+ connections: catalog.connections.map((item) => item.id),+ connectionSecrets: secretsAvailable ? [...catalog.connectionSecrets] : [],+ tunnelProfiles: catalog.tunnelProfiles.map((item) => item.id),+ tunnelSecrets: secretsAvailable ? [...catalog.tunnelSecrets] : [],+ savedSqlFolders: catalog.savedSqlFolders.map((item) => item.id),+ savedSqlFiles: catalog.savedSqlFiles.map((item) => item.id),+ desktopSettings: selectableDesktopSettings(catalog).map((item) => item.id),+ editorSettings: selectableEditorSettings(catalog).map((item) => item.id),+ // Locked encrypted sections cannot enumerate remote items; undefined means "include all" there.+ aiConfigs: secretsAvailable ? (catalog.aiConfigsLocked ? undefined : catalog.aiConfigs.map((item) => item.id)) : [],+ pluginUiStorage: secretsAvailable ? (catalog.pluginUiStorageLocked ? undefined : [...catalog.pluginUiStorage]) : [],+ sidebarLayout: catalog.hasSidebarLayout,+ pinnedTreeNodeIds: catalog.hasPinnedTreeNodeIds,+ includeSecrets: secretsAvailable,+ syncCredentials: secretsAvailable,+ };+}++function deselectAllItems() {+ secretsPassphraseRequired.value = false;+ selection.value = emptySelection();+}+function copySelection(): SyncSelection {const current = selection.value;return {@@ -339,12 +633,38 @@ function confirmSelection() {</DialogDescription></DialogHeader>+ <div v-if="catalog" class="flex shrink-0 items-center gap-1 border-b px-4 py-2">+ <Button variant="ghost" size="xs" @click="selectAllItems">+ <ListChecks />+ {{ t("settings.syncSelectionSelectAll") }}+ </Button>+ <Button variant="ghost" size="xs" @click="deselectAllItems">+ <ListX />+ {{ t("settings.syncSelectionDeselectAll") }}+ </Button>+ <Button variant="ghost" size="xs" class="ml-auto" @click="toggleAllGroups">+ <UnfoldVertical v-if="allGroupsCollapsed" />+ <FoldVertical v-else />+ {{ allGroupsCollapsed ? t("settings.syncSelectionExpandAll") : t("settings.syncSelectionCollapseAll") }}+ </Button>+ </div>+<div v-if="catalog" class="min-h-0 flex-1 space-y-2 overflow-y-auto px-5 py-4">- <details open class="border-b pb-2">- <summary class="flex cursor-pointer list-none items-center gap-2 py-2 text-sm font-medium">- <input :checked="allSelected('connections', catalog.connections)" :disabled="!catalog.connections.length" type="checkbox" class="size-4 accent-primary" @click.stop @change="toggleAll('connections', catalog.connections)" />+ <details :open="!collapsedGroups.has('connections')" class="border-b pb-2">+ <summary class="flex cursor-pointer list-none items-center gap-2 py-2 text-sm font-medium" @click.prevent="toggleGroup('connections')">+ <input+ :checked="allSelected('connections', catalog.connections)"+ :indeterminate="selectionState('connections', catalog.connections) === 'partial'"+ :disabled="!catalog.connections.length"+ type="checkbox"+ class="size-4 accent-primary"+ @click.stop+ @change="toggleAll('connections', catalog.connections)"+ /><span>{{ t("settings.syncSelectionConnections") }}</span><span class="ml-auto text-xs text-muted-foreground">{{ selection.connections?.length ?? 0 }}/{{ catalog.connections.length }}</span>+ <ChevronDown v-if="!collapsedGroups.has('connections')" class="size-4 shrink-0 text-muted-foreground" />+ <ChevronRight v-else class="size-4 shrink-0 text-muted-foreground" /></summary><div class="ml-6 space-y-1 pb-2"><div v-for="item in catalog.connections" :key="item.id" class="py-1">@@ -353,7 +673,7 @@ function confirmSelection() {<span class="min-w-0 truncate">{{ item.label || item.id }}</span></label><label v-if="catalog.connectionSecrets.includes(item.id)" class="ml-6 flex min-h-7 items-center gap-2 text-xs text-muted-foreground">- <input :checked="checked('connectionSecrets', item.id)" :disabled="!selection.includeSecrets || !selection.connections?.includes(item.id)" type="checkbox" class="size-3.5 accent-primary" @change="toggleId('connectionSecrets', item.id)" />+ <input :checked="checked('connectionSecrets', item.id)" :disabled="!selection.connections?.includes(item.id)" type="checkbox" class="size-3.5 accent-primary" @change="toggleSecretId('connectionSecrets', item.id, $event)" /><span>{{ t("settings.syncSelectionConnectionSecrets") }}</span></label></div>@@ -361,11 +681,21 @@ function confirmSelection() {</div></details>- <details open class="border-b pb-2">- <summary class="flex cursor-pointer list-none items-center gap-2 py-2 text-sm font-medium">- <input :checked="allSelected('tunnelProfiles', catalog.tunnelProfiles)" :disabled="!catalog.tunnelProfiles.length" type="checkbox" class="size-4 accent-primary" @click.stop @change="toggleAll('tunnelProfiles', catalog.tunnelProfiles)" />+ <details :open="!collapsedGroups.has('tunnels')" class="border-b pb-2">+ <summary class="flex cursor-pointer list-none items-center gap-2 py-2 text-sm font-medium" @click.prevent="toggleGroup('tunnels')">+ <input+ :checked="allSelected('tunnelProfiles', catalog.tunnelProfiles)"+ :indeterminate="selectionState('tunnelProfiles', catalog.tunnelProfiles) === 'partial'"+ :disabled="!catalog.tunnelProfiles.length"+ type="checkbox"+ class="size-4 accent-primary"+ @click.stop+ @change="toggleAll('tunnelProfiles', catalog.tunnelProfiles)"+ /><span>{{ t("settings.syncSelectionTunnels") }}</span><span class="ml-auto text-xs text-muted-foreground">{{ selection.tunnelProfiles?.length ?? 0 }}/{{ catalog.tunnelProfiles.length }}</span>+ <ChevronDown v-if="!collapsedGroups.has('tunnels')" class="size-4 shrink-0 text-muted-foreground" />+ <ChevronRight v-else class="size-4 shrink-0 text-muted-foreground" /></summary><div class="ml-6 space-y-1 pb-2"><div v-for="item in catalog.tunnelProfiles" :key="item.id" class="py-1">@@ -374,7 +704,7 @@ function confirmSelection() {<span class="min-w-0 truncate">{{ item.label || item.id }}</span></label><label v-if="catalog.tunnelSecrets.includes(item.id)" class="ml-6 flex min-h-7 items-center gap-2 text-xs text-muted-foreground">- <input :checked="checked('tunnelSecrets', item.id)" :disabled="!selection.includeSecrets || !selection.tunnelProfiles?.includes(item.id)" type="checkbox" class="size-3.5 accent-primary" @change="toggleId('tunnelSecrets', item.id)" />+ <input :checked="checked('tunnelSecrets', item.id)" :disabled="!selection.tunnelProfiles?.includes(item.id)" type="checkbox" class="size-3.5 accent-primary" @change="toggleSecretId('tunnelSecrets', item.id, $event)" /><span>{{ t("settings.syncSelectionTunnelSecrets") }}</span></label></div>@@ -382,20 +712,44 @@ function confirmSelection() {</div></details>- <details open class="border-b pb-2">- <summary class="flex cursor-pointer list-none items-center gap-2 py-2 text-sm font-medium">{{ t("settings.syncSelectionSavedSql") }}</summary>+ <details :open="!collapsedGroups.has('savedSql')" class="border-b pb-2">+ <summary class="flex cursor-pointer list-none items-center gap-2 py-2 text-sm font-medium" @click.prevent="toggleGroup('savedSql')">+ <input :checked="summaryState(savedSqlSummary) === 'all'" :indeterminate="summaryState(savedSqlSummary) === 'partial'" :disabled="!savedSqlSummary.total" type="checkbox" class="size-4 accent-primary" @click.stop @change="toggleSavedSql" />+ <span>{{ t("settings.syncSelectionSavedSql") }}</span>+ <span class="ml-auto text-xs text-muted-foreground">{{ savedSqlSummary.selected }}/{{ savedSqlSummary.total }}</span>+ <ChevronDown v-if="!collapsedGroups.has('savedSql')" class="size-4 shrink-0 text-muted-foreground" />+ <ChevronRight v-else class="size-4 shrink-0 text-muted-foreground" />+ </summary><div class="ml-6 space-y-2 pb-2"><div>- <button type="button" class="mb-1 text-xs font-medium text-muted-foreground hover:text-foreground" @click="toggleAll('savedSqlFolders', catalog.savedSqlFolders)">- {{ t("settings.syncSelectionFolders") }} ({{ selection.savedSqlFolders?.length ?? 0 }}/{{ catalog.savedSqlFolders.length }})- </button>+ <label class="mb-1 flex items-center gap-2 text-xs font-medium text-muted-foreground hover:text-foreground">+ <input+ :checked="allSelected('savedSqlFolders', catalog.savedSqlFolders)"+ :indeterminate="selectionState('savedSqlFolders', catalog.savedSqlFolders) === 'partial'"+ :disabled="!catalog.savedSqlFolders.length"+ type="checkbox"+ class="size-3.5 accent-primary"+ @change="toggleAll('savedSqlFolders', catalog.savedSqlFolders)"+ />+ <span>{{ t("settings.syncSelectionFolders") }} ({{ selection.savedSqlFolders?.length ?? 0 }}/{{ catalog.savedSqlFolders.length }})</span>+ </label><label v-for="item in catalog.savedSqlFolders" :key="item.id" class="flex min-h-7 items-center gap-2 pl-1 text-sm"><input :checked="checked('savedSqlFolders', item.id)" type="checkbox" class="size-4 accent-primary" @change="toggleId('savedSqlFolders', item.id)" /><span class="min-w-0 truncate">{{ item.label || item.id }}</span></label></div><div>- <button type="button" class="mb-1 text-xs font-medium text-muted-foreground hover:text-foreground" @click="toggleAll('savedSqlFiles', catalog.savedSqlFiles)">{{ t("settings.syncSelectionFiles") }} ({{ selection.savedSqlFiles?.length ?? 0 }}/{{ catalog.savedSqlFiles.length }})</button>+ <label class="mb-1 flex items-center gap-2 text-xs font-medium text-muted-foreground hover:text-foreground">+ <input+ :checked="allSelected('savedSqlFiles', catalog.savedSqlFiles)"+ :indeterminate="selectionState('savedSqlFiles', catalog.savedSqlFiles) === 'partial'"+ :disabled="!catalog.savedSqlFiles.length"+ type="checkbox"+ class="size-3.5 accent-primary"+ @change="toggleAll('savedSqlFiles', catalog.savedSqlFiles)"+ />+ <span>{{ t("settings.syncSelectionFiles") }} ({{ selection.savedSqlFiles?.length ?? 0 }}/{{ catalog.savedSqlFiles.length }})</span>+ </label><label v-for="item in catalog.savedSqlFiles" :key="item.id" class="flex min-h-7 items-center gap-2 pl-1 text-sm"><input :checked="checked('savedSqlFiles', item.id)" type="checkbox" class="size-4 accent-primary" @change="toggleId('savedSqlFiles', item.id)" /><span class="min-w-0 truncate">{{ item.label || item.id }}</span>@@ -404,58 +758,75 @@ function confirmSelection() {</div></details>- <details open class="border-b pb-2">- <summary class="flex cursor-pointer list-none items-center gap-2 py-2 text-sm font-medium">{{ t("settings.syncSelectionPersonalSettings") }}</summary>+ <details :open="!collapsedGroups.has('settings')" class="border-b pb-2">+ <summary class="flex cursor-pointer list-none items-center gap-2 py-2 text-sm font-medium" @click.prevent="toggleGroup('settings')">+ <input :checked="summaryState(settingsSummary) === 'all'" :indeterminate="summaryState(settingsSummary) === 'partial'" :disabled="!settingsSummary.total" type="checkbox" class="size-4 accent-primary" @click.stop @change="toggleAllSettings" />+ <span>{{ t("settings.syncSelectionPersonalSettings") }}</span>+ <span class="ml-auto text-xs text-muted-foreground">{{ settingsSummary.selected }}/{{ settingsSummary.total }}</span>+ <ChevronDown v-if="!collapsedGroups.has('settings')" class="size-4 shrink-0 text-muted-foreground" />+ <ChevronRight v-else class="size-4 shrink-0 text-muted-foreground" />+ </summary><div class="ml-6 space-y-1 py-2"><label v-for="category in backupSettingsCategories" :key="category.id" class="flex min-h-7 items-center gap-2 text-sm">- <input :checked="category.total > 0 && category.selected === category.total" type="checkbox" class="size-4 accent-primary" @change="toggleSettingsCategory(category.id)" />+ <input :checked="category.total > 0 && category.selected === category.total" :indeterminate="category.selected > 0 && category.selected < category.total" type="checkbox" class="size-4 accent-primary" @change="toggleSettingsCategory(category.id)" /><span>{{ t(category.labelKey) }}</span><span class="ml-auto text-xs text-muted-foreground">{{ category.selected }}/{{ category.total }}</span></label></div></details>- <details open class="border-b pb-2">- <summary class="flex cursor-pointer list-none items-center gap-2 py-2 text-sm font-medium">- <input :checked="selection.includeSecrets" type="checkbox" class="size-4 accent-primary" @click.stop @change="onSecretsChanged" />+ <details :open="!collapsedGroups.has('secrets')" class="border-b pb-2">+ <summary class="flex cursor-pointer list-none items-center gap-2 py-2 text-sm font-medium" @click.prevent="toggleGroup('secrets')">+ <input :checked="summaryState(secretsSummary) === 'all'" :indeterminate="summaryState(secretsSummary) === 'partial'" type="checkbox" class="size-4 accent-primary" @click.stop @change="onSecretsGroupChanged($event)" /><span>{{ t("settings.syncSelectionEncrypted") }}</span>+ <span class="ml-auto text-xs text-muted-foreground">{{ secretsSummary.selected }}/{{ secretsSummary.total }}</span>+ <ChevronDown v-if="!collapsedGroups.has('secrets')" class="size-4 shrink-0 text-muted-foreground" />+ <ChevronRight v-else class="size-4 shrink-0 text-muted-foreground" /></summary><div class="ml-6 space-y-2 pb-2"><p v-if="secretsPassphraseRequired" role="alert" class="text-xs text-destructive">{{ t("settings.localBackupSecretsPassphraseRequiredHint") }}</p><label class="flex min-h-7 items-center gap-2 text-sm">- <input v-model="selection.syncCredentials" :disabled="!selection.includeSecrets" type="checkbox" class="size-4 accent-primary" />+ <input :checked="selection.syncCredentials" type="checkbox" class="size-4 accent-primary" @change="onSyncCredentialsChanged($event)" /><span>{{ t("settings.syncSelectionSyncCredentials") }}</span></label><div><label v-if="catalog.aiConfigsLocked" class="flex min-h-7 items-center gap-2 text-sm">- <input :checked="selection.aiConfigs === undefined" :disabled="!selection.includeSecrets" type="checkbox" class="size-4 accent-primary" @change="toggleAllAiConfigs" />+ <input :checked="selection.aiConfigs === undefined" type="checkbox" class="size-4 accent-primary" @change="onAiConfigsToggleAll($event)" /><span>{{ t("settings.syncSelectionAiLocked") }}</span></label><template v-else>- <button type="button" class="mb-1 text-xs font-medium text-muted-foreground hover:text-foreground" :disabled="!selection.includeSecrets" @click="toggleAllAiConfigs">- {{ t("settings.syncSelectionAiConfigs") }} ({{ selection.aiConfigs?.length ?? 0 }}/{{ catalog.aiConfigs.length }})- </button>+ <label class="mb-1 flex items-center gap-2 text-xs font-medium text-muted-foreground hover:text-foreground">+ <input :checked="aiConfigsState === 'all'" :indeterminate="aiConfigsState === 'partial'" :disabled="!catalog.aiConfigs.length" type="checkbox" class="size-3.5 accent-primary" @change="onAiConfigsToggleAll($event)" />+ <span>{{ t("settings.syncSelectionAiConfigs") }} ({{ selection.aiConfigs?.length ?? 0 }}/{{ catalog.aiConfigs.length }})</span>+ </label><label v-for="item in catalog.aiConfigs" :key="item.id" class="flex min-h-7 items-center gap-2 text-sm">- <input :checked="checked('aiConfigs', item.id)" :disabled="!selection.includeSecrets" type="checkbox" class="size-4 accent-primary" @change="toggleId('aiConfigs', item.id)" />+ <input :checked="checked('aiConfigs', item.id)" type="checkbox" class="size-4 accent-primary" @change="toggleSecretId('aiConfigs', item.id, $event)" /><span class="min-w-0 truncate">{{ item.label || item.id }}</span></label></template></div><div><label v-if="catalog.pluginUiStorageLocked" class="flex min-h-7 items-center gap-2 text-sm">- <input :checked="selection.pluginUiStorage === undefined" :disabled="!selection.includeSecrets" type="checkbox" class="size-4 accent-primary" @change="togglePluginAll" />+ <input :checked="selection.pluginUiStorage === undefined" type="checkbox" class="size-4 accent-primary" @change="onPluginToggleAll($event)" /><span>{{ t("settings.syncSelectionPluginLocked") }}</span></label><template v-else>- <button type="button" class="mb-1 text-xs font-medium text-muted-foreground hover:text-foreground" :disabled="!selection.includeSecrets" @click="togglePluginAll">- {{ t("settings.syncSelectionPluginData") }} ({{ selection.pluginUiStorage?.length ?? 0 }}/{{ catalog.pluginUiStorage.length }})- </button>- <label v-for="item in catalog.pluginUiStorage" :key="item.pluginId + '/' + item.key" class="flex min-h-7 items-center gap-2 text-sm">- <input :checked="selection.pluginUiStorage?.some((entry) => entry.pluginId === item.pluginId && entry.key === item.key)" :disabled="!selection.includeSecrets" type="checkbox" class="size-4 accent-primary" @change="togglePluginItem(item.pluginId, item.key)" />- <span class="min-w-0 truncate">{{ item.pluginName || item.pluginId }} / {{ item.key }}</span>+ <label class="mb-1 flex items-center gap-2 text-xs font-medium text-muted-foreground hover:text-foreground">+ <input :checked="pluginUiStorageState === 'all'" :indeterminate="pluginUiStorageState === 'partial'" :disabled="!catalog.pluginUiStorage.length" type="checkbox" class="size-3.5 accent-primary" @change="onPluginToggleAll($event)" />+ <span>{{ t("settings.syncSelectionPluginData") }} ({{ selection.pluginUiStorage?.length ?? 0 }}/{{ catalog.pluginUiStorage.length }})</span></label>+ <div v-for="group in pluginUiGroups" :key="group.pluginId" class="pl-1">+ <label class="mb-1 flex items-center gap-2 text-xs font-medium text-muted-foreground hover:text-foreground">+ <input :checked="pluginGroupState(group) === 'all'" :indeterminate="pluginGroupState(group) === 'partial'" type="checkbox" class="size-3.5 accent-primary" @change="togglePluginGroup(group.pluginId, $event)" />+ <span class="min-w-0 truncate">{{ group.name }} ({{ pluginGroupSelected(group) }}/{{ group.items.length }})</span>+ </label>+ <label v-for="item in group.items" :key="item.key" class="flex min-h-7 items-center gap-2 pl-3 text-sm">+ <input :checked="selection.pluginUiStorage?.some((entry) => entry.pluginId === item.pluginId && entry.key === item.key)" type="checkbox" class="size-4 accent-primary" @change="togglePluginItem(item.pluginId, item.key, $event)" />+ <span class="min-w-0 truncate">{{ item.key }}</span>+ </label>+ </div><p v-if="!catalog.pluginUiStorage.length" class="text-xs text-muted-foreground">{{ t("settings.syncSelectionNoPluginData") }}</p></template></div>@@ -463,8 +834,14 @@ function confirmSelection() {</div></details>- <details open class="pb-1">- <summary class="flex cursor-pointer list-none items-center gap-2 py-2 text-sm font-medium">{{ t("settings.syncSelectionWorkspace") }}</summary>+ <details :open="!collapsedGroups.has('workspace')" class="pb-1">+ <summary class="flex cursor-pointer list-none items-center gap-2 py-2 text-sm font-medium" @click.prevent="toggleGroup('workspace')">+ <input :checked="summaryState(workspaceSummary) === 'all'" :indeterminate="summaryState(workspaceSummary) === 'partial'" :disabled="!workspaceSummary.total" type="checkbox" class="size-4 accent-primary" @click.stop @change="toggleWorkspace" />+ <span>{{ t("settings.syncSelectionWorkspace") }}</span>+ <span class="ml-auto text-xs text-muted-foreground">{{ workspaceSummary.selected }}/{{ workspaceSummary.total }}</span>+ <ChevronDown v-if="!collapsedGroups.has('workspace')" class="size-4 shrink-0 text-muted-foreground" />+ <ChevronRight v-else class="size-4 shrink-0 text-muted-foreground" />+ </summary><div class="ml-6 space-y-1 pb-2"><label class="flex min-h-7 items-center gap-2 text-sm"><input v-model="selection.sidebarLayout" :disabled="!catalog.hasSidebarLayout" type="checkbox" class="size-4 accent-primary" />@@ -498,7 +875,7 @@ function confirmSelection() {<DialogFooter class="mx-0 mb-0 shrink-0 border-t px-5 pb-4 pt-3"><Button variant="outline" @click="emit('update:open', false)">{{ t("settings.syncSelectionCancel") }}</Button>- <Button :disabled="!catalog" @click="confirmSelection">{{ isRestore ? t("settings.syncSelectionRestoreAction") : t("settings.syncSelectionUploadAction") }}</Button>+ <Button :disabled="!catalog || !hasAnySelection" @click="confirmSelection">{{ isRestore ? t("settings.syncSelectionRestoreAction") : t("settings.syncSelectionUploadAction") }}</Button></DialogFooter></DialogContent></Dialog>diff --git a/apps/desktop/src/components/editor/__tests__/CloudSyncSelectionDialog.spec.ts b/apps/desktop/src/components/editor/__tests__/CloudSyncSelectionDialog.spec.tsindex 6bc0a3a06b..47e1c84184 100644--- a/apps/desktop/src/components/editor/__tests__/CloudSyncSelectionDialog.spec.ts+++ b/apps/desktop/src/components/editor/__tests__/CloudSyncSelectionDialog.spec.ts@@ -123,6 +123,9 @@ describe.each(["restore", "upload"] as const)("CloudSyncSelectionDialog %s categawait nextTick();const section = root.querySelectorAll("details")[category === "connections" ? 0 : 1];+ section.querySelector("summary")!.click();+ await nextTick();+ expect(section.open).toBe(true);const parent = section.querySelector<HTMLInputElement>("summary input")!;expect(parent.disabled).toBe(true);parent.click();@@ -145,6 +148,9 @@ describe.each(["restore", "upload"] as const)("CloudSyncSelectionDialog %s categawait nextTick();const section = root.querySelectorAll("details")[category === "connections" ? 0 : 1];+ section.querySelector("summary")!.click();+ await nextTick();+ expect(section.open).toBe(true);const parent = section.querySelector<HTMLInputElement>("summary input")!;const children = Array.from(section.querySelectorAll<HTMLInputElement>("label input"));expect(parent.checked).toBe(true);@@ -181,3 +187,258 @@ describe.each(["restore", "upload"] as const)("CloudSyncSelectionDialog %s categexpect(children.every((child) => child.checked)).toBe(true);});});++describe.each(["restore", "upload"] as const)("CloudSyncSelectionDialog %s group controls", (mode) => {+ function mount(extra: Partial<SyncSnapshotCatalog> = {}, componentProps: Record<string, unknown> = {}) {+ root = document.createElement("div");+ document.body.append(root);+ app = createApp(CloudSyncSelectionDialog, {+ open: true,+ mode,+ catalog: { ...catalog, ...extra },+ ...componentProps,+ });+ app.mount(root);+ return nextTick();+ }++ function toolbarButton(label: string) {+ return Array.from(root!.querySelectorAll("button")).find((button) => button.textContent?.trim() === label);+ }++ it("starts collapsed, toggles a group via its summary, and expands/collapses all from the toolbar", async () => {+ await mount();+ const sections = Array.from(root!.querySelectorAll("details"));+ expect(sections).toHaveLength(6);+ expect(sections.every((section) => !section.open)).toBe(true);++ const summary = sections[0].querySelector("summary")!;+ summary.click();+ await nextTick();+ expect(sections[0].open).toBe(true);++ summary.click();+ await nextTick();+ expect(sections[0].open).toBe(false);++ toolbarButton("settings.syncSelectionExpandAll")?.click();+ await nextTick();+ expect(sections.every((section) => section.open)).toBe(true);++ toolbarButton("settings.syncSelectionCollapseAll")?.click();+ await nextTick();+ expect(sections.every((section) => !section.open)).toBe(true);+ });++ it("keeps the group open state when the summary checkbox is clicked", async () => {+ await mount({ tunnelProfiles: [{ id: "tunnel-1", label: "Tunnel" }] });+ const sections = Array.from(root!.querySelectorAll("details"));++ sections[1].querySelector<HTMLInputElement>("summary input")!.click();+ await nextTick();+ expect(sections[1].open).toBe(false);+ expect(sections[1].textContent).toContain("0/1");++ sections[1].querySelector("summary")!.click();+ await nextTick();+ expect(sections[1].open).toBe(true);++ sections[1].querySelector<HTMLInputElement>("summary input")!.click();+ await nextTick();+ expect(sections[1].open).toBe(true);+ expect(sections[1].textContent).toContain("1/1");+ });++ it("shows aggregate counts on group headers and updates them from the toolbar", async () => {+ await mount({+ savedSqlFolders: [{ id: "folder-1", label: "Folder" }],+ savedSqlFiles: [{ id: "sql-1", label: "Query" }],+ hasSidebarLayout: true,+ hasPinnedTreeNodeIds: true,+ });+ const sections = Array.from(root!.querySelectorAll("details"));+ expect(sections[0].querySelector("summary")!.textContent).toContain("1/1");+ expect(sections[2].querySelector("summary")!.textContent).toContain("2/2");+ expect(sections[5].querySelector("summary")!.textContent).toContain("2/2");++ toolbarButton("settings.syncSelectionDeselectAll")?.click();+ await nextTick();+ expect(sections[0].querySelector("summary")!.textContent).toContain("0/1");+ expect(sections[2].querySelector("summary")!.textContent).toContain("0/2");+ expect(sections[5].querySelector("summary")!.textContent).toContain("0/2");++ toolbarButton("settings.syncSelectionSelectAll")?.click();+ await nextTick();+ expect(sections[0].querySelector("summary")!.textContent).toContain("1/1");+ expect(sections[2].querySelector("summary")!.textContent).toContain("2/2");+ expect(sections[5].querySelector("summary")!.textContent).toContain("2/2");+ });++ it("shows an indeterminate state on group checkboxes when partially selected", async () => {+ await mount({+ connections: [+ { id: "connection-1", label: "Primary" },+ { id: "connection-2", label: "Secondary" },+ ],+ savedSqlFiles: [{ id: "sql-1", label: "Query" }],+ });+ const sections = Array.from(root!.querySelectorAll("details"));+ const connectionsMaster = sections[0].querySelector<HTMLInputElement>("summary input")!;+ expect(connectionsMaster.checked).toBe(true);+ expect(connectionsMaster.indeterminate).toBe(false);++ const children = Array.from(sections[0].querySelectorAll<HTMLInputElement>("label input"));+ children[0].click();+ await nextTick();+ expect(connectionsMaster.checked).toBe(false);+ expect(connectionsMaster.indeterminate).toBe(true);++ // The saved-sql group header checkbox covers folders and files together.+ const savedSqlMaster = sections[2].querySelector<HTMLInputElement>("summary input")!;+ expect(savedSqlMaster.checked).toBe(true);+ savedSqlMaster.click();+ await nextTick();+ expect(savedSqlMaster.checked).toBe(false);+ expect(savedSqlMaster.indeterminate).toBe(false);+ expect(sections[2].querySelector("summary")!.textContent).toContain("0/1");+ savedSqlMaster.click();+ await nextTick();+ expect(sections[2].querySelector("summary")!.textContent).toContain("1/1");+ });++ it("reflects a secrets child on the encrypted group checkbox", async () => {+ await mount({ connectionSecrets: ["connection-1"] }, { secretsPassphraseAvailable: true });+ const sections = Array.from(root!.querySelectorAll("details"));+ const secretsMaster = sections[4].querySelector<HTMLInputElement>("summary input")!;+ expect(secretsMaster.checked).toBe(false);++ const secretChild = sections[0].querySelectorAll<HTMLInputElement>("input")[2];+ expect(secretChild.disabled).toBe(false);+ secretChild.click();+ await nextTick();+ // One of two encrypted items selected shows a partial state on the group.+ expect(secretsMaster.checked).toBe(false);+ expect(secretsMaster.indeterminate).toBe(true);+ expect(secretChild.checked).toBe(true);+ expect(sections[4].querySelector("summary")!.textContent).toContain("1/2");++ secretChild.click();+ await nextTick();+ expect(secretsMaster.checked).toBe(false);+ expect(secretsMaster.indeterminate).toBe(false);+ expect(secretChild.checked).toBe(false);+ });++ it("keeps the secrets child off and shows the passphrase hint when no passphrase is available", async () => {+ await mount({ connectionSecrets: ["connection-1"] }, { secretsPassphraseAvailable: false });+ const sections = Array.from(root!.querySelectorAll("details"));+ const secretsMaster = sections[4].querySelector<HTMLInputElement>("summary input")!;+ const secretChild = sections[0].querySelectorAll<HTMLInputElement>("input")[2];+ expect(secretsMaster.checked).toBe(false);++ secretChild.click();+ await nextTick();+ expect(secretsMaster.checked).toBe(false);+ expect(secretChild.checked).toBe(false);+ expect(sections[4].textContent).toContain("settings.localBackupSecretsPassphraseRequiredHint");+ });++ it("disables the confirm action while nothing is selected", async () => {+ await mount();+ const actionKey = mode === "restore" ? "settings.syncSelectionRestoreAction" : "settings.syncSelectionUploadAction";+ const confirm = () => toolbarButton(actionKey) as HTMLButtonElement;+ expect(confirm()?.disabled).toBe(false);++ toolbarButton("settings.syncSelectionDeselectAll")?.click();+ await nextTick();+ expect(confirm()?.disabled).toBe(true);++ toolbarButton("settings.syncSelectionSelectAll")?.click();+ await nextTick();+ expect(confirm()?.disabled).toBe(false);+ });++ it("keeps the encrypted group checkbox linked to its items", async () => {+ await mount({ aiConfigs: [{ id: "ai-1", label: "AI" }] }, { secretsPassphraseAvailable: true });+ const sections = Array.from(root!.querySelectorAll("details"));+ const secretsMaster = sections[4].querySelector<HTMLInputElement>("summary input")!;+ const summaryText = () => sections[4].querySelector("summary")!.textContent;++ toolbarButton("settings.syncSelectionDeselectAll")?.click();+ await nextTick();+ expect(secretsMaster.checked).toBe(false);+ expect(secretsMaster.indeterminate).toBe(false);+ expect(summaryText()).toContain("0/2");++ // Checking one child turns the group on with an indeterminate state.+ sections[4].querySelectorAll<HTMLInputElement>("label input")[0].click();+ await nextTick();+ expect(secretsMaster.checked).toBe(false);+ expect(secretsMaster.indeterminate).toBe(true);+ expect(summaryText()).toContain("1/2");++ // Checking the group selects every child; unchecking clears them all.+ secretsMaster.click();+ await nextTick();+ expect(secretsMaster.checked).toBe(true);+ expect(summaryText()).toContain("2/2");++ secretsMaster.click();+ await nextTick();+ expect(secretsMaster.checked).toBe(false);+ expect(summaryText()).toContain("0/2");+ });++ it("groups plugin data under per-plugin checkboxes", async () => {+ await mount(+ {+ pluginUiStorage: [+ { pluginId: "devtools", key: "devtools:favorites", pluginName: "Dev Tools" },+ { pluginId: "devtools", key: "devtools:recent", pluginName: "Dev Tools" },+ { pluginId: "other", key: "other:flag" },+ ],+ },+ { secretsPassphraseAvailable: true },+ );+ const secretsSection = Array.from(root!.querySelectorAll("details"))[4];+ const headerLabel = Array.from(secretsSection.querySelectorAll("label")).find((label) => label.textContent?.includes("Dev Tools"))!;+ const groupDiv = headerLabel.parentElement!;+ const [groupBox, favoritesBox] = Array.from(groupDiv.querySelectorAll("input"));+ const headerText = () => headerLabel.textContent;++ expect(headerText()).toContain("Dev Tools (2/2)");+ expect(groupBox.checked).toBe(true);++ // Unchecking one child leaves the plugin box in an indeterminate state.+ favoritesBox.click();+ await nextTick();+ expect(groupBox.checked).toBe(false);+ expect(groupBox.indeterminate).toBe(true);+ expect(headerText()).toContain("Dev Tools (1/2)");++ // Checking the plugin box selects all its items; unchecking clears them.+ groupBox.click();+ await nextTick();+ expect(headerText()).toContain("Dev Tools (2/2)");+ groupBox.click();+ await nextTick();+ expect(headerText()).toContain("Dev Tools (0/2)");+ expect(groupBox.checked).toBe(false);+ expect(groupBox.indeterminate).toBe(false);+ });++ it("does not count saved secret ids that are missing from the catalog", async () => {+ // The export catalog lists every connection as secret-eligible, but the snapshot only carries+ // secrets that were actually stored, so a saved selection can keep ids that are not restorable.+ await mount(+ {+ connectionSecrets: ["connection-1"],+ selection: { connectionSecrets: ["connection-1", "gone-connection"], includeSecrets: true },+ },+ { secretsPassphraseAvailable: true },+ );+ const summary = Array.from(root!.querySelectorAll("details"))[4].querySelector("summary")!;+ expect(summary.textContent).toContain("1/2");+ expect(summary.textContent).not.toContain("2/2");+ });+});diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.tsindex f46ceb04d2..9fd5a4a216 100644--- a/apps/desktop/src/i18n/locales/en.ts+++ b/apps/desktop/src/i18n/locales/en.ts@@ -8456,6 +8456,10 @@ export default {syncSelectionCancel: "Cancel",syncSelectionRestoreAction: "Restore selected",syncSelectionUploadAction: "Back up selected",+ syncSelectionSelectAll: "Select all",+ syncSelectionDeselectAll: "Deselect all",+ syncSelectionExpandAll: "Expand all",+ syncSelectionCollapseAll: "Collapse all",syncWebDavWebDescription: "In Web mode, the DBX server accesses WebDAV without browser CORS restrictions. Saved passwords remain in the current DBX instance.",syncEndpoint: "WebDAV URL",syncUsername: "Username",diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.tsindex 1d00a9d4a8..3537252172 100644--- a/apps/desktop/src/i18n/locales/es.ts+++ b/apps/desktop/src/i18n/locales/es.ts@@ -7758,6 +7758,10 @@ export default withEnglishFallback({syncSelectionCancel: "Cancelar",syncSelectionRestoreAction: "Restaurar selección",syncSelectionUploadAction: "Respaldar selección",+ syncSelectionSelectAll: "Seleccionar todo",+ syncSelectionDeselectAll: "Deseleccionar todo",+ syncSelectionExpandAll: "Expandir todo",+ syncSelectionCollapseAll: "Contraer todo",syncWebDavWebDescription: "En modo Web, el servidor DBX accede a WebDAV sin las restricciones CORS del navegador. Las contraseñas guardadas permanecen en la instancia DBX actual.",syncEndpoint: "URL WebDAV",syncUsername: "Usuario",diff --git a/apps/desktop/src/i18n/locales/id.ts b/apps/desktop/src/i18n/locales/id.tsindex a64fc9eba0..e28dcbe576 100644--- a/apps/desktop/src/i18n/locales/id.ts+++ b/apps/desktop/src/i18n/locales/id.ts@@ -8286,6 +8286,10 @@ export default withEnglishFallback({syncSelectionCancel: "Batal",syncSelectionRestoreAction: "Pulihkan yang dipilih",syncSelectionUploadAction: "Cadangkan yang dipilih",+ syncSelectionSelectAll: "Pilih semua",+ syncSelectionDeselectAll: "Batalkan pilihan semua",+ syncSelectionExpandAll: "Perluas semua",+ syncSelectionCollapseAll: "Ciutkan semua",syncWebDavWebDescription: "Dalam mode Web, server DBX mengakses WebDAV tanpa batasan CORS browser. Kata sandi tersimpan tetap berada pada instans DBX saat ini.",syncEndpoint: "URL WebDAV",syncUsername: "Nama Pengguna",diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.tsindex 42002889b2..d856a98149 100644--- a/apps/desktop/src/i18n/locales/it.ts+++ b/apps/desktop/src/i18n/locales/it.ts@@ -7536,6 +7536,10 @@ export default withEnglishFallback({syncSelectionCancel: "Annulla",syncSelectionRestoreAction: "Ripristina selezionati",syncSelectionUploadAction: "Salva selezionati",+ syncSelectionSelectAll: "Seleziona tutto",+ syncSelectionDeselectAll: "Deseleziona tutto",+ syncSelectionExpandAll: "Espandi tutto",+ syncSelectionCollapseAll: "Comprimi tutto",syncWebDavWebDescription: "In modalità Web, il server DBX accede a WebDAV senza le limitazioni CORS del browser. Le password salvate restano nell'istanza DBX corrente.",syncEndpoint: "URL WebDAV",syncUsername: "Nome utente",diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.tsindex ab2457c18f..c654e20088 100644--- a/apps/desktop/src/i18n/locales/ja.ts+++ b/apps/desktop/src/i18n/locales/ja.ts@@ -7550,6 +7550,10 @@ export default withEnglishFallback({syncSelectionCancel: "キャンセル",syncSelectionRestoreAction: "選択した項目を復元",syncSelectionUploadAction: "選択した項目をバックアップ",+ syncSelectionSelectAll: "すべて選択",+ syncSelectionDeselectAll: "すべて解除",+ syncSelectionExpandAll: "すべて展開",+ syncSelectionCollapseAll: "すべて折りたたむ",syncWebDavWebDescription: "WebモードではDBXサーバーがWebDAVへ接続するため、ブラウザーのCORS制限を受けません。保存したパスワードは現在のDBXインスタンス内に保持されます。",syncEndpoint: "WebDAV URL",syncUsername: "ユーザー名",diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.tsindex aeca00e7fa..1b022685b7 100644--- a/apps/desktop/src/i18n/locales/ko.ts+++ b/apps/desktop/src/i18n/locales/ko.ts@@ -7332,6 +7332,10 @@ export default withEnglishFallback({syncSelectionCancel: "취소",syncSelectionRestoreAction: "선택 항목 복원",syncSelectionUploadAction: "선택 항목 백업",+ syncSelectionSelectAll: "모두 선택",+ syncSelectionDeselectAll: "모두 해제",+ syncSelectionExpandAll: "모두 펼치기",+ syncSelectionCollapseAll: "모두 접기",syncWebDavWebDescription: "Web 모드에서는 DBX 서버가 WebDAV에 연결하므로 브라우저 CORS 제한을 받지 않습니다. 저장된 비밀번호는 현재 DBX 인스턴스에 유지됩니다.",syncEndpoint: "WebDAV URL",syncUsername: "사용자 이름",diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.tsindex 69bc430b2e..91955e8879 100644--- a/apps/desktop/src/i18n/locales/pt-BR.ts+++ b/apps/desktop/src/i18n/locales/pt-BR.ts@@ -7537,6 +7537,10 @@ export default withEnglishFallback({syncSelectionCancel: "Cancelar",syncSelectionRestoreAction: "Restaurar selecionados",syncSelectionUploadAction: "Fazer backup dos selecionados",+ syncSelectionSelectAll: "Selecionar tudo",+ syncSelectionDeselectAll: "Desmarcar tudo",+ syncSelectionExpandAll: "Expandir tudo",+ syncSelectionCollapseAll: "Recolher tudo",syncWebDavWebDescription: "No modo Web, o servidor DBX acessa o WebDAV sem as restrições de CORS do navegador. As senhas salvas permanecem na instância DBX atual.",syncEndpoint: "URL do WebDAV",syncUsername: "Nome de usuário",diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.tsindex ac69959daf..e90fa43c5f 100644--- a/apps/desktop/src/i18n/locales/ru.ts+++ b/apps/desktop/src/i18n/locales/ru.ts@@ -8747,6 +8747,10 @@ export default withEnglishFallback({syncSelectionCancel: "Отмена",syncSelectionRestoreAction: "Восстановить выбранное",syncSelectionUploadAction: "Сохранить выбранное",+ syncSelectionSelectAll: "Выбрать все",+ syncSelectionDeselectAll: "Снять выбор со всех",+ syncSelectionExpandAll: "Развернуть всё",+ syncSelectionCollapseAll: "Свернуть всё",syncWebDavWebDescription: "В веб-режиме сервер DBX обращается к WebDAV без ограничений CORS браузера. Сохранённые пароли остаются в текущем экземпляре DBX.",syncEndpoint: "URL WebDAV",syncUsername: "Имя пользователя",diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.tsindex ba44548fa9..71ca71ca01 100644--- a/apps/desktop/src/i18n/locales/zh-CN.ts+++ b/apps/desktop/src/i18n/locales/zh-CN.ts@@ -8441,6 +8441,10 @@ export default withEnglishFallback({syncSelectionCancel: "取消",syncSelectionRestoreAction: "恢复所选",syncSelectionUploadAction: "备份所选",+ syncSelectionSelectAll: "全选",+ syncSelectionDeselectAll: "取消全选",+ syncSelectionExpandAll: "全部展开",+ syncSelectionCollapseAll: "全部折叠",syncWebDavWebDescription: "Web 模式下由 DBX 服务端访问 WebDAV,不受浏览器 CORS 限制;保存的密码会留在当前 DBX 实例中。",syncEndpoint: "WebDAV 地址",syncUsername: "用户名",diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.tsindex e064f89d56..73f08b09dd 100644--- a/apps/desktop/src/i18n/locales/zh-TW.ts+++ b/apps/desktop/src/i18n/locales/zh-TW.ts@@ -6884,6 +6884,10 @@ export default withEnglishFallback({syncSelectionCancel: "取消",syncSelectionRestoreAction: "還原所選項目",syncSelectionUploadAction: "備份所選項目",+ syncSelectionSelectAll: "全選",+ syncSelectionDeselectAll: "取消全選",+ syncSelectionExpandAll: "全部展開",+ syncSelectionCollapseAll: "全部摺疊",syncWebDavWebDescription: "Web 模式由 DBX 伺服器端存取 WebDAV,不受瀏覽器 CORS 限制;儲存的密碼會保留在目前 DBX 執行個體中。",syncEndpoint: "WebDAV 地址",syncUsername: "使用者名稱",