import { Check, Clock, Download, Info, Play, Search, Trash2 } from "lucide-react"; import { Button } from "@/client/components/ui/button"; import { Card } from "@/client/components/ui/card"; import { JsonResult } from "./JsonResult"; import type { AdminState, CompactionData } from "./types"; export type CompactionCardProps = { compactionData?: CompactionData; compactionStartedAt?: string | null; compactionStatus: string; state: AdminState; pending: Record; startCompaction: (dryRun: boolean) => Promise; clearCompaction: () => Promise; compactionResult: unknown; }; export function CompactionCard({ compactionData, compactionStartedAt, compactionStatus, state, pending, startCompaction, clearCompaction, compactionResult, }: CompactionCardProps) { const receiveStartedAt = state.receiveLease ? new Date(state.receiveLease.createdAt).toLocaleString() : null; const queuedCompactionAt = compactionData?.wantedAt ? new Date(compactionData.wantedAt).toLocaleString() : null; return (

Pack Compaction

Receive and compaction leases are the live background activity signals for this repository. Automatic compaction runs after packs accumulate past the compaction threshold.

{state.receiveLease ? (
{" "} receive lease is active {receiveStartedAt ? ` • Started ${receiveStartedAt}` : ""}
) : compactionData?.running ? (
{" "} compaction lease is active {compactionStartedAt ? ` • Started ${compactionStartedAt}` : ""}
) : compactionData?.queued ? (
{" "} compaction request is recorded in repo metadata
) : (
{" "} no compaction lease is currently active
)}
Receive Lease
{state.receiveLease ? `active until ${new Date(state.receiveLease.expiresAt).toLocaleString()}` : "idle"}
Compaction
{compactionStatus}
{compactionData?.wantedAt ? (
requested {new Date(compactionData.wantedAt).toLocaleString()}
) : null}
Compaction requests queue real background work. The active pack catalog and compaction lease are the source of truth for repository state.
{queuedCompactionAt ? (
Latest request recorded at {queuedCompactionAt}.
) : null} {compactionResult ? : null}
); }