import { useHasAdminAccess } from "~/hooks/useUser"; import { Button } from "../primitives/Buttons"; import { Dialog, DialogContent, DialogHeader, DialogTrigger } from "../primitives/Dialog"; import { Cog6ToothIcon } from "@heroicons/react/20/solid"; import { type loader } from "~/routes/resources.taskruns.$runParam.debug"; import type { UseDataFunctionReturn } from "remix-typedjson"; import { useTypedFetcher } from "remix-typedjson"; import { useEffect } from "react"; import { Spinner } from "../primitives/Spinner"; import * as Property from "~/components/primitives/PropertyTable"; import { ClipboardField } from "../primitives/ClipboardField"; export function AdminDebugRun({ friendlyId }: { friendlyId: string }) { // `useHasAdminAccess` already folds in impersonation and the "view as user" // toggle, so this one check is enough. const hasAdminAccess = useHasAdminAccess(); if (!hasAdminAccess) { return null; } return ( ); } function DebugRunDialog({ friendlyId }: { friendlyId: string }) { return ( ); } function DebugRunContent({ friendlyId }: { friendlyId: string }) { const fetcher = useTypedFetcher(); const isLoading = fetcher.state === "loading"; const load = fetcher.load; useEffect(() => { load(`/resources/taskruns/${friendlyId}/debug`); }, [friendlyId, load]); return ( <> Debugging run {isLoading ? (
) : fetcher.data ? ( ) : ( <>Failed to get run debug data )} ); } function DebugRunData(props: UseDataFunctionReturn) { if (props.engine === "V1") { return ; } return ; } function DebugRunDataEngineV1({ run }: { run: UseDataFunctionReturn["run"] }) { return ( ID Engine Engine V1 (v3) is retired. Queue debug data is no longer available for V1 runs. ); } function DebugRunDataEngineV2({ run, queueConcurrencyLimit, queueCurrentConcurrency, envConcurrencyLimit, envCurrentConcurrency, keys, }: Extract, { engine: "V2" }>) { return ( ID Queue current concurrency {queueCurrentConcurrency ?? "0"} Queue concurrency limit {queueConcurrencyLimit ?? "Not set"} Env current concurrency {envCurrentConcurrency ?? "0"} Env concurrency limit {envConcurrencyLimit ?? "Not set"} {keys.map((key) => ( {key.label} ))} ); }