Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
f8646d6
refactor: update webhooks page structure and remove unused components
sarimrmalik Apr 17, 2026
2e0e1da
refactor: simplify webhooks table and update styling
sarimrmalik Apr 17, 2026
9b80329
Merge remote-tracking branch 'origin/main' into refactor/webhooks-page
sarimrmalik Apr 23, 2026
99ebc97
Fix type errors
sarimrmalik Apr 23, 2026
d3cd38c
refactor: enhance layout and styling for dashboard components
sarimrmalik Apr 23, 2026
429f12e
refactor: enhance webhook add/edit dialog with example payload and ev…
sarimrmalik Apr 23, 2026
ab29a27
feat: add clearable input functionality to webhook dialog
sarimrmalik Apr 23, 2026
50b1a30
refactor: enhance webhook dialog with dynamic example payload
sarimrmalik Apr 24, 2026
ced46af
Merge remote-tracking branch 'origin/main' into refactor/webhooks-page
sarimrmalik Apr 24, 2026
333ad34
refactor: enhance webhook add/edit dialog with improved focus and sty…
sarimrmalik Apr 24, 2026
6c16231
feat: integrate clipboard functionality in webhook dialog
sarimrmalik Apr 24, 2026
63411f7
fix: ensure validation for webhook secret input
sarimrmalik Apr 27, 2026
0511804
Merge remote-tracking branch 'origin/main' into refactor/webhooks-page
sarimrmalik Apr 29, 2026
07d161e
refactor: overhaul webhooks management with TRPC integration
sarimrmalik Apr 29, 2026
ca97924
Merge remote-tracking branch 'origin/main' into refactor/webhooks-page
sarimrmalik May 4, 2026
59aa65d
feat: add maxLength to custom secret input in webhook dialog
sarimrmalik May 4, 2026
031df16
feat: integrate FinishWebhookSetupDialog for enhanced webhook setup e…
sarimrmalik May 4, 2026
a6eaccf
refactor: enhance WebhookTableRow component with improved structure a…
sarimrmalik May 4, 2026
8f32bf2
refactor: improve styling and structure of WebhooksTable and WebhookR…
sarimrmalik May 4, 2026
92c521a
refactor: update styling and structure of WebhookTableRow and Webhook…
sarimrmalik May 4, 2026
52bca58
Merge branch 'main' of https://github.com/e2b-dev/dashboard into refa…
sarimrmalik May 6, 2026
30a5425
refactor: update webhook management to use 'create' and 'update' modes
sarimrmalik May 6, 2026
2db48f4
refactor: update UserAvatar component to use 'label' prop instead of …
sarimrmalik May 7, 2026
ce17dd8
refactor: enhance WebhookTableRow with URL copy functionality
sarimrmalik May 7, 2026
1c45c47
refactor: enhance WebhookTableRow with event badges and tooltips
sarimrmalik May 7, 2026
8bf085d
feat: introduce SandboxLifecycleEventType for webhook management
sarimrmalik May 7, 2026
5e782c5
refactor: update WebhookTableRow and WebhooksTable for improved layou…
sarimrmalik May 7, 2026
ff7b46b
refactor: streamline WebhookTableRow actions and improve secret editi…
sarimrmalik May 7, 2026
42a4519
feat: add DiscardWebhookChangesDialog for unsaved changes confirmation
sarimrmalik May 7, 2026
3fdf280
refactor: replace WebhookDeleteDialog with DeleteWebhookDialog for im…
sarimrmalik May 7, 2026
9494a15
refactor: enhance webhook dialogs and table layout for improved usabi…
sarimrmalik May 7, 2026
d6af1ae
refactor: improve EditSecretDialog and UpsertWebhookDialog for better…
sarimrmalik May 7, 2026
07c1717
refactor: replace EditSecretDialog with UpdateWebhookSecretDialog for…
sarimrmalik May 7, 2026
43c62a3
refactor: enhance UpsertWebhookDialog and related components for impr…
sarimrmalik May 7, 2026
a29e59c
refactor: simplify button variant logic in UpsertWebhookDialog
sarimrmalik May 7, 2026
78094c5
refactor: enhance webhook upsert logic and validation
sarimrmalik May 7, 2026
7cc4045
refactor: update event handling and validation in UpsertWebhookDialog
sarimrmalik May 7, 2026
ec0a71c
feat: add clearable functionality to webhook input field in UpsertWeb…
sarimrmalik May 7, 2026
1edb57d
refactor: simplify WebhooksPageContent structure and enhance loading …
sarimrmalik May 7, 2026
29ec381
refactor: remove disabled prop from WebhooksSearchFieldShell for impr…
sarimrmalik May 7, 2026
a0b0b79
refactor: update UpsertWebhookDialog to improve event handling and de…
sarimrmalik May 7, 2026
14e3832
Remove unused component
sarimrmalik May 8, 2026
f072a70
refactor: update webhook context structure in webhooksRouter
sarimrmalik May 8, 2026
e4722c1
Merge remote-tracking branch 'origin/main' into refactor/webhooks-page
sarimrmalik May 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 13 additions & 44 deletions src/app/dashboard/[teamSlug]/webhooks/page.tsx
Original file line number Diff line number Diff line change
@@ -1,60 +1,29 @@
import { notFound } from 'next/navigation'
import { INCLUDE_ARGUS } from '@/configs/flags'
import WebhookAddEditDialog from '@/features/dashboard/settings/webhooks/add-edit-dialog'
import WebhooksTable from '@/features/dashboard/settings/webhooks/table'
import Frame from '@/ui/frame'
import { Button } from '@/ui/primitives/button'
import {
Card,
CardContent,
CardDescription,
CardHeader,
} from '@/ui/primitives/card'
import { AddIcon } from '@/ui/primitives/icons'
import { Page } from '@/features/dashboard/layouts/page'
import { WebhooksPageContent } from '@/features/dashboard/settings/webhooks/webhooks-page-content'
import { HydrateClient, prefetch, trpc } from '@/trpc/server'

