dsh-config-manager 0.8.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/adapters/mcp.js +51 -15
- package/lib/adapters/messages.d.ts +1 -0
- package/lib/adapters/messages.js +2 -0
- package/lib/adapters/patch-key-guard.d.ts +23 -0
- package/lib/adapters/patch-key-guard.js +13 -0
- package/lib/adapters/plugin-data.d.ts +19 -5
- package/lib/adapters/plugin-data.js +76 -22
- package/lib/adapters/plugins.d.ts +14 -1
- package/lib/adapters/plugins.js +204 -6
- package/lib/adapters/prompts.js +15 -4
- package/lib/adapters/test-helpers.d.ts +15 -1
- package/lib/adapters/test-helpers.js +11 -0
- package/lib/cli/actions.d.ts +7 -105
- package/lib/cli/actions.js +16 -172
- package/lib/cli/control-state.d.ts +54 -0
- package/lib/cli/control-state.js +107 -0
- package/lib/cli/help.d.ts +1 -1
- package/lib/cli/help.js +21 -14
- package/lib/cli/index.js +132 -104
- package/lib/cli/sessions-repair.js +58 -22
- package/lib/cli/web/client-script.d.ts +1 -1
- package/lib/cli/web/client-script.js +71 -5
- package/lib/cli/web/page.d.ts +9 -19
- package/lib/cli/web/page.js +277 -173
- package/lib/cli/web/routes.js +85 -25
- package/lib/cli/write-gates.d.ts +61 -0
- package/lib/cli/write-gates.js +110 -0
- package/lib/client.d.ts +196 -75
- package/lib/client.js +8139 -7487
- package/lib/core/backup.d.ts +0 -4
- package/lib/core/backup.js +21 -4
- package/lib/core/boot-rescue.d.ts +1 -1
- package/lib/core/boot-rescue.js +12 -1
- package/lib/core/boot-safety.js +37 -2
- package/lib/core/conflict-decisions.js +2 -1
- package/lib/core/exporter.js +22 -1
- package/lib/core/journal.d.ts +54 -4
- package/lib/core/journal.js +158 -35
- package/lib/core/local-plugin-host.d.ts +29 -0
- package/lib/core/local-plugin-host.js +55 -48
- package/lib/core/messages.d.ts +17 -0
- package/lib/core/messages.js +34 -0
- package/lib/core/migration-history.js +16 -9
- package/lib/core/model-tools.d.ts +2 -2
- package/lib/core/model-tools.js +20 -2
- package/lib/core/patch-chain.d.ts +65 -0
- package/lib/core/patch-chain.js +100 -0
- package/lib/core/patch-document.d.ts +32 -4
- package/lib/core/patch-document.js +48 -17
- package/lib/core/patch-secret-guard.d.ts +49 -0
- package/lib/core/patch-secret-guard.js +164 -0
- package/lib/core/reconcile.d.ts +8 -0
- package/lib/core/reconcile.js +18 -3
- package/lib/core/reinstall.d.ts +2 -0
- package/lib/core/reinstall.js +6 -2
- package/lib/core/restore.js +31 -6
- package/lib/core/section-sanitize.d.ts +32 -0
- package/lib/core/section-sanitize.js +13 -0
- package/lib/core/snapshot-diff.d.ts +30 -0
- package/lib/core/snapshot-diff.js +56 -20
- package/lib/core/startup-barrier.js +8 -2
- package/lib/core/types.d.ts +38 -1
- package/lib/core/update-check.js +51 -2
- package/lib/foreign/kernel.js +9 -2
- package/lib/foreign/read-claude-plugins.js +29 -11
- package/lib/foreign/read-dsh.js +31 -2
- package/lib/foreign/session-ir.js +50 -9
- package/lib/foreign/session-read.d.ts +8 -0
- package/lib/foreign/session-read.js +26 -0
- package/lib/index.d.ts +9 -4
- package/lib/index.js +42 -47
- package/lib/profiles/dsh-profile-io.d.ts +20 -0
- package/lib/profiles/dsh-profile-io.js +27 -0
- package/lib/profiles/dsh-profile-manager.d.ts +27 -0
- package/lib/profiles/dsh-profile-manager.js +45 -4
- package/lib/profiles/dsh-profile-runtime.d.ts +5 -1
- package/lib/profiles/dsh-profile-runtime.js +16 -3
- package/lib/profiles/process-control.d.ts +18 -1
- package/lib/profiles/process-control.js +25 -1
- package/lib/routes/profiles.js +2 -1
- package/lib/routes/sync.js +19 -1
- package/lib/schema/types.d.ts +11 -0
- package/lib/security/redaction.js +22 -6
- package/lib/sync/autosync-repeat.d.ts +27 -0
- package/lib/sync/autosync-repeat.js +23 -0
- package/lib/sync/autosync-scheduler.d.ts +47 -2
- package/lib/sync/autosync-scheduler.js +217 -53
- package/lib/sync/baseline-heal.js +7 -0
- package/lib/sync/baseline-record.d.ts +67 -0
- package/lib/sync/baseline-record.js +74 -0
- package/lib/sync/blob-store.js +13 -0
- package/lib/sync/content-diff.d.ts +39 -0
- package/lib/sync/content-diff.js +46 -0
- package/lib/sync/git/git-transport.d.ts +32 -1
- package/lib/sync/git/git-transport.js +146 -26
- package/lib/sync/github-auth.d.ts +17 -1
- package/lib/sync/github-auth.js +37 -1
- package/lib/sync/local-changes.d.ts +15 -0
- package/lib/sync/local-changes.js +39 -0
- package/lib/sync/merge-apply-plan.d.ts +38 -0
- package/lib/sync/merge-apply-plan.js +76 -0
- package/lib/sync/merge-keyed.d.ts +68 -0
- package/lib/sync/merge-keyed.js +124 -0
- package/lib/sync/messages.d.ts +1 -0
- package/lib/sync/messages.js +2 -0
- package/lib/sync/patch-line-identity.d.ts +19 -0
- package/lib/sync/patch-line-identity.js +99 -0
- package/lib/sync/pending-merge.d.ts +41 -0
- package/lib/sync/pending-merge.js +61 -0
- package/lib/sync/plugin-removals.d.ts +15 -15
- package/lib/sync/plugin-removals.js +134 -83
- package/lib/sync/push-skip.d.ts +55 -0
- package/lib/sync/push-skip.js +70 -0
- package/lib/sync/s3/s3-transport.d.ts +14 -2
- package/lib/sync/s3/s3-transport.js +72 -48
- package/lib/sync/sync-engine.d.ts +44 -51
- package/lib/sync/sync-engine.js +160 -194
- package/lib/sync/sync-history.d.ts +7 -0
- package/lib/sync/sync-state.d.ts +28 -0
- package/lib/sync/sync-state.js +20 -0
- package/lib/sync/transport.d.ts +12 -3
- package/lib/sync/transport.js +13 -4
- package/lib/sync/webdav/webdav-transport.d.ts +19 -2
- package/lib/sync/webdav/webdav-transport.js +81 -40
- package/lib/sync/workspace-merge.d.ts +8 -2
- package/lib/ui/artifact-view.d.ts +1 -1
- package/lib/ui/commands.js +5 -11
- package/lib/ui/dsh-profiles-view.d.ts +8 -3
- package/lib/ui/dsh-profiles-view.js +9 -5
- package/lib/ui/foreign-view.d.ts +14 -0
- package/lib/ui/foreign-view.js +34 -0
- package/lib/ui/i18n.d.ts +7 -1
- package/lib/ui/i18n.js +15 -2
- package/lib/ui/menu-placement.js +1 -1
- package/lib/ui/migration-consult-view.d.ts +11 -0
- package/lib/ui/migration-consult-view.js +15 -0
- package/lib/ui/overview-view.d.ts +7 -0
- package/lib/ui/overview-view.js +3 -0
- package/lib/ui/report.d.ts +9 -0
- package/lib/ui/report.js +17 -4
- package/lib/ui/selection-model.d.ts +10 -2
- package/lib/ui/selection-model.js +23 -3
- package/lib/utils/async-once.d.ts +11 -0
- package/lib/utils/async-once.js +15 -0
- package/lib/utils/patch-chain-read.d.ts +51 -0
- package/lib/utils/patch-chain-read.js +240 -0
- package/lib/utils/patch-yaml.d.ts +39 -1
- package/lib/utils/patch-yaml.js +82 -2
- package/lib/utils/paths.d.ts +13 -0
- package/lib/utils/paths.js +35 -0
- package/lib/utils/workdir-lock.js +18 -3
- package/package.json +3 -2
- package/src/adapters/mcp.test.ts +29 -0
- package/src/adapters/mcp.ts +52 -14
- package/src/adapters/messages.ts +2 -0
- package/src/adapters/patch-key-guard.ts +29 -0
- package/src/adapters/plugin-data.test.ts +126 -0
- package/src/adapters/plugin-data.ts +97 -26
- package/src/adapters/plugins.test.ts +403 -0
- package/src/adapters/plugins.ts +198 -8
- package/src/adapters/prompts.ts +15 -4
- package/src/adapters/test-helpers.ts +15 -1
- package/src/cli/actions.test.ts +74 -1
- package/src/cli/actions.ts +27 -246
- package/src/cli/control-state.ts +143 -0
- package/src/cli/help.ts +21 -14
- package/src/cli/index.ts +123 -107
- package/src/cli/sessions-repair.ts +55 -22
- package/src/cli/web/client-script.ts +71 -5
- package/src/cli/web/page.ts +327 -208
- package/src/cli/web/routes.ts +85 -25
- package/src/cli/web/web.test.ts +65 -0
- package/src/cli/write-gates.ts +149 -0
- package/src/client/ConfigManagerSection.tsx +8 -4
- package/src/client/about/AboutPanel.tsx +9 -12
- package/src/client/about/release-notes-view.test.ts +17 -0
- package/src/client/about/release-notes-view.ts +49 -24
- package/src/client/api.ts +2 -1
- package/src/client/chat/ChatEntryView.tsx +2 -2
- package/src/client/chat/rollback-entry-view.ts +6 -1
- package/src/client/common/CommandPalette.tsx +6 -3
- package/src/client/common/ConfirmDialog.tsx +29 -12
- package/src/client/common/ContentPicker.tsx +24 -24
- package/src/client/common/Modal.tsx +12 -5
- package/src/client/common/MoreMenu.tsx +4 -1
- package/src/client/common/RunsCenter.tsx +103 -32
- package/src/client/common/Select.tsx +2 -2
- package/src/client/common/floating-bounds.ts +1 -1
- package/src/client/common/floating-units.test.ts +1 -2
- package/src/client/common/plan-text-redaction.test.ts +190 -5
- package/src/client/common/runs-center-guard.test.ts +60 -0
- package/src/client/common/runs-center-view.test.ts +128 -0
- package/src/client/common/runs-center-view.ts +96 -0
- package/src/client/common/section-title-action.test.ts +66 -0
- package/src/client/common/ui.tsx +93 -30
- package/src/client/config-manager.module.css +1515 -270
- package/src/client/consult/ConsultCard.tsx +7 -6
- package/src/client/environment/EnvironmentPanel.tsx +22 -25
- package/src/client/environment/maintenance/DiskUsageCard.tsx +69 -96
- package/src/client/environment/profiles-incomplete-ui.test.ts +8 -8
- package/src/client/export/ExportView.tsx +7 -16
- package/src/client/history/HistoryPanel.tsx +88 -28
- package/src/client/history/history-locales.ts +3 -3
- package/src/client/home/BackupScheduleCard.tsx +77 -69
- package/src/client/home/HomePanel.tsx +47 -12
- package/src/client/import/ConflictList.tsx +13 -13
- package/src/client/import/ForeignImportView.tsx +67 -9
- package/src/client/import/ImportWizardView.tsx +4 -4
- package/src/client/import/PathMappingForm.tsx +36 -9
- package/src/client/import/PathPickerDialog.tsx +2 -1
- package/src/client/import/import-wizard-split.test.ts +1 -1
- package/src/client/import/import-wizard-steps.tsx +51 -39
- package/src/client/import/use-import-wizard-controller.test.ts +129 -0
- package/src/client/import/use-import-wizard-controller.ts +116 -22
- package/src/client/library/ArtifactRow.tsx +2 -2
- package/src/client/library/BackupInspectView.tsx +21 -15
- package/src/client/library/LibraryActions.tsx +116 -28
- package/src/client/library/LibraryPanel.tsx +14 -15
- package/src/client/library/RestorePlanView.tsx +13 -8
- package/src/client/locales/about.ts +0 -2
- package/src/client/locales/backup.ts +15 -12
- package/src/client/locales/common.ts +2 -0
- package/src/client/locales/export.ts +5 -12
- package/src/client/locales/foreign.ts +4 -2
- package/src/client/locales/import.ts +5 -2
- package/src/client/locales/overview.ts +4 -0
- package/src/client/locales/profiles.ts +32 -4
- package/src/client/locales/restore.ts +2 -2
- package/src/client/locales/sessions.ts +0 -2
- package/src/client/locales/shell.ts +2 -2
- package/src/client/market/MarketImportReview.tsx +4 -4
- package/src/client/market/MarketPanel.tsx +58 -56
- package/src/client/market/MyConfigsList.tsx +34 -32
- package/src/client/market/MyConfigsLoginCard.tsx +12 -15
- package/src/client/market/MyConfigsView.tsx +8 -15
- package/src/client/market/MyConfigsWizard.tsx +7 -12
- package/src/client/market/market-locales.ts +0 -6
- package/src/client/market/my-configs-split.test.ts +2 -1
- package/src/client/nav-menu-clip-guard.test.ts +52 -0
- package/src/client/recovery/IncompleteCopiesSection.tsx +1 -3
- package/src/client/recovery/RecoveryPanel.tsx +35 -22
- package/src/client/recovery/RollbackCard.tsx +132 -75
- package/src/client/recovery/RollbackFileChanges.tsx +40 -27
- package/src/client/recovery/SessionHealthCard.tsx +2 -2
- package/src/client/recovery/SessionHealthDialog.tsx +5 -7
- package/src/client/recovery/SessionLayoutSection.tsx +3 -5
- package/src/client/recovery/recovery-locales.ts +12 -8
- package/src/client/recovery/rollback-enabled.ts +29 -0
- package/src/client/recovery/use-recovery-write.ts +5 -0
- package/src/client/run-store.test.ts +30 -0
- package/src/client/run-store.ts +21 -1
- package/src/client/sync/AddChannelCard.tsx +65 -0
- package/src/client/sync/AutosyncCard.tsx +184 -108
- package/src/client/sync/ChannelClearConfirmDialog.tsx +5 -1
- package/src/client/sync/ChannelConfigDialog.tsx +27 -48
- package/src/client/sync/MergePreviewView.tsx +5 -7
- package/src/client/sync/PushPreviewCard.tsx +2 -1
- package/src/client/sync/PushReportSections.tsx +35 -0
- package/src/client/sync/SyncChannelEntryCard.tsx +33 -24
- package/src/client/sync/SyncConfirmView.tsx +130 -133
- package/src/client/sync/SyncLogList.tsx +29 -14
- package/src/client/sync/SyncPanel.tsx +188 -185
- package/src/client/sync/SyncProbeRow.tsx +5 -7
- package/src/client/sync/SyncRepositoryPicker.tsx +17 -4
- package/src/client/sync/SyncSecuritySection.tsx +157 -0
- package/src/client/sync/SyncSettingsDialog.tsx +293 -0
- package/src/client/sync/SyncSettingsView.test.ts +26 -8
- package/src/client/sync/WorkDirCard.tsx +2 -4
- package/src/client/sync/config-clear-guard.test.ts +94 -0
- package/src/client/sync/config-clear-guard.ts +98 -0
- package/src/client/sync/config-dirty.test.ts +91 -0
- package/src/client/sync/config-dirty.ts +88 -0
- package/src/client/sync/history-model.test.ts +2 -0
- package/src/client/sync/history-model.ts +5 -0
- package/src/client/sync/merge-request.ts +20 -0
- package/src/client/sync/sync-api.ts +13 -1
- package/src/client/sync/sync-locales.ts +95 -47
- package/src/client/sync/sync-panel-clear.test.ts +44 -0
- package/src/client/sync/sync-push-preview.test.ts +9 -0
- package/src/client/sync/sync-view.test.ts +20 -0
- package/src/client/sync/sync-view.ts +76 -4
- package/src/core/backup.test.ts +61 -1
- package/src/core/backup.ts +21 -4
- package/src/core/boot-rescue.test.ts +35 -0
- package/src/core/boot-rescue.ts +13 -2
- package/src/core/boot-safety.test.ts +25 -0
- package/src/core/boot-safety.ts +37 -2
- package/src/core/conflict-decisions.ts +2 -1
- package/src/core/exporter.ts +21 -1
- package/src/core/journal.test.ts +183 -0
- package/src/core/journal.ts +163 -25
- package/src/core/local-plugin-host.test.ts +68 -2
- package/src/core/local-plugin-host.ts +31 -4
- package/src/core/messages.ts +34 -0
- package/src/core/migration-history.test.ts +27 -0
- package/src/core/migration-history.ts +12 -4
- package/src/core/model-tools.test.ts +67 -0
- package/src/core/model-tools.ts +22 -4
- package/src/core/patch-chain.test.ts +83 -0
- package/src/core/patch-chain.ts +150 -0
- package/src/core/patch-document.test.ts +48 -1
- package/src/core/patch-document.ts +66 -15
- package/src/core/patch-layers.test.ts +1 -1
- package/src/core/patch-secret-guard.test.ts +110 -0
- package/src/core/patch-secret-guard.ts +176 -0
- package/src/core/reconcile.ts +32 -4
- package/src/core/reinstall.ts +8 -2
- package/src/core/restore.ts +32 -7
- package/src/core/section-sanitize.ts +37 -0
- package/src/core/smoke.test.ts +2 -1
- package/src/core/snapshot-diff.test.ts +73 -1
- package/src/core/snapshot-diff.ts +66 -21
- package/src/core/startup-barrier.test.ts +64 -0
- package/src/core/startup-barrier.ts +8 -2
- package/src/core/types.ts +43 -2
- package/src/core/update-check.test.ts +40 -0
- package/src/core/update-check.ts +53 -2
- package/src/foreign/claude-code.test.ts +5 -0
- package/src/foreign/claude-plugins.test.ts +57 -0
- package/src/foreign/claude-sessions-bytes.test.ts +7 -1
- package/src/foreign/dsh.test.ts +23 -0
- package/src/foreign/kernel.ts +9 -2
- package/src/foreign/read-claude-plugins.ts +32 -11
- package/src/foreign/read-dsh.ts +33 -2
- package/src/foreign/session-ir.test.ts +67 -0
- package/src/foreign/session-ir.ts +54 -14
- package/src/foreign/session-read.ts +23 -0
- package/src/index.facade.test.ts +186 -6
- package/src/index.ts +53 -47
- package/src/profiles/dsh-profile-copy-rollback.test.ts +58 -4
- package/src/profiles/dsh-profile-io.ts +29 -0
- package/src/profiles/dsh-profile-manager.test.ts +30 -0
- package/src/profiles/dsh-profile-manager.ts +53 -5
- package/src/profiles/dsh-profile-runtime.test.ts +29 -7
- package/src/profiles/dsh-profile-runtime.ts +17 -3
- package/src/profiles/process-control.test.ts +97 -0
- package/src/profiles/process-control.ts +28 -1
- package/src/routes/profiles.ts +2 -1
- package/src/routes/sync.ts +19 -1
- package/src/schema/types.ts +16 -1
- package/src/security/redaction.test.ts +31 -0
- package/src/security/redaction.ts +23 -6
- package/src/security/security.test.ts +1 -1
- package/src/sync/autosync-repeat.test.ts +58 -0
- package/src/sync/autosync-repeat.ts +55 -0
- package/src/sync/autosync-scheduler.test.ts +515 -0
- package/src/sync/autosync-scheduler.ts +225 -51
- package/src/sync/baseline-heal.ts +6 -0
- package/src/sync/baseline-record.ts +135 -0
- package/src/sync/blob-store.test.ts +16 -0
- package/src/sync/blob-store.ts +13 -0
- package/src/sync/content-diff.test.ts +95 -0
- package/src/sync/content-diff.ts +79 -0
- package/src/sync/git/git-transport.test.ts +151 -4
- package/src/sync/git/git-transport.ts +143 -27
- package/src/sync/github-auth.test.ts +26 -1
- package/src/sync/github-auth.ts +37 -1
- package/src/sync/local-changes.ts +40 -0
- package/src/sync/merge-apply-plan.ts +117 -0
- package/src/sync/merge-keyed.test.ts +167 -0
- package/src/sync/merge-keyed.ts +160 -0
- package/src/sync/messages.ts +3 -0
- package/src/sync/patch-line-identity.test.ts +73 -0
- package/src/sync/patch-line-identity.ts +105 -0
- package/src/sync/pending-merge.test.ts +41 -0
- package/src/sync/pending-merge.ts +85 -0
- package/src/sync/plugin-removals.test.ts +199 -39
- package/src/sync/plugin-removals.ts +150 -64
- package/src/sync/push-skip.test.ts +326 -0
- package/src/sync/push-skip.ts +102 -0
- package/src/sync/s3/s3-delete-and-blob-index.test.ts +249 -0
- package/src/sync/s3/s3-transport.ts +76 -42
- package/src/sync/sync-config.test.ts +39 -12
- package/src/sync/sync-device-identity.test.ts +3 -0
- package/src/sync/sync-engine.test.ts +465 -12
- package/src/sync/sync-engine.ts +189 -193
- package/src/sync/sync-history.ts +7 -0
- package/src/sync/sync-state.ts +48 -0
- package/src/sync/transport.test.ts +13 -1
- package/src/sync/transport.ts +12 -4
- package/src/sync/webdav/webdav-delete-and-blob-index.test.ts +249 -0
- package/src/sync/webdav/webdav-transport.ts +86 -34
- package/src/sync/workspace-merge.ts +9 -2
- package/src/ui/artifact-view.ts +1 -1
- package/src/ui/commands.test.ts +11 -0
- package/src/ui/commands.ts +5 -14
- package/src/ui/dsh-profiles-view.test.ts +16 -0
- package/src/ui/dsh-profiles-view.ts +11 -5
- package/src/ui/foreign-view.test.ts +49 -0
- package/src/ui/foreign-view.ts +47 -0
- package/src/ui/i18n.ts +15 -2
- package/src/ui/menu-placement.ts +1 -1
- package/src/ui/migration-consult-view.test.ts +20 -1
- package/src/ui/migration-consult-view.ts +17 -0
- package/src/ui/overview-view.ts +10 -0
- package/src/ui/report.test.ts +25 -1
- package/src/ui/report.ts +15 -4
- package/src/ui/selection-model.test.ts +29 -1
- package/src/ui/selection-model.ts +25 -4
- package/src/utils/async-once.ts +14 -0
- package/src/utils/js-yaml4.d.ts +35 -0
- package/src/utils/patch-chain-read.test.ts +171 -0
- package/src/utils/patch-chain-read.ts +259 -0
- package/src/utils/patch-yaml.test.ts +215 -3
- package/src/utils/patch-yaml.ts +98 -2
- package/src/utils/paths.test.ts +14 -1
- package/src/utils/paths.ts +35 -0
- package/src/utils/workdir-lock.test.ts +69 -0
- package/src/utils/workdir-lock.ts +17 -3
- package/lib/ui/path-mapping.d.ts +0 -38
- package/lib/ui/path-mapping.js +0 -75
- package/src/client/common/InfoHint.tsx +0 -289
- package/src/client/common/info-hint-guard.test.ts +0 -1119
- package/src/client/sync/DecryptPasswordCard.tsx +0 -48
- package/src/client/sync/SecurityOptionsCard.tsx +0 -97
- package/src/client/sync/SyncSectionPickerDialog.tsx +0 -213
- package/src/ui/path-mapping.test.ts +0 -67
- package/src/ui/path-mapping.ts +0 -103
|
@@ -13,12 +13,13 @@ import type { ReactNode } from 'react'
|
|
|
13
13
|
import { useEffect } from 'react'
|
|
14
14
|
|
|
15
15
|
import { redact } from '../../security/redaction.ts'
|
|
16
|
-
import { Badge, Banner, Button } from '../common/ui.tsx'
|
|
16
|
+
import { Badge, Banner, Button, Checkbox } from '../common/ui.tsx'
|
|
17
|
+
import { Modal } from '../common/Modal.tsx'
|
|
17
18
|
import { Skeleton } from '../common/Skeleton.tsx'
|
|
18
19
|
import { toast } from '../common/toast-store.ts'
|
|
19
20
|
import { ConsultCard } from '../consult/ConsultCard.tsx'
|
|
20
21
|
import type { ConsultReport } from '../../core/migration-consult.ts'
|
|
21
|
-
import type { SyncApi, SyncConfirmItem } from './sync-api.ts'
|
|
22
|
+
import type { SyncApi, SyncConfirmItem, SyncPushPayload } from './sync-api.ts'
|
|
22
23
|
import {
|
|
23
24
|
buildAdoptions, confirmListSummary, hasBulkDecidable, isBulkDecidable, keepLocalAll, kindLabel, reviewItems, severityLabel,
|
|
24
25
|
summarizeConfirmItems, useRemoteAll, type BulkDecision, type SyncConflictResolution,
|
|
@@ -61,6 +62,10 @@ export interface SyncConfirmViewProps {
|
|
|
61
62
|
onCancel: () => void
|
|
62
63
|
/** 回滚成功后回调(清空 lastRestoreId)。 */
|
|
63
64
|
onRollbackDone?: () => void
|
|
65
|
+
/** 当前通道的远端连接参数(供 consult 远端快照定位通道) */
|
|
66
|
+
remoteChannelBody?: SyncPushPayload
|
|
67
|
+
/** 分区可读名映射(避免直接渲染裸 SectionId) */
|
|
68
|
+
sectionName?: (id: string) => string
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
/** 冲突解决方式:与导入恢复向导一致的两项(保留当前 / 使用备份)。 */
|
|
@@ -73,7 +78,7 @@ interface ItemState {
|
|
|
73
78
|
}
|
|
74
79
|
|
|
75
80
|
export function SyncConfirmView(props: SyncConfirmViewProps): ReactNode {
|
|
76
|
-
const { api, syncSessionId, snapshotId, items, needsReview, compatibility, t, decisions, onDecisionsChange, onCancel, onRollbackDone } = props;
|
|
81
|
+
const { api, syncSessionId, snapshotId, items, needsReview, compatibility, t, decisions, onDecisionsChange, onCancel, onRollbackDone, remoteChannelBody, sectionName } = props;
|
|
77
82
|
// 逐项决策状态(受控:来自 props.decisions;null 时按 defaultAdopt 初始化;持久化决策覆盖同名项)
|
|
78
83
|
const states = useMemo<Record<string, ItemState>>(() => {
|
|
79
84
|
const base: Record<string, ItemState> = {};
|
|
@@ -98,7 +103,7 @@ export function SyncConfirmView(props: SyncConfirmViewProps): ReactNode {
|
|
|
98
103
|
useEffect(() => {
|
|
99
104
|
let cancelled = false;
|
|
100
105
|
setConsultLoading(true);
|
|
101
|
-
api.consult({ type: 'remote-snapshot', id: snapshotId, snapshotId })
|
|
106
|
+
api.consult({ ...(remoteChannelBody ?? {}), type: 'remote-snapshot', id: snapshotId, snapshotId })
|
|
102
107
|
.then((report) => { if (!cancelled) setConsultReport(report); })
|
|
103
108
|
.catch(() => { if (!cancelled) setConsultReport(null); })
|
|
104
109
|
.finally(() => { if (!cancelled) setConsultLoading(false); });
|
|
@@ -184,7 +189,7 @@ export function SyncConfirmView(props: SyncConfirmViewProps): ReactNode {
|
|
|
184
189
|
}
|
|
185
190
|
} catch (err) {
|
|
186
191
|
setPhase('failed');
|
|
187
|
-
setError(err instanceof Error ? err.message : String(err));
|
|
192
|
+
setError(redact(err instanceof Error ? err.message : String(err)));
|
|
188
193
|
}
|
|
189
194
|
};
|
|
190
195
|
|
|
@@ -220,7 +225,7 @@ export function SyncConfirmView(props: SyncConfirmViewProps): ReactNode {
|
|
|
220
225
|
}
|
|
221
226
|
} catch (err) {
|
|
222
227
|
setPhase('failed');
|
|
223
|
-
setError(err instanceof Error ? err.message : String(err));
|
|
228
|
+
setError(redact(err instanceof Error ? err.message : String(err)));
|
|
224
229
|
}
|
|
225
230
|
};
|
|
226
231
|
|
|
@@ -228,134 +233,116 @@ export function SyncConfirmView(props: SyncConfirmViewProps): ReactNode {
|
|
|
228
233
|
|
|
229
234
|
if (items.length === 0) {
|
|
230
235
|
return (
|
|
231
|
-
|
|
232
|
-
<
|
|
233
|
-
|
|
236
|
+
<>
|
|
237
|
+
<Modal.Body scroll style={{ maxHeight: '72vh' }}>
|
|
238
|
+
<div className={css.blockStack}>
|
|
239
|
+
<Banner kind="ok">{t('syncflow.empty')}</Banner>
|
|
240
|
+
</div>
|
|
241
|
+
</Modal.Body>
|
|
242
|
+
<Modal.Footer>
|
|
234
243
|
<Button disabled={busy} onClick={() => { void runCancel() }}>
|
|
235
244
|
{t('common.close')}
|
|
236
245
|
</Button>
|
|
237
|
-
</
|
|
238
|
-
|
|
246
|
+
</Modal.Footer>
|
|
247
|
+
</>
|
|
239
248
|
);
|
|
240
249
|
}
|
|
241
250
|
|
|
242
251
|
return (
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
<
|
|
249
|
-
{
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
各占一段只会把列表推到更低处。autoCount=0 时后半句不显示(没有差集可交代)。 */}
|
|
261
|
-
<div className={css.hint}>
|
|
262
|
-
{t('syncflow.adoptHint')}
|
|
263
|
-
{listSummary.autoCount > 0 && (
|
|
264
|
-
<> · {t('syncflow.listScope', { review: String(listSummary.reviewCount), auto: String(listSummary.autoCount) })}</>
|
|
265
|
-
)}
|
|
266
|
-
</div>
|
|
252
|
+
<>
|
|
253
|
+
<Modal.Body scroll style={{ maxHeight: '72vh' }}>
|
|
254
|
+
<div className={css.blockStack}>
|
|
255
|
+
{/* 状态与计数一律徽章,不再先来一条整句 Banner:此前 Banner 与下面的徽章把「共 N 项差异」
|
|
256
|
+
在同一屏里说了两遍。映射用 src/ui 的纯函数(等级 + 语义色),文案走 sync 字典 —— 不在这里另写分级规则。 */}
|
|
257
|
+
<div className={css.statRow}>
|
|
258
|
+
{compatibility !== undefined && (
|
|
259
|
+
<Badge kind={compatibilityBadgeKind(compatibilityLevel(compatibility))}>
|
|
260
|
+
{t(SYNC_COMPAT_KEYS[compatibilityLevel(compatibility)])}
|
|
261
|
+
</Badge>
|
|
262
|
+
)}
|
|
263
|
+
{needsReview && <Badge kind="warn">{t('syncflow.needsReviewBadge')}</Badge>}
|
|
264
|
+
{/* 一个徽章给两个数字:本次会导入几项 / 差异几项(原来的「共 N 项差异」与此重复) */}
|
|
265
|
+
<Badge kind="ok">{t('syncflow.adoptRemote')} {summary.adopted}/{summary.total}</Badge>
|
|
266
|
+
{summary.error > 0 && <Badge kind="error">{severityLabel('error', api.t)} × {summary.error}</Badge>}
|
|
267
|
+
{summary.warning > 0 && <Badge kind="warn">{severityLabel('warning', api.t)} × {summary.warning}</Badge>}
|
|
268
|
+
</div>
|
|
267
269
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
</Button>
|
|
277
|
-
<span className={css.hint}>
|
|
278
|
-
{t('syncflow.bulkHint', { n: String(bulkCount) })}
|
|
279
|
-
{summary.error > 0 && <> · {t('syncflow.bulkErrorNote')}</>}
|
|
280
|
-
</span>
|
|
281
|
-
</div>
|
|
270
|
+
{/* 列表图例(合成一行):勾选框怎么读 + 列表为什么比全量短。两件事都在解释下面这张列表,
|
|
271
|
+
各占一段只会把列表推到更低处。autoCount=0 时后半句不显示(没有差集可交代)。 */}
|
|
272
|
+
<div className={css.hint}>
|
|
273
|
+
{t('syncflow.adoptHint')}
|
|
274
|
+
{listSummary.autoCount > 0 && (
|
|
275
|
+
<> · {t('syncflow.listScope', { review: String(listSummary.reviewCount), auto: String(listSummary.autoCount) })}</>
|
|
276
|
+
)}
|
|
277
|
+
</div>
|
|
282
278
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
checked={st.adopted}
|
|
298
|
-
disabled={busy}
|
|
299
|
-
onChange={(e) => { setAdopted(it.itemId, e.target.checked) }}
|
|
300
|
-
/>
|
|
301
|
-
<span>{kindLabel(it.kind, api.t)}</span>
|
|
302
|
-
</label>
|
|
303
|
-
<Badge kind={it.severity === 'error' ? 'error' : it.severity === 'warning' ? 'warn' : 'info'}>
|
|
304
|
-
{severityLabel(it.severity, api.t)}
|
|
305
|
-
</Badge>
|
|
306
|
-
{/* 同步差异项描述由宿主/引擎拼装,可能含本地配置值 → 渲染前过 redact(安全自查) */}
|
|
307
|
-
<span className={css.confirmItemDesc}>{redact(it.description)}</span>
|
|
308
|
-
</div>
|
|
309
|
-
{isConflict && (
|
|
310
|
-
<ConflictResolver
|
|
311
|
-
item={it}
|
|
312
|
-
resolution={st.resolution}
|
|
313
|
-
busy={busy}
|
|
314
|
-
t={t}
|
|
315
|
-
onResolve={(r) => { setResolution(it.itemId, r) }}
|
|
316
|
-
/>
|
|
317
|
-
)}
|
|
318
|
-
</div>
|
|
319
|
-
);
|
|
320
|
-
})}
|
|
321
|
-
</div>
|
|
322
|
-
</div>
|
|
279
|
+
{/* 批量决策(快捷方式,一律 ghost —— primary 只留给弹窗底部真正的主操作「确认导入」)。
|
|
280
|
+
作用范围标在按钮行尾:能批量决策几项、错误项为什么只能逐项处理。 */}
|
|
281
|
+
<div className={css.actionRow}>
|
|
282
|
+
<Button variant="ghost" disabled={busy || !bulkDecidable} onClick={() => { applyBulkDecision(keepLocalAll(items)) }}>
|
|
283
|
+
{t('syncflow.keepLocalAll')}
|
|
284
|
+
</Button>
|
|
285
|
+
<Button variant="ghost" disabled={busy || !bulkDecidable} onClick={() => { applyBulkDecision(useRemoteAll(items)) }}>
|
|
286
|
+
{t('syncflow.useRemoteAll')}
|
|
287
|
+
</Button>
|
|
288
|
+
<span className={css.hint}>
|
|
289
|
+
{t('syncflow.bulkHint', { n: String(bulkCount) })}
|
|
290
|
+
{summary.error > 0 && <> · {t('syncflow.bulkErrorNote')}</>}
|
|
291
|
+
</span>
|
|
292
|
+
</div>
|
|
323
293
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
294
|
+
{/* 逐项差异列表(仅需人工决策的项);固定容器限高 + 内部滚动,防止整页被拉长 */}
|
|
295
|
+
<div className={css.confirmScroll}>
|
|
296
|
+
<div className={css.reportList}>
|
|
297
|
+
{displayItems.map((it) => {
|
|
298
|
+
const st = states[it.itemId] ?? { adopted: it.defaultAdopt };
|
|
299
|
+
const isConflict = it.kind === 'Conflict';
|
|
300
|
+
return (
|
|
301
|
+
<div key={it.itemId} className={css.confirmItem}>
|
|
302
|
+
{/* 首行 = 勾选 + 类型 + 级别 + 描述;冲突的解决方式另起一行 ——
|
|
303
|
+
此前它们挤在同一个 flex 行里,描述被压成窄列、勾选框被撑高的冲突块顶到垂直居中。 */}
|
|
304
|
+
<div className={css.confirmItemHead}>
|
|
305
|
+
<Checkbox
|
|
306
|
+
checked={st.adopted}
|
|
307
|
+
disabled={busy}
|
|
308
|
+
onChange={(checked) => { setAdopted(it.itemId, checked) }}
|
|
309
|
+
label={kindLabel(it.kind, api.t)}
|
|
310
|
+
/>
|
|
311
|
+
<Badge kind={it.severity === 'error' ? 'error' : it.severity === 'warning' ? 'warn' : 'info'}>
|
|
312
|
+
{severityLabel(it.severity, api.t)}
|
|
313
|
+
</Badge>
|
|
314
|
+
{/* 同步差异项描述由宿主/引擎拼装,可能含本地配置值 → 渲染前过 redact(安全自查) */}
|
|
315
|
+
<span className={css.confirmItemDesc}>{redact(it.description)}</span>
|
|
316
|
+
</div>
|
|
317
|
+
{isConflict && (
|
|
318
|
+
<ConflictResolver
|
|
319
|
+
item={it}
|
|
320
|
+
resolution={st.resolution}
|
|
321
|
+
busy={busy}
|
|
322
|
+
t={t}
|
|
323
|
+
onResolve={(r) => { setResolution(it.itemId, r) }}
|
|
324
|
+
/>
|
|
325
|
+
)}
|
|
326
|
+
</div>
|
|
327
|
+
);
|
|
328
|
+
})}
|
|
329
|
+
</div>
|
|
330
|
+
</div>
|
|
327
331
|
|
|
328
|
-
|
|
332
|
+
{/* Phase 7 迁移前咨询卡(只读健康评分 + 建议) */}
|
|
333
|
+
{consultLoading && <Skeleton shape="line" count={5} label={api.t('consult.loading')} />}
|
|
334
|
+
{consultReport !== null && <ConsultCard report={consultReport} t={api.t} />}
|
|
329
335
|
|
|
330
|
-
|
|
331
|
-
{phase === 'idle' && (
|
|
332
|
-
<div className={css.actionRow}>
|
|
333
|
-
<Button variant="primary" disabled={busy || summary.adopted === 0} onClick={() => { void runApply() }}>
|
|
334
|
-
{t('syncflow.confirmImport')}
|
|
335
|
-
</Button>
|
|
336
|
-
<Button disabled={busy} onClick={() => { void runCancel() }}>
|
|
337
|
-
{t('syncflow.cancel')}
|
|
338
|
-
</Button>
|
|
339
|
-
</div>
|
|
340
|
-
)}
|
|
336
|
+
{error !== null && <Banner kind="error">{error}</Banner>}
|
|
341
337
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
<Button variant="primary" disabled={busy} onClick={() => { onCancel() }}>
|
|
348
|
-
{t('common.close')}
|
|
349
|
-
</Button>
|
|
350
|
-
</div>
|
|
351
|
-
</>
|
|
352
|
-
)}
|
|
353
|
-
{(phase === 'done' || phase === 'failed') && applyResult === null && (
|
|
354
|
-
<>
|
|
355
|
-
{/* 诚实性(2026-10):回滚未完成(full=false)时逐条列出未恢复项与人工提示,
|
|
356
|
-
绝不用「已回滚」这一句话盖过去。完整回滚仍走 Toast(见 runRollback)。 */}
|
|
357
|
-
{rollbackResult !== null && rollbackResult.full === false && (
|
|
338
|
+
{/* 执行结果 */}
|
|
339
|
+
{(phase === 'done' || phase === 'failed') && applyResult !== null && (
|
|
340
|
+
<ApplyResultCard result={applyResult} busy={busy} t={t} sectionName={sectionName} onRollback={runRollback} />
|
|
341
|
+
)}
|
|
342
|
+
{(phase === 'done' || phase === 'failed') && applyResult === null && rollbackResult !== null && rollbackResult.full === false && (
|
|
358
343
|
<>
|
|
344
|
+
{/* 诚实性(2026-10):回滚未完成(full=false)时逐条列出未恢复项与人工提示,
|
|
345
|
+
绝不用「已回滚」这一句话盖过去。完整回滚仍走 Toast(见 runRollback)。 */}
|
|
359
346
|
<Banner kind="error">
|
|
360
347
|
{t('syncflow.rollbackIncomplete', { n: String((rollbackResult.failed ?? []).length) })}
|
|
361
348
|
</Banner>
|
|
@@ -374,17 +361,26 @@ export function SyncConfirmView(props: SyncConfirmViewProps): ReactNode {
|
|
|
374
361
|
)}
|
|
375
362
|
</>
|
|
376
363
|
)}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
364
|
+
</div>
|
|
365
|
+
</Modal.Body>
|
|
366
|
+
<Modal.Footer>
|
|
367
|
+
{(phase === 'idle' || phase === 'applying' || phase === 'cancelling') && (
|
|
368
|
+
<>
|
|
369
|
+
<Button variant="primary" loading={phase === 'applying'} disabled={busy || summary.adopted === 0} onClick={() => { void runApply() }}>
|
|
370
|
+
{t('syncflow.confirmImport')}
|
|
383
371
|
</Button>
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
372
|
+
<Button disabled={busy} onClick={() => { void runCancel() }}>
|
|
373
|
+
{t('syncflow.cancel')}
|
|
374
|
+
</Button>
|
|
375
|
+
</>
|
|
376
|
+
)}
|
|
377
|
+
{(phase === 'done' || phase === 'failed') && (
|
|
378
|
+
<Button variant="primary" disabled={busy} onClick={() => { onCancel() }}>
|
|
379
|
+
{t('common.close')}
|
|
380
|
+
</Button>
|
|
381
|
+
)}
|
|
382
|
+
</Modal.Footer>
|
|
383
|
+
</>
|
|
388
384
|
);
|
|
389
385
|
}
|
|
390
386
|
|
|
@@ -444,10 +440,11 @@ interface ApplyResultCardProps {
|
|
|
444
440
|
result: ApplyItemsResponse
|
|
445
441
|
busy: boolean
|
|
446
442
|
t: TranslateNS<'config-manager-sync'>
|
|
443
|
+
sectionName?: (id: string) => string
|
|
447
444
|
onRollback: (restoreId: string) => Promise<void>
|
|
448
445
|
}
|
|
449
446
|
|
|
450
|
-
function ApplyResultCard({ result, busy, t, onRollback }: ApplyResultCardProps): ReactNode {
|
|
447
|
+
function ApplyResultCard({ result, busy, t, sectionName, onRollback }: ApplyResultCardProps): ReactNode {
|
|
451
448
|
const ok = result.ok;
|
|
452
449
|
/** issue #56:未生效项(warning)= 非致命但确实没写进去(旧宿主无字段 → 空数组) */
|
|
453
450
|
const ineffective = result.ineffective ?? [];
|
|
@@ -482,7 +479,7 @@ function ApplyResultCard({ result, busy, t, onRollback }: ApplyResultCardProps):
|
|
|
482
479
|
<div>
|
|
483
480
|
<span className={css.fieldLabel}>{t('syncflow.importedSections')}</span>
|
|
484
481
|
<div className={css.statRow}>
|
|
485
|
-
{result.applied.map((sid) => <Badge key={sid} kind="ok">{sid}</Badge>)}
|
|
482
|
+
{result.applied.map((sid) => <Badge key={sid} kind="ok">{sectionName !== undefined ? sectionName(sid) : sid}</Badge>)}
|
|
486
483
|
</div>
|
|
487
484
|
</div>
|
|
488
485
|
)}
|
|
@@ -490,7 +487,7 @@ function ApplyResultCard({ result, busy, t, onRollback }: ApplyResultCardProps):
|
|
|
490
487
|
<div>
|
|
491
488
|
<span className={css.fieldLabel}>{t('syncflow.importWarnings')}</span>
|
|
492
489
|
<ul className={css.warnList}>
|
|
493
|
-
{result.warnings.map((w, i) => <li key={i}>{w}</li>)}
|
|
490
|
+
{result.warnings.map((w, i) => <li key={i}>{redact(w)}</li>)}
|
|
494
491
|
</ul>
|
|
495
492
|
</div>
|
|
496
493
|
)}
|
|
@@ -20,7 +20,8 @@ import {
|
|
|
20
20
|
projectSyncHistoryEntries, summarizeSyncHistory,
|
|
21
21
|
} from './history-model.ts'
|
|
22
22
|
import type { TranslateNS } from '../client-types.ts'
|
|
23
|
-
import { Badge, Card, SectionTitle } from '../common/ui.tsx'
|
|
23
|
+
import { Badge, Button, Card, Empty, SectionTitle } from '../common/ui.tsx'
|
|
24
|
+
import { RefreshIcon } from '../common/Icon.tsx'
|
|
24
25
|
import { SkeletonTable } from '../common/Skeleton.tsx'
|
|
25
26
|
import { ErrorBanner } from '../common/ErrorBanner.tsx'
|
|
26
27
|
import css from '../config-manager.module.css'
|
|
@@ -28,13 +29,15 @@ import css from '../config-manager.module.css'
|
|
|
28
29
|
export interface SyncLogListProps {
|
|
29
30
|
api: SyncApi
|
|
30
31
|
t: TranslateNS<'config-manager-sync'>
|
|
32
|
+
/** 分区可读名映射(避免直接渲染裸 SectionId) */
|
|
33
|
+
sectionName?: (id: string) => string
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
export function SyncLogList({ api, t }: SyncLogListProps): ReactNode {
|
|
36
|
+
export function SyncLogList({ api, t, sectionName }: SyncLogListProps): ReactNode {
|
|
34
37
|
const [loading, setLoading] = useState(true)
|
|
35
38
|
const [error, setError] = useState<string | null>(null)
|
|
36
39
|
const [entries, setEntries] = useState<SyncHistoryEntry[]>([])
|
|
37
|
-
/**
|
|
40
|
+
/** 重载计数(错误态「重试」与卡头「刷新」都递增 → 重新拉一次 /sync/history) */
|
|
38
41
|
const [reloadKey, setReloadKey] = useState(0)
|
|
39
42
|
|
|
40
43
|
useEffect(() => {
|
|
@@ -61,7 +64,8 @@ export function SyncLogList({ api, t }: SyncLogListProps): ReactNode {
|
|
|
61
64
|
const rows = useMemo(() => projectSyncHistoryEntries(entries), [entries])
|
|
62
65
|
const stats = useMemo(() => summarizeSyncHistory(rows), [rows])
|
|
63
66
|
|
|
64
|
-
|
|
67
|
+
// 骨架只在「还没有任何行」时占位:手动刷新不该把整张卡换成骨架(用户会以为列表没了)
|
|
68
|
+
if (loading && entries.length === 0) return <SkeletonTable label={t('common.loading')} />
|
|
65
69
|
if (error !== null) {
|
|
66
70
|
return (
|
|
67
71
|
<ErrorBanner
|
|
@@ -74,18 +78,27 @@ export function SyncLogList({ api, t }: SyncLogListProps): ReactNode {
|
|
|
74
78
|
}
|
|
75
79
|
if (rows.length === 0) {
|
|
76
80
|
return (
|
|
77
|
-
<Card>
|
|
78
|
-
<
|
|
79
|
-
|
|
81
|
+
<Card className={css.fillCard}>
|
|
82
|
+
<Empty>
|
|
83
|
+
<strong>{t('history.empty')}</strong>
|
|
84
|
+
<p>{t('history.emptyHint')}</p>
|
|
85
|
+
</Empty>
|
|
80
86
|
</Card>
|
|
81
87
|
)
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
return (
|
|
85
|
-
<Card>
|
|
91
|
+
<Card className={css.fillCard}>
|
|
86
92
|
{/* 条数只在下面那排统计徽章里给一次:标题里的 (12) 与「共 12 条」是同一个数,
|
|
87
93
|
两处并列时用户要先比对才敢确定它们说的是同一件事 */}
|
|
88
|
-
|
|
94
|
+
{/* 刷新走 SectionTitle 的 action 槽:它渲在标题同一行的右侧(内部自带推右的 spacer),
|
|
95
|
+
垂直居中跟标题一致。 */}
|
|
96
|
+
<SectionTitle
|
|
97
|
+
title={t('history.title')}
|
|
98
|
+
action={<Button size="sm" loading={loading} onClick={() => { setReloadKey((k) => k + 1) }}>
|
|
99
|
+
<RefreshIcon size={12} />{' '}{t('history.refresh')}
|
|
100
|
+
</Button>}
|
|
101
|
+
/>
|
|
89
102
|
{/* 头部统计摘要(先扫结论);失败/跳过仅在存在时出现,并给语义色 */}
|
|
90
103
|
<div className={css.statRow} aria-label={t('history.stats.summary')}>
|
|
91
104
|
<Badge kind="info">{t('history.stats.total', { count: String(stats.total) })}</Badge>
|
|
@@ -105,7 +118,7 @@ export function SyncLogList({ api, t }: SyncLogListProps): ReactNode {
|
|
|
105
118
|
<tbody>
|
|
106
119
|
{rows.map((r) => {
|
|
107
120
|
if (r.kind === 'autosync' && r.autosync !== undefined) {
|
|
108
|
-
return <AutosyncRow key={r.id} entry={r.autosync} t={t} />
|
|
121
|
+
return <AutosyncRow key={r.id} entry={r.autosync} t={t} sectionName={sectionName} />
|
|
109
122
|
}
|
|
110
123
|
return <OperationRow key={r.id} row={r} t={t} />
|
|
111
124
|
})}
|
|
@@ -143,7 +156,7 @@ function OperationRow({ row, t }: { row: SyncHistoryEntry; t: TranslateNS<'confi
|
|
|
143
156
|
* 自动同步行:引擎自己跑的同步(push / pull 成对),与人为操作区分开。
|
|
144
157
|
* 全部取值来自 `projectAutosyncEntry` 的投影 —— 本组件不自己拼文案。
|
|
145
158
|
*/
|
|
146
|
-
function AutosyncRow({ entry, t }: { entry: AutosyncHistoryEntry; t: TranslateNS<'config-manager-sync'
|
|
159
|
+
function AutosyncRow({ entry, t, sectionName }: { entry: AutosyncHistoryEntry; t: TranslateNS<'config-manager-sync'>; sectionName?: (id: string) => string }): ReactNode {
|
|
147
160
|
const row = projectAutosyncEntry(entry, t)
|
|
148
161
|
return (
|
|
149
162
|
<tr>
|
|
@@ -177,7 +190,7 @@ function AutosyncRow({ entry, t }: { entry: AutosyncHistoryEntry; t: TranslateNS
|
|
|
177
190
|
<div>
|
|
178
191
|
<span className={css.fieldLabel}>{t('history.autosyncConflicted', { sections: '' })}</span>
|
|
179
192
|
<div className={css.statRow}>
|
|
180
|
-
{row.conflictedSections.map((sid) => <Badge key={sid} kind="warn">{sid}</Badge>)}
|
|
193
|
+
{row.conflictedSections.map((sid) => <Badge key={sid} kind="warn">{sectionName !== undefined ? sectionName(sid) : sid}</Badge>)}
|
|
181
194
|
</div>
|
|
182
195
|
</div>
|
|
183
196
|
)}
|
|
@@ -185,7 +198,7 @@ function AutosyncRow({ entry, t }: { entry: AutosyncHistoryEntry; t: TranslateNS
|
|
|
185
198
|
<div>
|
|
186
199
|
<span className={css.fieldLabel}>{t('history.autosyncApplied', { sections: '' })}</span>
|
|
187
200
|
<div className={css.statRow}>
|
|
188
|
-
{row.appliedSections.map((sid) => <Badge key={sid} kind="ok">{sid}</Badge>)}
|
|
201
|
+
{row.appliedSections.map((sid) => <Badge key={sid} kind="ok">{sectionName !== undefined ? sectionName(sid) : sid}</Badge>)}
|
|
189
202
|
</div>
|
|
190
203
|
</div>
|
|
191
204
|
)}
|
|
@@ -197,9 +210,11 @@ function AutosyncRow({ entry, t }: { entry: AutosyncHistoryEntry; t: TranslateNS
|
|
|
197
210
|
)
|
|
198
211
|
}
|
|
199
212
|
|
|
200
|
-
/** 通道徽章:git → GitHub,webdav → WebDAV;未知/缺失不渲染(不猜)。 */
|
|
213
|
+
/** 通道徽章:git → GitHub,webdav → WebDAV,s3 → S3,gist → Gist;未知/缺失不渲染(不猜)。 */
|
|
201
214
|
function ChannelBadge({ transport, t }: { transport?: string; t: TranslateNS<'config-manager-sync'> }): ReactNode {
|
|
202
215
|
if (transport === 'git') return <Badge kind="info">{t('history.channelGit')}</Badge>
|
|
203
216
|
if (transport === 'webdav') return <Badge kind="info">{t('history.channelWebdav')}</Badge>
|
|
217
|
+
if (transport === 's3') return <Badge kind="info">{t('history.channelS3')}</Badge>
|
|
218
|
+
if (transport === 'gist') return <Badge kind="info">{t('history.channelGist')}</Badge>
|
|
204
219
|
return null
|
|
205
220
|
}
|