import { useState } from 'react'; import { Badge } from '@cameleer/design-system'; import type { Deployment, AppVersion } from '../../../api/queries/admin/apps'; import { timeAgo } from '../../../utils/format-utils'; import styles from './AppDeploymentPage.module.css'; const FALLBACK_CAP = 10; interface CheckpointsTableProps { deployments: Deployment[]; versions: AppVersion[]; currentDeploymentId: string | null; jarRetentionCount: number | null; onSelect: (deploymentId: string) => void; } export function CheckpointsTable({ deployments, versions, currentDeploymentId, jarRetentionCount, onSelect, }: CheckpointsTableProps) { const [expanded, setExpanded] = useState(false); const versionMap = new Map(versions.map((v) => [v.id, v])); const checkpoints = deployments .filter((d) => d.deployedConfigSnapshot && d.id !== currentDeploymentId) .sort((a, b) => (b.deployedAt ?? '').localeCompare(a.deployedAt ?? '')); if (checkpoints.length === 0) { return
| Version | JAR | Deployed by | Deployed | Strategy | Outcome | |
|---|---|---|---|---|---|---|
|
|
{v ? (
{v.jarFilename}
) : (
<>
JAR pruned
archived — JAR pruned
>
)}
|
{d.createdBy ?? —} |
{d.deployedAt && timeAgo(d.deployedAt)}
{d.deployedAt}
|
{strategyLabel} | {d.status} | › |