interface WebhooksPageClientProps {
interface WebhooksPageProps {
params: Promise<{
teamSlug: string
}>
}

export default async function WebhooksPage({
params,
}: WebhooksPageClientProps) {
export default async function WebhooksPage({ params }: WebhooksPageProps) {
if (!INCLUDE_ARGUS) {
return notFound()
}

return (
<Frame
classNames={{
wrapper: 'w-full max-md:p-0',
frame: 'max-md:border-none',
}}
>
<Card className="w-full">
<CardHeader>
<div className="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between sm:gap-6">
<CardDescription className="max-w-[600px] text-fg">
Webhooks allow your external service to be notified when sandbox
lifecycle events happen. When the specified event happens, we'll
send a POST request to the configured URLs.
</CardDescription>
const { teamSlug } = await params

<WebhookAddEditDialog mode="add">
<Button className="w-full sm:w-auto sm:self-start">
<AddIcon className="size-4" /> Add Webhook
</Button>
</WebhookAddEditDialog>
</div>
</CardHeader>
prefetch(trpc.webhooks.list.queryOptions({ teamSlug }))

<CardContent>
<div className="w-full overflow-x-auto">
<WebhooksTable params={params} className="min-w-[900px]" />
</div>
</CardContent>
</Card>
</Frame>
return (
<HydrateClient>
<Page>
<WebhooksPageContent />
</Page>
</HydrateClient>
)
}
13 changes: 13 additions & 0 deletions src/core/modules/sandboxes/lifecycle-event-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { z } from 'zod'

const SandboxLifecycleEventTypeSchema = z.enum([
'sandbox.lifecycle.created',
'sandbox.lifecycle.updated',
'sandbox.lifecycle.paused',
'sandbox.lifecycle.resumed',
'sandbox.lifecycle.killed',
])

type SandboxLifecycleEventType = z.infer<typeof SandboxLifecycleEventTypeSchema>

export { SandboxLifecycleEventTypeSchema, type SandboxLifecycleEventType }
92 changes: 63 additions & 29 deletions src/core/modules/webhooks/repository.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type WebhooksRepositoryDeps = {
export type WebhooksScope = TeamRequestScope

export interface UpsertWebhookInput {
mode: 'create' | 'edit'
mode: 'create' | 'update'
webhookId?: string
name: string
url: string
Expand Down Expand Up @@ -68,34 +68,68 @@ export function createWebhooksRepository(
return ok(response.data ?? [])
},
async upsertWebhook(input) {
const response =
input.mode === 'edit'
? await deps.infraClient.PATCH('/events/webhooks/{webhookID}', {
headers: {
...deps.authHeaders(scope.accessToken, scope.teamId),
},
params: {
path: { webhookID: input.webhookId ?? '' },
},
body: {
name: input.name,
url: input.url,
events: input.events,
enabled: input.enabled,
},
})
: await deps.infraClient.POST('/events/webhooks', {
headers: {
...deps.authHeaders(scope.accessToken, scope.teamId),
},
body: {
name: input.name,
url: input.url,
events: input.events,
enabled: input.enabled,
signatureSecret: input.signatureSecret ?? '',
},
})
if (input.mode === 'update') {
if (!input.webhookId) {
return err(
repoErrorFromHttp(
400,
'webhookId is required when updating a webhook'
)
)
}

const response = await deps.infraClient.PATCH(
'/events/webhooks/{webhookID}',
{
headers: {
...deps.authHeaders(scope.accessToken, scope.teamId),
},
params: {
path: { webhookID: input.webhookId },
},
body: {
name: input.name,
url: input.url,
events: input.events,
enabled: input.enabled,
},
}
)

if (!response.response.ok || response.error) {
return err(
repoErrorFromHttp(
response.response.status,
response.error?.message ?? 'Failed to upsert webhook',
response.error
)
)
}

return ok(undefined)
}

if (!input.signatureSecret) {
return err(
repoErrorFromHttp(
400,
'signatureSecret is required when creating a webhook'
)
)
}

const response = await deps.infraClient.POST('/events/webhooks', {
headers: {
...deps.authHeaders(scope.accessToken, scope.teamId),
},
body: {
name: input.name,
url: input.url,
events: input.events,
enabled: input.enabled,
signatureSecret: input.signatureSecret,
},
})

if (!response.response.ok || response.error) {
return err(
Expand Down
157 changes: 0 additions & 157 deletions src/core/server/actions/webhooks-actions.ts

This file was deleted.

2 changes: 2 additions & 0 deletions src/core/server/api/routers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { sandboxesRouter } from './sandboxes'
import { supportRouter } from './support'
import { teamsRouter } from './teams'
import { templatesRouter } from './templates'
import { webhooksRouter } from './webhooks'

export const trpcAppRouter = createTRPCRouter({
sandbox: sandboxRouter,
Expand All @@ -15,6 +16,7 @@ export const trpcAppRouter = createTRPCRouter({
billing: billingRouter,
support: supportRouter,
teams: teamsRouter,
webhooks: webhooksRouter,
})

export type TRPCAppRouter = typeof trpcAppRouter
Expand Down
Loading
Loading