Skip to content

Commit 2221283

Browse files
committed
Merge remote-tracking branch 'origin/main' into checkpoint-cleanup
2 parents e124d3d + 4906fe9 commit 2221283

File tree

21 files changed

+397
-152
lines changed

21 files changed

+397
-152
lines changed

.changeset/three-olives-love.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
---
4+
5+
Removed the inline-code accessory from the logs when calling trigger or batchTrigger from a run

.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: [triggerdotdev]

apps/webapp/app/components/primitives/Badge.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ const variants = {
66
"grid place-items-center rounded-full px-2 h-5 tracking-wider text-xxs bg-charcoal-750 text-text-bright uppercase whitespace-nowrap",
77
small:
88
"grid place-items-center rounded-full px-[0.4rem] h-4 tracking-wider text-xxs bg-background-dimmed text-text-dimmed uppercase whitespace-nowrap",
9+
"extra-small":
10+
"grid place-items-center border border-charcoal-650 rounded-sm px-1 h-4 border-tracking-wider text-xxs bg-background-bright text-blue-500 whitespace-nowrap",
911
outline:
1012
"grid place-items-center rounded-sm px-1.5 h-5 tracking-wider text-xxs border border-dimmed text-text-dimmed uppercase whitespace-nowrap",
1113
"outline-rounded":

apps/webapp/app/components/primitives/Table.tsx

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const Table = forwardRef<HTMLTableElement, TableProps>(
2222
fullWidth && "w-full"
2323
)}
2424
>
25-
<table ref={ref} className={cn("w-full divide-y", className)}>
25+
<table ref={ref} className={cn("w-full", className)}>
2626
{children}
2727
</table>
2828
</div>
@@ -40,7 +40,10 @@ export const TableHeader = forwardRef<HTMLTableSectionElement, TableHeaderProps>
4040
return (
4141
<thead
4242
ref={ref}
43-
className={cn("rounded-t-md", "relative divide-y divide-grid-dimmed", className)}
43+
className={cn(
44+
"sticky top-0 z-10 divide-y divide-grid-dimmed rounded-t-md bg-background-dimmed after:absolute after:bottom-0 after:left-0 after:right-0 after:h-px after:bg-grid-dimmed",
45+
className
46+
)}
4447
>
4548
{children}
4649
</thead>
@@ -56,7 +59,10 @@ type TableBodyProps = {
5659
export const TableBody = forwardRef<HTMLTableSectionElement, TableBodyProps>(
5760
({ className, children }, ref) => {
5861
return (
59-
<tbody ref={ref} className={cn("relative divide-y divide-grid-dimmed", className)}>
62+
<tbody
63+
ref={ref}
64+
className={cn("relative divide-y divide-grid-dimmed overflow-y-auto", className)}
65+
>
6066
{children}
6167
</tbody>
6268
);
@@ -135,10 +141,17 @@ type TableCellProps = TableCellBasicProps & {
135141
hasAction?: boolean;
136142
isSticky?: boolean;
137143
actionClassName?: string;
144+
rowHoverStyle?: keyof typeof rowHoverStyles;
145+
};
146+
147+
const rowHoverStyles = {
148+
default: "group-hover/table-row:bg-charcoal-800",
149+
dimmed: "group-hover/table-row:bg-charcoal-850",
150+
bright: "group-hover/table-row:bg-charcoal-750",
138151
};
139152

140153
const stickyStyles =
141-
"sticky right-0 z-10 w-[2.8rem] min-w-[2.8rem] bg-background-dimmed before:absolute before:pointer-events-none before:-left-8 before:top-0 before:h-full before:min-w-[2rem] before:bg-gradient-to-r before:from-transparent before:to-background before:content-[''] group-hover/table-row:before:to-charcoal-900";
154+
"sticky right-0 z-10 w-[2.8rem] min-w-[2.8rem] bg-background-dimmed before:absolute before:pointer-events-none before:-left-8 before:top-0 before:h-full before:min-w-[2rem]";
142155

143156
export const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(
144157
(
@@ -152,6 +165,7 @@ export const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(
152165
onClick,
153166
hasAction = false,
154167
isSticky = false,
168+
rowHoverStyle = "default",
155169
},
156170
ref
157171
) => {
@@ -178,12 +192,11 @@ export const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(
178192
<td
179193
ref={ref}
180194
className={cn(
181-
"text-xs text-charcoal-400",
182-
to || onClick || hasAction
183-
? "cursor-pointer group-hover/table-row:bg-charcoal-900"
184-
: "px-3 py-3 align-middle",
195+
"text-xs text-charcoal-400 transition-colors",
196+
to || onClick || hasAction ? "cursor-pointer" : "px-3 py-3 align-middle",
185197
!to && !onClick && alignmentClassName,
186198
isSticky && stickyStyles,
199+
rowHoverStyles[rowHoverStyle],
187200
className
188201
)}
189202
colSpan={colSpan}

apps/webapp/app/components/runs/v3/ReplayRunDialog.tsx

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { DialogClose } from "@radix-ui/react-dialog";
12
import { Form, useNavigation, useSubmit } from "@remix-run/react";
23
import { useCallback, useEffect, useRef } from "react";
34
import { UseDataFunctionReturn, useTypedFetcher } from "remix-typedjson";
@@ -8,6 +9,7 @@ import { DialogContent, DialogHeader } from "~/components/primitives/Dialog";
89
import { Header3 } from "~/components/primitives/Headers";
910
import { InputGroup } from "~/components/primitives/InputGroup";
1011
import { Label } from "~/components/primitives/Label";
12+
import { Paragraph } from "~/components/primitives/Paragraph";
1113
import { Select, SelectItem } from "~/components/primitives/Select";
1214
import { ButtonSpinner, Spinner } from "~/components/primitives/Spinner";
1315
import { type loader } from "~/routes/resources.taskruns.$runParam.replay";
@@ -19,7 +21,7 @@ type ReplayRunDialogProps = {
1921

2022
export function ReplayRunDialog({ runFriendlyId, failedRedirect }: ReplayRunDialogProps) {
2123
return (
22-
<DialogContent key={`replay`} className="md:max-w-3xl">
24+
<DialogContent key={`replay`} className="md:max-w-xl">
2325
<ReplayContent runFriendlyId={runFriendlyId} failedRedirect={failedRedirect} />
2426
</DialogContent>
2527
);
@@ -95,8 +97,12 @@ function ReplayForm({
9597
<Form action={formAction} method="post" onSubmit={(e) => submitForm(e)} className="pt-2">
9698
{editablePayload ? (
9799
<>
100+
<Paragraph className="mb-3">
101+
Replaying will create a new run using the same or modified payload, executing against
102+
the latest version in your selected environment.
103+
</Paragraph>
98104
<Header3 spacing>Payload</Header3>
99-
<div className="mb-3 max-h-[70vh] overflow-y-auto rounded-sm border border-grid-dimmed bg-charcoal-900 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
105+
<div className="mb-3 max-h-[70vh] min-h-40 overflow-y-auto rounded-sm border border-grid-dimmed bg-charcoal-900 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
100106
<JSONEditor
101107
autoFocus
102108
defaultValue={currentJson.current}
@@ -123,8 +129,8 @@ function ReplayForm({
123129
defaultValue={environment.id}
124130
items={environments}
125131
dropdownIcon
126-
variant="tertiary/medium"
127-
className="w-fit pl-2"
132+
variant="tertiary/small"
133+
className="w-fit pl-1"
128134
text={(value) => {
129135
const env = environments.find((env) => env.id === value)!;
130136
return (
@@ -144,16 +150,20 @@ function ReplayForm({
144150
</Select>
145151
</InputGroup>
146152
<input type="hidden" name="failedRedirect" value={failedRedirect} />
147-
<Button
148-
type="submit"
149-
variant="primary/medium"
150-
LeadingIcon={isSubmitting ? ButtonSpinner : undefined}
151-
disabled={isSubmitting}
152-
shortcut={{ modifiers: ["meta"], key: "enter", enabledOnInputElements: true }}
153-
className="mt-5"
154-
>
155-
{isSubmitting ? "Replaying..." : "Replay run"}
156-
</Button>
153+
<div className="mt-3 flex items-center justify-between gap-2 border-t border-grid-dimmed pt-3.5">
154+
<DialogClose asChild>
155+
<Button variant="tertiary/small">Cancel</Button>
156+
</DialogClose>
157+
<Button
158+
type="submit"
159+
variant="primary/small"
160+
LeadingIcon={isSubmitting ? ButtonSpinner : undefined}
161+
disabled={isSubmitting}
162+
shortcut={{ modifiers: ["meta"], key: "enter", enabledOnInputElements: true }}
163+
>
164+
{isSubmitting ? "Replaying..." : "Replay run"}
165+
</Button>
166+
</div>
157167
</Form>
158168
);
159169
}

apps/webapp/app/components/runs/v3/TaskRunsTable.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import { LiveTimer } from "./LiveTimer";
4141
import { ReplayRunDialog } from "./ReplayRunDialog";
4242
import { TaskRunStatusCombo } from "./TaskRunStatus";
4343
import { RunTag } from "./RunTag";
44+
import { Badge } from "~/components/primitives/Badge";
4445

4546
type RunsTableProps = {
4647
total: number;
@@ -123,7 +124,7 @@ export function TaskRunsTable({
123124
)}
124125
<TableHeaderCell alignment="right">Run #</TableHeaderCell>
125126
<TableHeaderCell>Env</TableHeaderCell>
126-
<TableHeaderCell>Task ID</TableHeaderCell>
127+
<TableHeaderCell>Task</TableHeaderCell>
127128
<TableHeaderCell>Version</TableHeaderCell>
128129
<TableHeaderCell>Status</TableHeaderCell>
129130
<TableHeaderCell>Started</TableHeaderCell>
@@ -278,7 +279,12 @@ export function TaskRunsTable({
278279
userName={run.environment.userName}
279280
/>
280281
</TableCell>
281-
<TableCell to={path}>{run.taskIdentifier}</TableCell>
282+
<TableCell to={path}>
283+
<span className="flex items-center gap-x-1">
284+
{run.taskIdentifier}
285+
{run.rootTaskRunId === null ? <Badge variant="extra-small">Root</Badge> : null}
286+
</span>
287+
</TableCell>
282288
<TableCell to={path}>{run.version ?? "–"}</TableCell>
283289
<TableCell to={path}>
284290
<TaskRunStatusCombo status={run.status} />

apps/webapp/app/hooks/useReplaceLocation.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { useSearchParams } from "@remix-run/react";
2+
import { useCallback } from "react";
3+
4+
export function useReplaceSearchParams() {
5+
const [searchParams, setSearchParams] = useSearchParams();
6+
7+
const replaceSearchParam = useCallback(
8+
(key: string, value?: string) => {
9+
setSearchParams((s) => {
10+
if (value) {
11+
s.set(key, value);
12+
} else {
13+
s.delete(key);
14+
}
15+
return s;
16+
});
17+
},
18+
[searchParams]
19+
);
20+
21+
return { searchParams, setSearchParams, replaceSearchParam };
22+
}

apps/webapp/app/presenters/v3/RunListPresenter.server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ export class RunListPresenter extends BasePresenter {
168168
usageDurationMs: BigInt;
169169
tags: string[];
170170
depth: number;
171+
rootTaskRunId: string | null;
171172
}[]
172173
>`
173174
SELECT
@@ -192,6 +193,7 @@ export class RunListPresenter extends BasePresenter {
192193
tr."costInCents" AS "costInCents",
193194
tr."usageDurationMs" AS "usageDurationMs",
194195
tr."depth" AS "depth",
196+
tr."rootTaskRunId" AS "rootTaskRunId",
195197
array_remove(array_agg(tag.name), NULL) AS "tags"
196198
FROM
197199
${sqlDatabaseSchema}."TaskRun" tr
@@ -336,6 +338,7 @@ WHERE
336338
usageDurationMs: Number(run.usageDurationMs),
337339
tags: run.tags.sort((a, b) => a.localeCompare(b)),
338340
depth: run.depth,
341+
rootTaskRunId: run.rootTaskRunId,
339342
};
340343
}),
341344
pagination: {

apps/webapp/app/presenters/v3/RunPresenter.server.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ export class RunPresenter {
3737
status: true,
3838
completedAt: true,
3939
logsDeletedAt: true,
40+
rootTaskRun: {
41+
select: {
42+
friendlyId: true,
43+
taskIdentifier: true,
44+
spanId: true,
45+
},
46+
},
4047
runtimeEnvironment: {
4148
select: {
4249
id: true,
@@ -80,6 +87,7 @@ export class RunPresenter {
8087
isFinished: isFinalRunStatus(run.status),
8188
completedAt: run.completedAt,
8289
logsDeletedAt: run.logsDeletedAt,
90+
rootTaskRun: run.rootTaskRun,
8391
environment: {
8492
id: run.runtimeEnvironment.id,
8593
organizationId: run.runtimeEnvironment.organizationId,
@@ -141,6 +149,7 @@ export class RunPresenter {
141149
isFinished: isFinalRunStatus(run.status),
142150
completedAt: run.completedAt,
143151
logsDeletedAt: run.logsDeletedAt,
152+
rootTaskRun: run.rootTaskRun,
144153
environment: {
145154
id: run.runtimeEnvironment.id,
146155
organizationId: run.runtimeEnvironment.organizationId,

apps/webapp/app/presenters/v3/SpanPresenter.server.ts

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,21 @@ export class SpanPresenter extends BasePresenter {
132132
exportName: true,
133133
},
134134
},
135+
//relationships
136+
rootTaskRun: {
137+
select: {
138+
taskIdentifier: true,
139+
friendlyId: true,
140+
spanId: true,
141+
},
142+
},
143+
parentTaskRun: {
144+
select: {
145+
taskIdentifier: true,
146+
friendlyId: true,
147+
spanId: true,
148+
},
149+
},
135150
},
136151
where: {
137152
spanId,
@@ -281,7 +296,15 @@ export class SpanPresenter extends BasePresenter {
281296
output,
282297
outputType: finishedAttempt?.outputType ?? "application/json",
283298
error,
284-
links: span?.links,
299+
relationships: {
300+
root: run.rootTaskRun
301+
? {
302+
...run.rootTaskRun,
303+
isParent: run.parentTaskRun?.friendlyId === run.rootTaskRun.friendlyId,
304+
}
305+
: undefined,
306+
parent: run.parentTaskRun ?? undefined,
307+
},
285308
context: JSON.stringify(context, null, 2),
286309
metadata,
287310
};
@@ -307,10 +330,29 @@ export class SpanPresenter extends BasePresenter {
307330
return;
308331
}
309332

333+
const triggeredRuns = await this._replica.taskRun.findMany({
334+
select: {
335+
friendlyId: true,
336+
taskIdentifier: true,
337+
spanId: true,
338+
createdAt: true,
339+
number: true,
340+
lockedToVersion: {
341+
select: {
342+
version: true,
343+
},
344+
},
345+
},
346+
where: {
347+
parentSpanId: spanId,
348+
},
349+
});
350+
310351
return {
311352
...span,
312353
events: span.events,
313354
properties: span.properties ? JSON.stringify(span.properties, null, 2) : undefined,
355+
triggeredRuns,
314356
showActionBar: span.show?.actions === true,
315357
};
316358
}

0 commit comments

Comments
 (0)