import { sew } from "@/actions" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Skeleton } from "@/components/ui/skeleton" import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip" import { env } from "@sourcebot/shared" import { SINGLE_TENANT_ORG_DOMAIN } from "@/lib/constants" import { ServiceErrorException } from "@/lib/serviceError" import { cn, getCodeHostInfoForRepo, isServiceError } from "@/lib/utils" import { withOptionalAuthV2 } from "@/withAuthV2" import { getConfigSettings, repoMetadataSchema } from "@sourcebot/shared" import { ExternalLink, Info } from "lucide-react" import Image from "next/image" import Link from "next/link" import { notFound } from "next/navigation" import { Suspense } from "react" import { BackButton } from "../../components/backButton" import { DisplayDate } from "../../components/DisplayDate" import { RepoBranchesTable } from "../components/repoBranchesTable" import { RepoJobsTable } from "../components/repoJobsTable" export default async function RepoDetailPage({ params }: { params: Promise<{ id: string }> }) { const { id } = await params const repo = await getRepoWithJobs(Number.parseInt(id)) if (isServiceError(repo)) { throw new ServiceErrorException(repo); } const codeHostInfo = getCodeHostInfoForRepo({ codeHostType: repo.external_codeHostType, name: repo.name, displayName: repo.displayName ?? undefined, webUrl: repo.webUrl ?? undefined, }); const configSettings = await getConfigSettings(env.CONFIG_PATH); const nextIndexAttempt = (() => { const latestJob = repo.jobs.length > 0 ? repo.jobs[0] : null; if (!latestJob) { return undefined; } if (latestJob.completedAt) { return new Date(latestJob.completedAt.getTime() + configSettings.reindexIntervalMs); } return undefined; })(); const repoMetadata = repoMetadataSchema.parse(repo.metadata); return ( <>
{repo.name}
When this repository was first added to Sourcebot
The last time this repository was successfully indexed
When the next indexing job is scheduled to run