Skip to content

Commit 3955654

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/redis-worker-package
2 parents ba57e06 + adca199 commit 3955654

File tree

141 files changed

+13813
-5332
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+13813
-5332
lines changed

.cursor/mcp.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
"url": "http://localhost:3333/sse"
55
}
66
}
7-
}
7+
}

.cursor/rules/writing-tasks.mdc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: Guidelines for writing Trigger.dev tasks
3-
globs: **/trigger/**/*.ts, **/trigger/**/*.tsx
3+
globs: **/trigger/**/*.ts, **/trigger/**/*.tsx,**/trigger/**/*.js,**/trigger/**/*.jsx
44
alwaysApply: false
55
---
66
# How to write Trigger.dev tasks
@@ -832,7 +832,7 @@ npm add @trigger.dev/react-hooks
832832

833833
All hooks require a Public Access Token. You can provide it directly to each hook:
834834

835-
```typescriptx
835+
```typescript
836836
import { useRealtimeRun } from "@trigger.dev/react-hooks";
837837

838838
function MyComponent({ runId, publicAccessToken }) {
@@ -845,7 +845,7 @@ function MyComponent({ runId, publicAccessToken }) {
845845

846846
Or use the `TriggerAuthContext` provider:
847847

848-
```typescriptx
848+
```typescript
849849
import { TriggerAuthContext } from "@trigger.dev/react-hooks";
850850

851851
function SetupTrigger({ publicAccessToken }) {
@@ -859,7 +859,7 @@ function SetupTrigger({ publicAccessToken }) {
859859

860860
For Next.js App Router, wrap the provider in a client component:
861861

862-
```typescriptx
862+
```typescript
863863
// components/TriggerProvider.tsx
864864
"use client";
865865

@@ -879,7 +879,7 @@ export function TriggerProvider({ accessToken, children }) {
879879
Several approaches for Next.js App Router:
880880

881881
1. **Using cookies**:
882-
```typescriptx
882+
```typescript
883883
// Server action
884884
export async function startRun() {
885885
const handle = await tasks.trigger<typeof exampleTask>("example", { foo: "bar" });
@@ -899,7 +899,7 @@ export default function RunPage({ params }) {
899899
```
900900

901901
2. **Using query parameters**:
902-
```typescriptx
902+
```typescript
903903
// Server action
904904
export async function startRun() {
905905
const handle = await tasks.trigger<typeof exampleTask>("example", { foo: "bar" });
@@ -908,7 +908,7 @@ export async function startRun() {
908908
```
909909

910910
3. **Server-side token generation**:
911-
```typescriptx
911+
```typescript
912912
// Page component
913913
export default async function RunPage({ params }) {
914914
const publicAccessToken = await generatePublicAccessToken(params.id);
@@ -938,7 +938,7 @@ export async function generatePublicAccessToken(runId: string) {
938938

939939
Data fetching hooks that use SWR for caching:
940940

941-
```typescriptx
941+
```typescript
942942
"use client";
943943
import { useRun } from "@trigger.dev/react-hooks";
944944
import type { myTask } from "@/trigger/myTask";

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,5 @@ apps/**/public/build
5858
.yarn
5959
*.tsbuildinfo
6060
/packages/cli-v3/src/package.json
61+
.husky
62+
/packages/react-hooks/src/package.json

.vscode/launch.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,15 @@
138138
"type": "node-terminal",
139139
"request": "launch",
140140
"name": "Debug RunEngine tests",
141-
"command": "pnpm run test --filter @internal/run-engine",
142-
"cwd": "${workspaceFolder}",
141+
"command": "pnpm run test ./src/engine/tests/releaseConcurrencyQueue.test.ts -t 'Should manage token bucket and queue correctly'",
142+
"cwd": "${workspaceFolder}/internal-packages/run-engine",
143143
"sourceMaps": true
144144
},
145145
{
146146
"type": "node-terminal",
147147
"request": "launch",
148148
"name": "Debug RunQueue tests",
149-
"command": "pnpm run test ./src/engine/tests/waitpoints.test.ts",
149+
"command": "pnpm run test ./src/run-queue/index.test.ts",
150150
"cwd": "${workspaceFolder}/internal-packages/run-engine",
151151
"sourceMaps": true
152152
}

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"search.exclude": {
66
"**/node_modules/**": true,
77
"packages/cli-v3/e2e": true
8-
}
8+
},
9+
"vitest.disableWorkspaceWarning": true
910
}
Loading

apps/webapp/app/components/BlankStatePanels.tsx

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
ClockIcon,
77
PlusIcon,
88
RectangleGroupIcon,
9+
RectangleStackIcon,
910
ServerStackIcon,
1011
Squares2X2Icon,
1112
} from "@heroicons/react/20/solid";
@@ -368,35 +369,28 @@ export function AlertsNoneDeployed() {
368369
);
369370
}
370371

371-
function AlertsNoneProd() {
372+
export function QueuesHasNoTasks() {
373+
const organization = useOrganization();
374+
const project = useProject();
375+
const environment = useEnvironment();
376+
372377
return (
373-
<div className="space-y-8">
374-
<InfoPanel
375-
icon={BellAlertIcon}
376-
iconClassName="text-red-500"
377-
title="Adding alerts"
378-
panelClassName="max-w-full"
378+
<InfoPanel
379+
title="You have no queues"
380+
icon={RectangleStackIcon}
381+
iconClassName="text-purple-500"
382+
panelClassName="max-w-full"
383+
>
384+
<Paragraph spacing variant="small">
385+
This means you haven't got any tasks yet in this environment.
386+
</Paragraph>
387+
<LinkButton
388+
to={v3EnvironmentPath(organization, project, environment)}
389+
variant="tertiary/medium"
379390
>
380-
<Paragraph spacing variant="small">
381-
You can get alerted when deployed runs fail.
382-
</Paragraph>
383-
<Paragraph spacing variant="small">
384-
We don't support alerts in the Development environment. Switch to a deployed environment
385-
to setup alerts.
386-
</Paragraph>
387-
<div className="flex gap-3">
388-
<LinkButton
389-
to={docsPath("troubleshooting-alerts")}
390-
variant="docs/medium"
391-
LeadingIcon={BookOpenIcon}
392-
className="inline-flex"
393-
>
394-
How to setup alerts
395-
</LinkButton>
396-
</div>
397-
</InfoPanel>
398-
<SwitcherPanel />
399-
</div>
391+
Add tasks
392+
</LinkButton>
393+
</InfoPanel>
400394
);
401395
}
402396

apps/webapp/app/components/SetupCommands.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import { createContext, useContext, useState } from "react";
22
import { useAppOrigin } from "~/hooks/useAppOrigin";
33
import { useProject } from "~/hooks/useProject";
4-
import { InlineCode } from "./code/InlineCode";
54
import {
65
ClientTabs,
76
ClientTabsContent,
87
ClientTabsList,
98
ClientTabsTrigger,
109
} from "./primitives/ClientTabs";
1110
import { ClipboardField } from "./primitives/ClipboardField";
12-
import { Paragraph } from "./primitives/Paragraph";
1311
import { Header3 } from "./primitives/Headers";
1412

1513
type PackageManagerContextType = {

apps/webapp/app/components/admin/debugTooltip.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
TooltipProvider,
77
TooltipTrigger,
88
} from "~/components/primitives/Tooltip";
9+
import { useOptionalEnvironment } from "~/hooks/useEnvironment";
910
import { useIsImpersonating, useOptionalOrganization } from "~/hooks/useOrganizations";
1011
import { useOptionalProject } from "~/hooks/useProject";
1112
import { useHasAdminAccess, useUser } from "~/hooks/useUser";
@@ -35,6 +36,7 @@ export function AdminDebugTooltip({ children }: { children?: React.ReactNode })
3536
function Content({ children }: { children: React.ReactNode }) {
3637
const organization = useOptionalOrganization();
3738
const project = useOptionalProject();
39+
const environment = useOptionalEnvironment();
3840
const user = useUser();
3941

4042
return (
@@ -62,6 +64,22 @@ function Content({ children }: { children: React.ReactNode }) {
6264
</Property.Item>
6365
</>
6466
)}
67+
{environment && (
68+
<>
69+
<Property.Item>
70+
<Property.Label>Environment ID</Property.Label>
71+
<Property.Value>{environment.id}</Property.Value>
72+
</Property.Item>
73+
<Property.Item>
74+
<Property.Label>Environment type</Property.Label>
75+
<Property.Value>{environment.type}</Property.Value>
76+
</Property.Item>
77+
<Property.Item>
78+
<Property.Label>Environment paused</Property.Label>
79+
<Property.Value>{environment.paused ? "Yes" : "No"}</Property.Value>
80+
</Property.Item>
81+
</>
82+
)}
6583
</Property.Table>
6684
<div className="pt-2">{children}</div>
6785
</div>

apps/webapp/app/components/layout/AppLayout.tsx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { useOptionalOrganization } from "~/hooks/useOrganizations";
21
import { cn } from "~/utils/cn";
3-
import { useShowUpgradePrompt } from "../billing/UpgradePrompt";
42

53
/** This container is used to surround the entire app, it correctly places the nav bar */
64
export function AppContainer({ children }: { children: React.ReactNode }) {
@@ -13,19 +11,7 @@ export function MainBody({ children }: { children: React.ReactNode }) {
1311

1412
/** This container should be placed around the content on a page */
1513
export function PageContainer({ children }: { children: React.ReactNode }) {
16-
const organization = useOptionalOrganization();
17-
const showUpgradePrompt = useShowUpgradePrompt(organization);
18-
19-
return (
20-
<div
21-
className={cn(
22-
"grid overflow-hidden",
23-
showUpgradePrompt.shouldShow ? "grid-rows-[5rem_1fr]" : "grid-rows-[2.5rem_1fr]"
24-
)}
25-
>
26-
{children}
27-
</div>
28-
);
14+
return <div className="grid grid-rows-[auto_1fr] overflow-hidden">{children}</div>;
2915
}
3016

3117
export function PageBody({
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { type ReactNode } from "react";
2+
import { AnimatedNumber } from "../primitives/AnimatedNumber";
3+
import { Spinner } from "../primitives/Spinner";
4+
import { cn } from "~/utils/cn";
5+
6+
interface BigNumberProps {
7+
title: ReactNode;
8+
animate?: boolean;
9+
loading?: boolean;
10+
value?: number;
11+
valueClassName?: string;
12+
defaultValue?: number;
13+
accessory?: ReactNode;
14+
suffix?: string;
15+
suffixClassName?: string;
16+
}
17+
18+
export function BigNumber({
19+
title,
20+
value,
21+
defaultValue,
22+
valueClassName,
23+
suffix,
24+
suffixClassName,
25+
accessory,
26+
animate = false,
27+
loading = false,
28+
}: BigNumberProps) {
29+
const v = value ?? defaultValue;
30+
return (
31+
<div className="grid grid-rows-[1.5rem_auto] gap-4 rounded-sm border border-grid-dimmed bg-background-bright p-4">
32+
<div className="flex items-center justify-between">
33+
<div className="text-2sm text-text-dimmed">{title}</div>
34+
{accessory && <div className="flex-shrink-0">{accessory}</div>}
35+
</div>
36+
<div
37+
className={cn(
38+
"h-[3.75rem] text-[3.75rem] font-normal tabular-nums leading-none text-text-bright",
39+
valueClassName
40+
)}
41+
>
42+
{loading ? (
43+
<Spinner className="size-6" />
44+
) : v !== undefined ? (
45+
<div className="flex items-baseline gap-1">
46+
{animate ? <AnimatedNumber value={v} /> : v}
47+
{suffix && <div className={cn("text-xs", suffixClassName)}>{suffix}</div>}
48+
</div>
49+
) : (
50+
"–"
51+
)}
52+
</div>
53+
</div>
54+
);
55+
}

apps/webapp/app/components/navigation/AccountSideMenu.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ export function AccountSideMenu({ user }: { user: User }) {
2222
to={rootPath()}
2323
fullWidth
2424
textAlignLeft
25-
className="text-text-bright"
2625
>
27-
Back to app
26+
<span className="text-text-bright">Back to app</span>
2827
</LinkButton>
2928
</div>
3029
<div className="mb-6 flex grow flex-col gap-1 overflow-y-auto px-1 pt-2 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { ExclamationCircleIcon } from "@heroicons/react/20/solid";
2+
import { useLocation } from "@remix-run/react";
3+
import { AnimatePresence, motion } from "framer-motion";
4+
import { useOptionalEnvironment } from "~/hooks/useEnvironment";
5+
import { useOptionalOrganization } from "~/hooks/useOrganizations";
6+
import { useOptionalProject } from "~/hooks/useProject";
7+
import { v3QueuesPath } from "~/utils/pathBuilder";
8+
import { environmentFullTitle } from "../environments/EnvironmentLabel";
9+
import { LinkButton } from "../primitives/Buttons";
10+
import { Icon } from "../primitives/Icon";
11+
import { Paragraph } from "../primitives/Paragraph";
12+
13+
export function EnvironmentPausedBanner() {
14+
const organization = useOptionalOrganization();
15+
const project = useOptionalProject();
16+
const environment = useOptionalEnvironment();
17+
const location = useLocation();
18+
19+
const hideButton = location.pathname.endsWith("/queues");
20+
21+
return (
22+
<AnimatePresence initial={false}>
23+
{organization && project && environment && environment.paused ? (
24+
<motion.div
25+
className="flex h-10 items-center justify-between overflow-hidden border-y border-amber-400/20 bg-warning/20 py-0 pl-3 pr-2"
26+
initial={{ opacity: 0, height: 0 }}
27+
animate={{ opacity: 1, height: "2.5rem" }}
28+
exit={{ opacity: 0, height: 0 }}
29+
>
30+
<div className="flex items-center gap-2">
31+
<Icon icon={ExclamationCircleIcon} className="h-5 w-5 text-amber-400" />
32+
<Paragraph variant="small" className="text-amber-200">
33+
{environmentFullTitle(environment)} environment paused. No new runs will be dequeued
34+
and executed.
35+
</Paragraph>
36+
</div>
37+
{hideButton ? null : (
38+
<div>
39+
<LinkButton
40+
variant="tertiary/small"
41+
to={v3QueuesPath(organization, project, environment)}
42+
>
43+
Manage
44+
</LinkButton>
45+
</div>
46+
)}
47+
</motion.div>
48+
) : null}
49+
</AnimatePresence>
50+
);
51+
}
52+
53+
export function useShowEnvironmentPausedBanner() {
54+
const environment = useOptionalEnvironment();
55+
const shouldShow = environment?.paused ?? false;
56+
return { shouldShow };
57+
}

0 commit comments

Comments
 (0)