Skip to content

Commit 5e0b8cb

Browse files
committed
CLI log links go directly to a span
1 parent 07b1399 commit 5e0b8cb

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

apps/webapp/app/routes/projects.v3.$projectRef.runs.$runParam.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { LoaderFunctionArgs, redirect } from "@remix-run/server-runtime";
22
import { z } from "zod";
33
import { prisma } from "~/db.server";
44
import { requireUserId } from "~/services/session.server";
5+
import { v3RunSpanPath } from "~/utils/pathBuilder";
56

67
const ParamsSchema = z.object({
78
projectRef: z.string(),
@@ -33,8 +34,20 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
3334
return new Response("Not found", { status: 404 });
3435
}
3536

37+
const run = await prisma.taskRun.findUnique({
38+
where: {
39+
friendlyId: validatedParams.runParam,
40+
},
41+
});
42+
43+
if (!run) {
44+
throw new Response("Not found", { status: 404 });
45+
}
46+
3647
// Redirect to the project's runs page
3748
return redirect(
38-
`/orgs/${project.organization.slug}/projects/v3/${project.slug}/runs/${validatedParams.runParam}`
49+
v3RunSpanPath({ slug: project.organization.slug }, { slug: project.slug }, run, {
50+
spanId: run.spanId,
51+
})
3952
);
4053
}

0 commit comments

Comments
 (0)