Skip to content

Commit 9716038

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/restore-detection
2 parents ea66896 + a3ef6ea commit 9716038

File tree

24 files changed

+711
-177
lines changed

24 files changed

+711
-177
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
export function MoveToTopIcon({ className }: { className?: string }) {
2+
return (
3+
<svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
4+
<g clipPath="url(#clip0_17186_103975)">
5+
<path
6+
d="M12 21L12 9"
7+
stroke="currentColor"
8+
strokeWidth="2"
9+
strokeLinecap="round"
10+
strokeLinejoin="round"
11+
/>
12+
<path
13+
d="M3 3L21 3"
14+
stroke="currentColor"
15+
strokeWidth="2"
16+
strokeLinecap="round"
17+
strokeLinejoin="round"
18+
/>
19+
<path
20+
d="M16.5 11.5L12 7L7.5 11.5"
21+
stroke="currentColor"
22+
strokeWidth="2"
23+
strokeLinecap="round"
24+
strokeLinejoin="round"
25+
/>
26+
</g>
27+
<defs>
28+
<clipPath id="clip0_17186_103975">
29+
<rect width="24" height="24" fill="currentColor" />
30+
</clipPath>
31+
</defs>
32+
</svg>
33+
);
34+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
export function MoveUpIcon({ className }: { className?: string }) {
2+
return (
3+
<svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
4+
<g clipPath="url(#clip0_17177_110851)">
5+
<path
6+
d="M12 21L12 13"
7+
stroke="currentColor"
8+
strokeWidth="2"
9+
strokeLinecap="round"
10+
strokeLinejoin="round"
11+
/>
12+
<path
13+
d="M3 3L21 3"
14+
stroke="currentColor"
15+
strokeWidth="2"
16+
strokeLinecap="round"
17+
strokeLinejoin="round"
18+
/>
19+
<path
20+
d="M3 7L21 7"
21+
stroke="currentColor"
22+
strokeWidth="2"
23+
strokeLinecap="round"
24+
strokeLinejoin="round"
25+
/>
26+
<path
27+
d="M16.5 15.5L12 11L7.5 15.5"
28+
stroke="currentColor"
29+
strokeWidth="2"
30+
strokeLinecap="round"
31+
strokeLinejoin="round"
32+
/>
33+
</g>
34+
<defs>
35+
<clipPath id="clip0_17177_110851">
36+
<rect width="24" height="24" fill="currentColor" />
37+
</clipPath>
38+
</defs>
39+
</svg>
40+
);
41+
}

apps/webapp/app/components/DefinitionTooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function DefinitionTip({
1414
return (
1515
<TooltipProvider>
1616
<Tooltip disableHoverableContent>
17-
<TooltipTrigger>
17+
<TooltipTrigger className="text-left">
1818
<span className="cursor-default underline decoration-charcoal-500 decoration-dashed underline-offset-4 transition hover:decoration-charcoal-400">
1919
{children}
2020
</span>

apps/webapp/app/components/Shortcuts.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ function ShortcutContent() {
147147
</Paragraph>
148148
<ShortcutKey shortcut={{ key: "9" }} variant="medium/bright" />
149149
</Shortcut>
150+
<Shortcut name="Jump to root run">
151+
<ShortcutKey shortcut={{ key: "t" }} variant="medium/bright" />
152+
</Shortcut>
153+
<Shortcut name="Jump to parent run">
154+
<ShortcutKey shortcut={{ key: "p" }} variant="medium/bright" />
155+
</Shortcut>
150156
</div>
151157
<div className="space-y-3">
152158
<Header3>Schedules page</Header3>

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

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { Link } from "@remix-run/react";
22
import { cn } from "~/utils/cn";
33
import { Icon, type RenderIcon } from "./Icon";
4+
import { useRef } from "react";
5+
import { type ShortcutDefinition, useShortcutKeys } from "~/hooks/useShortcutKeys";
6+
import { ShortcutKey } from "./ShortcutKey";
7+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./Tooltip";
48

59
const variations = {
610
primary:
@@ -17,6 +21,9 @@ type TextLinkProps = {
1721
trailingIconClassName?: string;
1822
variant?: keyof typeof variations;
1923
children: React.ReactNode;
24+
shortcut?: ShortcutDefinition;
25+
hideShortcutKey?: boolean;
26+
tooltip?: React.ReactNode;
2027
} & React.AnchorHTMLAttributes<HTMLAnchorElement>;
2128

2229
export function TextLink({
@@ -27,20 +34,61 @@ export function TextLink({
2734
trailingIcon,
2835
trailingIconClassName,
2936
variant = "primary",
37+
shortcut,
38+
hideShortcutKey,
39+
tooltip,
3040
...props
3141
}: TextLinkProps) {
42+
const innerRef = useRef<HTMLAnchorElement>(null);
3243
const classes = variations[variant];
33-
return to ? (
34-
<Link to={to} className={cn(classes, className)} {...props}>
44+
45+
if (shortcut) {
46+
useShortcutKeys({
47+
shortcut: shortcut,
48+
action: () => {
49+
if (innerRef.current) {
50+
innerRef.current.click();
51+
}
52+
},
53+
});
54+
}
55+
56+
const renderShortcutKey = () =>
57+
shortcut &&
58+
!hideShortcutKey && <ShortcutKey className="ml-1.5" shortcut={shortcut} variant="small" />;
59+
60+
const linkContent = (
61+
<>
3562
{children}{" "}
3663
{trailingIcon && <Icon icon={trailingIcon} className={cn("size-4", trailingIconClassName)} />}
64+
{shortcut && !tooltip && renderShortcutKey()}
65+
</>
66+
);
67+
68+
const linkElement = to ? (
69+
<Link ref={innerRef} to={to} className={cn(classes, className)} {...props}>
70+
{linkContent}
3771
</Link>
3872
) : href ? (
39-
<a href={href} className={cn(classes, className)} {...props}>
40-
{children}{" "}
41-
{trailingIcon && <Icon icon={trailingIcon} className={cn("size-4", trailingIconClassName)} />}
73+
<a ref={innerRef} href={href} className={cn(classes, className)} {...props}>
74+
{linkContent}
4275
</a>
4376
) : (
4477
<span>Need to define a path or href</span>
4578
);
79+
80+
if (tooltip) {
81+
return (
82+
<TooltipProvider>
83+
<Tooltip>
84+
<TooltipTrigger asChild>{linkElement}</TooltipTrigger>
85+
<TooltipContent className="text-dimmed flex items-center gap-3 py-1.5 pl-2.5 pr-3 text-xs">
86+
{tooltip} {shortcut && renderShortcutKey()}
87+
</TooltipContent>
88+
</Tooltip>
89+
</TooltipProvider>
90+
);
91+
}
92+
93+
return linkElement;
4694
}

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
CheckCircleIcon,
33
ExclamationTriangleIcon,
44
NoSymbolIcon,
5+
RectangleStackIcon,
56
XCircleIcon,
67
} from "@heroicons/react/20/solid";
78
import type { WorkerDeploymentStatus } from "@trigger.dev/database";
@@ -49,6 +50,9 @@ export function DeploymentStatusIcon({
4950
}) {
5051
switch (status) {
5152
case "PENDING":
53+
return (
54+
<RectangleStackIcon className={cn(deploymentStatusClassNameColor(status), className)} />
55+
);
5256
case "BUILDING":
5357
case "DEPLOYING":
5458
return <Spinner className={cn(deploymentStatusClassNameColor(status), className)} />;
@@ -73,6 +77,7 @@ export function DeploymentStatusIcon({
7377
export function deploymentStatusClassNameColor(status: WorkerDeploymentStatus): string {
7478
switch (status) {
7579
case "PENDING":
80+
return "text-charcoal-500";
7681
case "BUILDING":
7782
case "DEPLOYING":
7883
return "text-pending";
@@ -92,7 +97,7 @@ export function deploymentStatusClassNameColor(status: WorkerDeploymentStatus):
9297
export function deploymentStatusTitle(status: WorkerDeploymentStatus, isBuilt: boolean): string {
9398
switch (status) {
9499
case "PENDING":
95-
return "Pending…";
100+
return "Queued…";
96101
case "BUILDING":
97102
return "Building…";
98103
case "DEPLOYING":
@@ -121,6 +126,7 @@ export function deploymentStatusTitle(status: WorkerDeploymentStatus, isBuilt: b
121126

122127
// PENDING and CANCELED are not used so are ommited from the UI
123128
export const deploymentStatuses: WorkerDeploymentStatus[] = [
129+
"PENDING",
124130
"BUILDING",
125131
"DEPLOYING",
126132
"DEPLOYED",

apps/webapp/app/env.server.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,10 @@ const EnvironmentSchema = z
312312
.number()
313313
.int()
314314
.default(60 * 1000 * 8), // 8 minutes
315+
DEPLOY_QUEUE_TIMEOUT_MS: z.coerce
316+
.number()
317+
.int()
318+
.default(60 * 1000 * 15), // 15 minutes
315319

316320
OBJECT_STORE_BASE_URL: z.string().optional(),
317321
OBJECT_STORE_ACCESS_KEY_ID: z.string().optional(),

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export class DeploymentPresenter {
102102
builtAt: true,
103103
deployedAt: true,
104104
createdAt: true,
105+
startedAt: true,
105106
git: true,
106107
promotions: {
107108
select: {
@@ -145,6 +146,7 @@ export class DeploymentPresenter {
145146
version: deployment.version,
146147
status: deployment.status,
147148
createdAt: deployment.createdAt,
149+
startedAt: deployment.startedAt,
148150
builtAt: deployment.builtAt,
149151
deployedAt: deployment.deployedAt,
150152
tasks: deployment.worker?.tasks,

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { millisecondsToNanoseconds } from "@trigger.dev/core/v3";
22
import { createTreeFromFlatItems, flattenTree } from "~/components/primitives/TreeView/TreeView";
3-
import { prisma, PrismaClient } from "~/db.server";
3+
import { prisma, type PrismaClient } from "~/db.server";
44
import { createTimelineSpanEventsFromSpanEvents } from "~/utils/timelineSpanEvents";
55
import { getUsername } from "~/utils/username";
66
import { eventRepository } from "~/v3/eventRepository.server";
@@ -58,7 +58,13 @@ export class RunPresenter {
5858
rootTaskRun: {
5959
select: {
6060
friendlyId: true,
61-
taskIdentifier: true,
61+
spanId: true,
62+
createdAt: true,
63+
},
64+
},
65+
parentTaskRun: {
66+
select: {
67+
friendlyId: true,
6268
spanId: true,
6369
createdAt: true,
6470
},
@@ -111,6 +117,7 @@ export class RunPresenter {
111117
completedAt: run.completedAt,
112118
logsDeletedAt: showDeletedLogs ? null : run.logsDeletedAt,
113119
rootTaskRun: run.rootTaskRun,
120+
parentTaskRun: run.parentTaskRun,
114121
environment: {
115122
id: run.runtimeEnvironment.id,
116123
organizationId: run.runtimeEnvironment.organizationId,
@@ -202,8 +209,6 @@ export class RunPresenter {
202209
trace: {
203210
rootSpanStatus,
204211
events: events,
205-
parentRunFriendlyId:
206-
tree?.id === traceSummary.rootSpan.id ? undefined : traceSummary.rootSpan.runId,
207212
duration: totalDuration,
208213
rootStartedAt: tree?.data.startTime,
209214
startedAt: run.startedAt,

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.deployments.$deploymentParam/route.tsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { requireUserId } from "~/services/session.server";
3232
import { cn } from "~/utils/cn";
3333
import { v3DeploymentParams, v3DeploymentsPath, v3RunsPath } from "~/utils/pathBuilder";
3434
import { capitalizeWord } from "~/utils/string";
35+
import { UserTag } from "../_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.deployments/route";
3536

3637
export const loader = async ({ request, params }: LoaderFunctionArgs) => {
3738
const userId = await requireUserId(request);
@@ -187,7 +188,13 @@ export default function Page() {
187188
<Property.Item>
188189
<Property.Label>Started at</Property.Label>
189190
<Property.Value>
190-
<DateTimeAccurate date={deployment.createdAt} /> UTC
191+
{deployment.startedAt ? (
192+
<>
193+
<DateTimeAccurate date={deployment.startedAt} /> UTC
194+
</>
195+
) : (
196+
"–"
197+
)}
191198
</Property.Value>
192199
</Property.Item>
193200
<Property.Item>
@@ -226,17 +233,16 @@ export default function Page() {
226233
<Property.Item>
227234
<Property.Label>Deployed by</Property.Label>
228235
<Property.Value>
229-
{deployment.deployedBy ? (
230-
<div className="flex items-center gap-1">
231-
<UserAvatar
232-
avatarUrl={deployment.deployedBy.avatarUrl}
233-
name={deployment.deployedBy.name ?? deployment.deployedBy.displayName}
234-
className="h-4 w-4"
235-
/>
236-
<Paragraph variant="small">
237-
{deployment.deployedBy.name ?? deployment.deployedBy.displayName}
238-
</Paragraph>
239-
</div>
236+
{deployment.git?.source === "trigger_github_app" ? (
237+
<UserTag
238+
name={deployment.git.ghUsername ?? "GitHub Integration"}
239+
avatarUrl={deployment.git.ghUserAvatarUrl}
240+
/>
241+
) : deployment.deployedBy ? (
242+
<UserTag
243+
name={deployment.deployedBy.name ?? deployment.deployedBy.displayName ?? ""}
244+
avatarUrl={deployment.deployedBy.avatarUrl ?? undefined}
245+
/>
240246
) : (
241247
"–"
242248
)}

0 commit comments

Comments
 (0)