OperationStatus.svelte (3538B)
1 <script lang="ts"> 2 import Notice from './Notice.svelte'; 3 import { 4 listingOperationSnapshot, 5 subscribeListingOperationView, 6 type ListingOperationView 7 } from '../publishing/listing-operation-view.ts'; 8 import { 9 statusCopy, 10 receiptCopy, 11 type OperationFact, 12 type TargetReceipt 13 } from '../presentation/status-copy'; 14 let { 15 fact = 'unknown', 16 receipts = [], 17 publicOperation 18 }: { 19 fact?: OperationFact; 20 receipts?: readonly TargetReceipt[]; 21 publicOperation?: ListingOperationView; 22 } = $props(); 23 let retired = $state(false); 24 const publicSnapshot = $derived( 25 publicOperation && !retired 26 ? listingOperationSnapshot(publicOperation) 27 : undefined 28 ); 29 const summary = $derived( 30 publicOperation 31 ? (publicSnapshot?.summary ?? statusCopy('unknown')) 32 : statusCopy(fact) 33 ); 34 $effect(() => { 35 retired = false; 36 if (!publicOperation) return; 37 return subscribeListingOperationView(publicOperation, () => { 38 retired = true; 39 }); 40 }); 41 </script> 42 43 <div class="stack stack--tight"> 44 <Notice tone={summary.tone} text={summary.text} /> 45 {#if publicSnapshot} 46 {#if publicSnapshot.purpose === 'withdrawal'}<p> 47 Removal request evidence remains here even when the listing is 48 suppressed. It cannot erase all other copies. 49 </p>{/if} 50 <p> 51 Relay acceptance recorded for {publicSnapshot.acceptanceCount} of {publicSnapshot 52 .targets.length} targets. 53 </p> 54 <p> 55 Exact read-back recorded for {publicSnapshot.readbackCount} of {publicSnapshot 56 .targets.length} targets. 57 </p> 58 <p> 59 {publicSnapshot.purpose === 'withdrawal' 60 ? 'This request has its own retained local operation. Listing visibility does not determine its delivery outcome.' 61 : publicSnapshot.localSource === 'retained-prototype' 62 ? 'Retained prototype source is available in this browser. Editing requires a separate current-head check.' 63 : 'No supported retained prototype source is available for editing. Keep this listing read-only.'} 64 </p> 65 {#if publicSnapshot.needsAction} 66 <Notice 67 tone="warning" 68 text="Needs action. Earlier acceptance and exact read-back facts are preserved." 69 /> 70 {/if} 71 {#each publicSnapshot.targets as target (target.origin)} 72 <div class="stack stack--tight"> 73 <p class="key">Event: {target.eventId} · Target: {target.origin}</p> 74 <p> 75 {target.accepted 76 ? 'Acceptance recorded for this event and target.' 77 : 'No acceptance recorded for this event and target.'} 78 </p> 79 <p> 80 {target.readback === 'confirmed' 81 ? 'Exact read-back is confirmed for this event and target.' 82 : 'Exact read-back was not observed for this event and target.'} 83 </p> 84 {#each target.receipts as receipt, index (index)} 85 <p> 86 Attempt {receipt.attempt} · Recorded outcome: {receipt.status === 87 'timed_out' 88 ? 'timed out' 89 : receipt.status}. 90 </p> 91 {/each} 92 </div> 93 {/each} 94 {:else if !publicOperation} 95 {#each receipts as receipt, index (index)} 96 {@const copy = receiptCopy(receipt)} 97 <div class="stack stack--tight"> 98 <p class="key"> 99 Event: {receipt.eventId} · Target: {receipt.destination} 100 </p> 101 <Notice tone={copy.tone} text={copy.text} /> 102 <p>{copy.readback}</p> 103 </div> 104 {/each} 105 {/if} 106 </div>