import { Route } from "lucide-react"; import { Badge, StatusBadge } from "@/components/ui/badge"; import { EmptyState } from "@/components/ui/empty-state"; import { formatBytes, formatMs } from "@/lib/format"; import type { RequestAttemptView } from "@/lib/queries/dashboard"; import { HttpCode } from "./requests-table"; function outcomeStatus(outcome: string): string { if (outcome === "success") return "success"; if (outcome === "blocked") return "blocked"; if (outcome === "timeout") return "pending"; return "failed"; } /** * Vertical timeline of routing attempts. `provider` is only present when the organization has * provider visibility enabled; it is then labelled as debug output. */ export function AttemptsTimeline({ attempts, providerVisibility }: { attempts: RequestAttemptView[]; providerVisibility: boolean }) { if (!attempts.length) { return ; } return (
    {attempts.map((a) => (
  1. #{a.attemptNo} via {a.network === "isp" ? "ISP" : a.network} {a.country ? · {a.country} : null} {providerVisibility && a.provider ? ( debug {a.provider} ) : null} {formatMs(a.durationMs)}
    Outcome
    {a.outcome.replace(/_/g, " ")}
    HTTP
    Bytes
    {formatBytes(a.bytesIn + a.bytesOut)}
    Routing score
    {a.routingScore === null ? "—" : a.routingScore.toFixed(2)}
    {a.errorCode ? (
    Error
    {a.errorCode}
    ) : null} {a.blockReason ? (
    Block reason
    {a.blockReason}
    ) : null}
  2. ))}
); }