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 @@