import { type ScheduleRunSummary } from "../../services/api"; import Icon from "../../components/common/Icon"; import { formatTime, formatDuration } from "./utils"; const RUN_STATUS_LABELS: Record = { queued: "排队中", running: "运行中", succeeded: "成功", failed: "失败", cancelled: "已取消", timed_out: "已超时", }; export function RunHistory({ runs, loading, disabled, onRefresh, }: { runs: ScheduleRunSummary[]; loading: boolean; disabled: boolean; onRefresh: () => void; }) { return (
运行记录 {runs.length}
{loading && runs.length === 0 ? (

正在加载运行记录…

) : runs.length === 0 ? (

点击右上角"立即运行"后,这里会显示状态和耗时。

) : ( runs.map((run) => (
{RUN_STATUS_LABELS[run.run_status]} {formatTime(run.queued_at)} · {formatDuration(run.duration_ms)} {run.error_message &&

{run.error_message}

}
{run.run_id.slice(-8)}
)) )}
); }