(report: GcReport | null)
| 70 | } |
| 71 | |
| 72 | function gcPhaseSummary(report: GcReport | null): string { |
| 73 | if (!report) return ""; |
| 74 | const parts: string[] = []; |
| 75 | const phases: Array<[string, GcPhase | null | undefined]> = [ |
| 76 | ["orphans", report.orphans], |
| 77 | ["unreferenced", report.unreferenced], |
| 78 | ["missing", report.missing], |
| 79 | ["dangling", report.dangling], |
| 80 | ]; |
| 81 | for (const [name, phase] of phases) { |
| 82 | if (phase && phase.count) { |
| 83 | parts.push( |
| 84 | `${name}=${fmtInt(phase.count)}${phase.bytes ? ` (${fmtBytes(phase.bytes)})` : ""}`, |
| 85 | ); |
| 86 | } |
| 87 | } |
| 88 | if (report.deferred && report.deferred.count) { |
| 89 | parts.push(`deferred=${fmtInt(report.deferred.count)}`); |
| 90 | } |
| 91 | return parts.length ? parts.join(" · ") : "nothing to reclaim"; |
| 92 | } |
| 93 | |
| 94 | export function StoreHealthCard(): React.ReactElement { |
| 95 | const [health, setHealth] = useState<PayloadHealthResponse | null>(null); |
no test coverage detected