diff --git a/packages/app/src/features/runs/detail.tsx b/packages/app/src/features/runs/detail.tsx index 67cabc19..9ecc77ad 100644 --- a/packages/app/src/features/runs/detail.tsx +++ b/packages/app/src/features/runs/detail.tsx @@ -1,4 +1,4 @@ -import { Badge, Button, Breadcrumb, Page, ResourceHeader } from "../../shared/ui"; +import { Button, Breadcrumb, Page, ResourceHeader, RunStatusLabel } from "../../shared/ui"; import { ContinuousTrace } from "./continuous-trace"; import { ExpandedRunDetail } from "./expanded-detail"; import { ReplayTrace } from "./replay"; @@ -58,7 +58,7 @@ export function RunDetail() { {status.isPending &&

Loading run…

}{status.error &&

{status.error.message}

} {status.data ? {status.data.job_name} : Projects} {status.data && <> - { event.preventDefault(); setNameError(""); rename.mutate(); }}> { setNameDraft(event.target.value); setNameError(""); }} onKeyDown={event => { if (event.key === "Escape") { event.preventDefault(); cancelRename(); } }} />{nameError && {nameError}} : } description={

{status.data.state === "failed" && status.data.failure_source ? status.data.failure_source === "agent" ? "Agent failed" : "System failed" : status.data.state}{status.data.finalizing ? " · Finalizing trace and artifacts" : ""}{(status.data.agent_error as any)?.reason && {(status.data.agent_error as any).reason}}

}>{["starting", "running", "blocked", "stopping"].includes(status.data.state) && }
+ { event.preventDefault(); setNameError(""); rename.mutate(); }}> { setNameDraft(event.target.value); setNameError(""); }} onKeyDown={event => { if (event.key === "Escape") { event.preventDefault(); cancelRename(); } }} />{nameError && {nameError}} : } description={

{status.data.finalizing ? " · Finalizing trace and artifacts" : ""}{(status.data.agent_error as any)?.reason && {(status.data.agent_error as any).reason}}

}>{["starting", "running", "blocked", "stopping"].includes(status.data.state) && }
} {!status.data && } {stop.error &&

{stop.error.message}

} diff --git a/packages/app/src/routes/index.tsx b/packages/app/src/routes/index.tsx index ce3ce2c4..7bb88764 100644 --- a/packages/app/src/routes/index.tsx +++ b/packages/app/src/routes/index.tsx @@ -1,4 +1,4 @@ -import { Badge, Card, Page, RunStatusDot } from "../shared/ui"; +import { Card, Page, RunStatusLabel } from "../shared/ui"; import { Link } from "@tanstack/react-router"; import { useQuery } from "@tanstack/react-query"; import { sessionQuery } from "../features/auth/session"; @@ -14,7 +14,7 @@ function RecentSection({ title, children, empty }: { title: string; children: Re function RecentDashboard() { const projects = useQuery(recentProjectsQuery), jobs = useQuery(recentJobsQuery), runs = useQuery(runPageQuery({ limit: 5 })); const error = projects.error || jobs.error || runs.error; - return

Your software factory

Recent work

Pick up where you left off.

{error &&

{error.message}

}
{projects.data?.length ?
    {projects.data.map(project =>
  • {project.name}{project.jobCount} {project.jobCount === 1 ? "job" : "jobs"} · Updated {timestamp(project.updatedAt)}
  • )}
: null}
{jobs.data?.items.length ?
    {jobs.data.items.map(job =>
  • {job.name}{job.lastRunState ? <> {job.lastRunState} · : "No runs · "}Updated {timestamp(job.updatedAt)}
  • )}
: null}
{runs.data?.items.length ?
    {runs.data.items.map(run =>
  • {run.run_name || "Unnamed run"}{run.state}{run.job_name} · {timestamp(run.created_at)}
  • )}
: null}
; + return

Your software factory

Recent work

Pick up where you left off.

{error &&

{error.message}

}
{projects.data?.length ?
    {projects.data.map(project =>
  • {project.name}{project.jobCount} {project.jobCount === 1 ? "job" : "jobs"} · Updated {timestamp(project.updatedAt)}
  • )}
: null}
{jobs.data?.items.length ?
    {jobs.data.items.map(job =>
  • {job.name}{job.lastRunState ? <> · : "No runs · "}Updated {timestamp(job.updatedAt)}
  • )}
: null}
{runs.data?.items.length ?
    {runs.data.items.map(run =>
  • {run.run_name || "Unnamed run"}{run.job_name} · {timestamp(run.created_at)}
  • )}
: null}
; } export function MigrationIndex() { const session = useQuery(sessionQuery); diff --git a/packages/app/src/shared/ui.tsx b/packages/app/src/shared/ui.tsx index 7746b553..7a44a737 100644 --- a/packages/app/src/shared/ui.tsx +++ b/packages/app/src/shared/ui.tsx @@ -60,11 +60,19 @@ const runStatusStyles: Record; } +export function RunStatusLabel({ state, failureSource, className = "" }: { state: string; failureSource?: string | null; className?: string }) { + const status = runStatusDetails(state, failureSource); + const text = state === "failed" && failureSource ? status.label : state || "Unknown"; + return {text}; +} export function Button({ variant = "secondary", className = "", ...props }: ComponentProps<"button"> & { variant?: keyof typeof buttonClasses }) { return