🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix: webhook UI (#7808)
Max Deichmann3ecbcc1670ff
diff --git a/web/src/features/automations/components/AutomationExecutionsTable.tsx b/web/src/features/automations/components/AutomationExecutionsTable.tsxindex fe0b0c91e6..8efe5f244c 100644--- a/web/src/features/automations/components/AutomationExecutionsTable.tsx+++ b/web/src/features/automations/components/AutomationExecutionsTable.tsx@@ -113,14 +113,11 @@ export const AutomationExecutionsTable: React.FC<accessorKey: "error",header: "Error",id: "error",+ size: 150,cell: ({ row }) => {const value = row.getValue("error") as string | null;if (!value) return <span className="text-muted-foreground">-</span>;- return (- <div className="max-w-xs">- <span className="break-words text-xs text-red-600">{value}</span>- </div>- );+ return value;},},];diff --git a/web/src/features/automations/components/DeleteAutomationButton.tsx b/web/src/features/automations/components/DeleteAutomationButton.tsxindex 782f719521..3ca492eb6a 100644--- a/web/src/features/automations/components/DeleteAutomationButton.tsx+++ b/web/src/features/automations/components/DeleteAutomationButton.tsx@@ -74,8 +74,8 @@ export const DeleteAutomationButton: React.FC<DeleteAutomationButtonProps> = ({<PopoverContent><h2 className="text-md mb-3 font-semibold">Please confirm</h2><p className="mb-3 text-sm">- This action permanently deletes this automation. This cannot be- undone.+ This action permanently deletes this automation and execution history.+ This cannot be undone.</p><div className="flex justify-end space-x-4"><Buttondiff --git a/web/src/features/automations/components/WebhookButton.tsx b/web/src/features/automations/components/WebhookButton.tsxindex 571c79958f..9b11e082be 100644--- a/web/src/features/automations/components/WebhookButton.tsx+++ b/web/src/features/automations/components/WebhookButton.tsx@@ -1,7 +1,8 @@import { ActionButton } from "@/src/components/ActionButton";import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";-import { Zap } from "lucide-react";+import { Zap, Loader2 } from "lucide-react";import { type ButtonProps } from "@/src/components/ui/button";+import { api } from "@/src/utils/api";export const WebhookButton = ({projectId,@@ -14,15 +15,38 @@ export const WebhookButton = ({scope: "automations:read",});+ const numberOfWebHooks = api.automations.count.useQuery({+ projectId,+ type: "WEBHOOK",+ });++ const numberIndicator = numberOfWebHooks.isLoading ? (+ <span className="ml-1.5 inline-flex w-6 items-center justify-center rounded-sm bg-transparent px-1 text-xs">+ <Loader2 className="h-3 w-3 animate-spin" />+ </span>+ ) : (+ <span+ className={+ "ml-1.5 inline-flex w-6 items-center justify-center rounded-sm bg-input px-1 text-xs shadow-sm @6xl:inline @6xl:hidden"+ }+ >+ {numberOfWebHooks.data}+ </span>+ );+return (<ActionButtonhref={`/project/${projectId}/automations`}icon={<Zap className="h-4 w-4" aria-hidden="true" />}hasAccess={hasAccess}title="Webhooks"+ variant="outline"{...buttonProps}>- <span className="hidden md:ml-1 md:inline">Webhooks</span>+ <span className="hidden md:ml-1 md:inline">+ Webhooks+ {numberIndicator}+ </span></ActionButton>);};diff --git a/web/src/features/automations/components/actions/WebhookActionForm.tsx b/web/src/features/automations/components/actions/WebhookActionForm.tsxindex 92e321f3a9..1b4ceda2c9 100644--- a/web/src/features/automations/components/actions/WebhookActionForm.tsx+++ b/web/src/features/automations/components/actions/WebhookActionForm.tsx@@ -42,6 +42,7 @@ import {} from "@/src/components/ui/popover";import { WebhookSecretRender } from "../WebhookSecretRender";import { CodeView } from "@/src/components/ui/CodeJsonViewer";+import { showSuccessToast } from "@/src/features/notifications/showSuccessToast";export const webhookSchema = z.object({url: z.url(),@@ -320,6 +321,10 @@ export const RegenerateWebhookSecretButton = ({const regenerateSecretMutation =api.automations.regenerateWebhookSecret.useMutation({onSuccess: (data) => {+ showSuccessToast({+ title: "Webhook Secret Regenerated",+ description: "Your webhook secret has been successfully regenerated.",+ });setRegeneratedSecret(data.webhookSecret);setShowRegenerateDialog(true);utils.automations.invalidate();diff --git a/web/src/features/automations/components/automationForm.tsx b/web/src/features/automations/components/automationForm.tsxindex 0f34d9a0d2..0c1842c9db 100644--- a/web/src/features/automations/components/automationForm.tsx+++ b/web/src/features/automations/components/automationForm.tsx@@ -41,6 +41,7 @@ import { InlineFilterBuilder } from "@/src/features/filters/components/filter-buimport { DeleteAutomationButton } from "./DeleteAutomationButton";import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";import { showSuccessToast } from "@/src/features/notifications/showSuccessToast";+import { showErrorToast } from "@/src/features/notifications/showErrorToast";import { ActionHandlerRegistry } from "./actions";import { webhookSchema } from "./actions/WebhookActionForm";import { MultiSelect } from "@/src/features/filters/components/multi-select";@@ -54,7 +55,9 @@ enum TriggerEventSource {const baseFormSchema = z.object({name: z.string().min(1, "Name is required").max(100),eventSource: z.string().min(1, "Event source is required"),- eventAction: z.array(z.string()),+ eventAction: z+ .array(z.string())+ .min(1, "At least one event action is required"),status: z.enum(["ACTIVE", "INACTIVE"]),filter: z.array(z.any()).optional(),});@@ -175,10 +178,10 @@ export const AutomationForm = ({// Handle form submissionconst onSubmit = async (data: FormValues) => {if (!hasAccess) {- showSuccessToast({- title: "Permission Denied",- description: "You don't have permission to modify automations.",- });+ showErrorToast(+ "Permission Denied",+ "You don't have permission to modify automations.",+ );return;}@@ -187,11 +190,10 @@ export const AutomationForm = ({const validation = handler.validateFormData(data);if (!validation.isValid) {- showSuccessToast({- title: "Validation Error",- description:- validation.errors?.join(", ") || "Please fill in all required fields",- });+ showErrorToast(+ "Validation Error",+ validation.errors?.join(", ") || "Please fill in all required fields",+ );return;}@@ -211,6 +213,11 @@ export const AutomationForm = ({actionConfig: actionConfig,});+ showSuccessToast({+ title: "Automation Updated",+ description: `Successfully updated automation "${data.name}".`,+ });+onSuccess?.(automation.id);} else {// Create new automation@@ -224,6 +231,12 @@ export const AutomationForm = ({actionType: data.actionType,actionConfig: actionConfig,});++ showSuccessToast({+ title: "Automation Created",+ description: `Successfully created automation "${data.name}".`,+ });+onSuccess?.(result.automation.id, result.webhookSecret);}};diff --git a/web/src/features/automations/components/automations.tsx b/web/src/features/automations/components/automations.tsxindex a5dc4d5444..13721d2407 100644--- a/web/src/features/automations/components/automations.tsx+++ b/web/src/features/automations/components/automations.tsx@@ -297,8 +297,8 @@ export default function AutomationsPage() {title: "Webhooks",breadcrumb: [{- name: "Webhooks",- href: `/project/${projectId}/automations`,+ name: "Prompts",+ href: `/project/${projectId}/prompts/`,},],actionButtonsRight: (diff --git a/web/src/features/automations/server/router.ts b/web/src/features/automations/server/router.tsindex 14f3240fa3..78b17a608f 100644--- a/web/src/features/automations/server/router.ts+++ b/web/src/features/automations/server/router.ts@@ -4,6 +4,7 @@ import { z } from "zod/v4";import {ActionCreateSchema,ActionType,+ ActionTypeSchema,JobConfigState,} from "@langfuse/shared";import { throwIfNoProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";@@ -476,4 +477,23 @@ export const automationsRouter = createTRPCRouter({});});}),++ count: protectedProjectProcedure+ .input(z.object({ projectId: z.string(), type: ActionTypeSchema }))+ .query(async ({ ctx, input }) => {+ throwIfNoProjectAccess({+ session: ctx.session,+ projectId: input.projectId,+ scope: "automations:read",+ });++ const count = await ctx.prisma.action.count({+ where: {+ projectId: input.projectId,+ ...(input.type === "WEBHOOK" && { type: "WEBHOOK" }),+ },+ });++ return count;+ }),});diff --git a/web/src/pages/project/[projectId]/prompts/[[...folder]].tsx b/web/src/pages/project/[projectId]/prompts/[[...folder]].tsxindex 9b5e4fd2c8..839e8367f1 100644--- a/web/src/pages/project/[projectId]/prompts/[[...folder]].tsx+++ b/web/src/pages/project/[projectId]/prompts/[[...folder]].tsx@@ -90,9 +90,7 @@ export default function PromptsWithFolder() {},actionButtonsRight: (<>- {projectId && (- <WebhookButton projectId={projectId} variant="secondary" />- )}+ {projectId && <WebhookButton projectId={projectId} />}<ActionButtonicon={<PlusIcon className="h-4 w-4" aria-hidden="true" />}hasAccess={hasCUDAccess}