From fc5f02ca3b532edb6d123c9a5ebc99d270d26007 Mon Sep 17 00:00:00 2001 From: vorotamoroz Date: Fri, 6 Nov 2026 08:45:24 +0000 Subject: [PATCH] feat: show P2P transfer and comparison progress Show per-peer document revision counts and brief directional comparison labels in both P2P panes and the editor status. Use the P2P projection for the main status bar when P2P is the selected remote. Retain labelled sequence progress for peers without statistics, and keep adjunct P2P counters separate from the selected remote. Requires the additive P2P statistics API in vrtmrz/livesync-commonlib@be7bd0988ea978fd7aa0efd29eca44c9fec09d7b. Consumer checks passed against a packed candidate; pin the published package before integration. --- .../P2POpenReplicationPane.svelte | 24 ++- .../P2PReplicator/P2PServerStatusPane.svelte | 20 ++ src/modules/features/ModuleLog.ts | 25 ++- src/modules/features/P2PStatusLabel.ts | 178 ++++++++++++++++++ .../features/P2PStatusLabel.unit.spec.ts | 148 +++++++++++++++ updates.md | 6 + 6 files changed, 395 insertions(+), 6 deletions(-) create mode 100644 src/modules/features/P2PStatusLabel.ts create mode 100644 src/modules/features/P2PStatusLabel.unit.spec.ts diff --git a/src/features/P2PSync/P2PReplicator/P2POpenReplicationPane.svelte b/src/features/P2PSync/P2PReplicator/P2POpenReplicationPane.svelte index 41e0e11b..9c4749d4 100644 --- a/src/features/P2PSync/P2PReplicator/P2POpenReplicationPane.svelte +++ b/src/features/P2PSync/P2PReplicator/P2POpenReplicationPane.svelte @@ -13,6 +13,7 @@ import { delay, fireAndForget } from "octagonal-wheels/promises"; import P2PServerStatusCard from "./P2PServerStatusCard.svelte"; import { $msg as translateMessage } from "@/common/translation"; + import { observeP2PDiagnosticsProgress, type P2PStatusProjection } from "@/modules/features/P2PStatusLabel"; interface Props { p2p: P2PServiceViews; @@ -27,6 +28,7 @@ let serverInfo = $state(undefined); let syncingPeerId = $state(null); + let peerProgress = $state(new Map()); const logLevel = $derived(showResult ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO); async function requestServerStatus() { @@ -34,6 +36,9 @@ eventHub.emitEvent(EVENT_REQUEST_STATUS); } onMount(() => { + const unsubscribeProgress = observeP2PDiagnosticsProgress(p2p.diagnostics, (snapshot) => { + peerProgress = snapshot.peers; + }); // ServerStatus const unsubscribe = eventHub.onEvent(EVENT_SERVER_STATUS, (status) => { serverInfo = status; @@ -42,7 +47,10 @@ await delay(100); await requestServerStatus(); }); - return unsubscribe; + return () => { + unsubscribe(); + unsubscribeProgress(); + }; }); async function handleSync(peerId: string) { @@ -109,6 +117,14 @@
{peer.name}
+ {#if peerProgress.has(peer.peerId)} +
+ {peerProgress.get(peer.peerId)?.message} +
+ {/if}
{peer.platform} @@ -176,6 +192,12 @@