Allow testing webhook response in setup flow (#3768)
This commit is contained in:
@@ -41,6 +41,7 @@ import {
|
||||
import { ProxySelector } from "@/components/ProxySelector";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { MAX_SCREENSHOT_SCROLLS_DEFAULT } from "@/routes/workflows/editor/nodes/Taskv2Node/types";
|
||||
import { TestWebhookDialog } from "@/components/TestWebhookDialog";
|
||||
type Props = {
|
||||
initialValues: CreateNewTaskFormValues;
|
||||
};
|
||||
@@ -527,11 +528,31 @@ function CreateNewTaskForm({ initialValues }: Props) {
|
||||
</FormLabel>
|
||||
<div className="w-full">
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
placeholder="https://"
|
||||
value={field.value === null ? "" : field.value}
|
||||
/>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Input
|
||||
className="w-full"
|
||||
{...field}
|
||||
placeholder="https://"
|
||||
value={field.value === null ? "" : field.value}
|
||||
/>
|
||||
<TestWebhookDialog
|
||||
runType="task"
|
||||
runId={null}
|
||||
initialWebhookUrl={
|
||||
field.value === null ? undefined : field.value
|
||||
}
|
||||
trigger={
|
||||
<Button
|
||||
type="button"
|
||||
variant="secondary"
|
||||
className="self-start"
|
||||
disabled={!field.value}
|
||||
>
|
||||
Test Webhook
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@ import { InboxIcon } from "@/components/icons/InboxIcon";
|
||||
import { MessageIcon } from "@/components/icons/MessageIcon";
|
||||
import { TrophyIcon } from "@/components/icons/TrophyIcon";
|
||||
import { ProxySelector } from "@/components/ProxySelector";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { KeyValueInput } from "@/components/KeyValueInput";
|
||||
import {
|
||||
@@ -45,6 +46,7 @@ import {
|
||||
MAX_STEPS_DEFAULT,
|
||||
} from "@/routes/workflows/editor/nodes/Taskv2Node/types";
|
||||
import { useAutoplayStore } from "@/store/useAutoplayStore";
|
||||
import { TestWebhookDialog } from "@/components/TestWebhookDialog";
|
||||
|
||||
const exampleCases = [
|
||||
{
|
||||
@@ -352,12 +354,30 @@ function PromptBox() {
|
||||
information
|
||||
</div>
|
||||
</div>
|
||||
<Input
|
||||
value={webhookCallbackUrl ?? ""}
|
||||
onChange={(event) => {
|
||||
setWebhookCallbackUrl(event.target.value);
|
||||
}}
|
||||
/>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Input
|
||||
className="w-full"
|
||||
value={webhookCallbackUrl ?? ""}
|
||||
onChange={(event) => {
|
||||
setWebhookCallbackUrl(event.target.value);
|
||||
}}
|
||||
/>
|
||||
<TestWebhookDialog
|
||||
runType="task"
|
||||
runId={null}
|
||||
initialWebhookUrl={webhookCallbackUrl ?? undefined}
|
||||
trigger={
|
||||
<Button
|
||||
type="button"
|
||||
variant="secondary"
|
||||
className="self-start"
|
||||
disabled={!webhookCallbackUrl}
|
||||
>
|
||||
Test Webhook
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-16">
|
||||
<div className="w-48 shrink-0">
|
||||
|
||||
@@ -33,6 +33,7 @@ import { TaskFormSection } from "./TaskFormSection";
|
||||
import { savedTaskFormSchema, SavedTaskFormValues } from "./taskFormTypes";
|
||||
import { OrganizationApiResponse, ProxyLocation } from "@/api/types";
|
||||
import { ProxySelector } from "@/components/ProxySelector";
|
||||
import { TestWebhookDialog } from "@/components/TestWebhookDialog";
|
||||
|
||||
type Props = {
|
||||
initialValues: SavedTaskFormValues;
|
||||
@@ -627,11 +628,31 @@ function SavedTaskForm({ initialValues }: Props) {
|
||||
</FormLabel>
|
||||
<div className="w-full">
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
placeholder="https://"
|
||||
value={field.value === null ? "" : field.value}
|
||||
/>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Input
|
||||
className="w-full"
|
||||
{...field}
|
||||
placeholder="https://"
|
||||
value={field.value === null ? "" : field.value}
|
||||
/>
|
||||
<TestWebhookDialog
|
||||
runType="task"
|
||||
runId={null}
|
||||
initialWebhookUrl={
|
||||
field.value === null ? undefined : field.value
|
||||
}
|
||||
trigger={
|
||||
<Button
|
||||
type="button"
|
||||
variant="secondary"
|
||||
className="self-start"
|
||||
disabled={!field.value}
|
||||
>
|
||||
Test Webhook
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</div>
|
||||
|
||||
@@ -48,6 +48,7 @@ import { MAX_SCREENSHOT_SCROLLS_DEFAULT } from "./editor/nodes/Taskv2Node/types"
|
||||
import { getLabelForWorkflowParameterType } from "./editor/workflowEditorUtils";
|
||||
import { WorkflowParameter } from "./types/workflowTypes";
|
||||
import { WorkflowParameterInput } from "./WorkflowParameterInput";
|
||||
import { TestWebhookDialog } from "@/components/TestWebhookDialog";
|
||||
|
||||
// Utility function to omit specified keys from an object
|
||||
function omit<T extends Record<string, unknown>, K extends keyof T>(
|
||||
@@ -461,13 +462,37 @@ function RunWorkflowForm({
|
||||
</FormLabel>
|
||||
<div className="w-full space-y-2">
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
placeholder="https://"
|
||||
value={
|
||||
field.value === null ? "" : (field.value as string)
|
||||
}
|
||||
/>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Input
|
||||
className="w-full"
|
||||
{...field}
|
||||
placeholder="https://"
|
||||
value={
|
||||
field.value === null
|
||||
? ""
|
||||
: (field.value as string)
|
||||
}
|
||||
/>
|
||||
<TestWebhookDialog
|
||||
runType="workflow_run"
|
||||
runId={null}
|
||||
initialWebhookUrl={
|
||||
field.value === null
|
||||
? undefined
|
||||
: (field.value as string)
|
||||
}
|
||||
trigger={
|
||||
<Button
|
||||
type="button"
|
||||
variant="secondary"
|
||||
className="self-start"
|
||||
disabled={!field.value}
|
||||
>
|
||||
Test Webhook
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</div>
|
||||
|
||||
@@ -39,6 +39,8 @@ import { useBlockScriptStore } from "@/store/BlockScriptStore";
|
||||
import { BlockCodeEditor } from "@/routes/workflows/components/BlockCodeEditor";
|
||||
import { useUpdate } from "@/routes/workflows/editor/useUpdate";
|
||||
import { cn } from "@/util/utils";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { TestWebhookDialog } from "@/components/TestWebhookDialog";
|
||||
|
||||
interface StartSettings {
|
||||
webhookCallbackUrl: string;
|
||||
@@ -170,15 +172,35 @@ function StartNode({ id, data }: NodeProps<StartNode>) {
|
||||
<Label>Webhook Callback URL</Label>
|
||||
<HelpTooltip content="The URL of a webhook endpoint to send the workflow results" />
|
||||
</div>
|
||||
<Input
|
||||
value={data.webhookCallbackUrl}
|
||||
placeholder="https://"
|
||||
onChange={(event) => {
|
||||
update({
|
||||
webhookCallbackUrl: event.target.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Input
|
||||
className="w-full"
|
||||
value={data.webhookCallbackUrl}
|
||||
placeholder="https://"
|
||||
onChange={(event) => {
|
||||
update({
|
||||
webhookCallbackUrl: event.target.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<TestWebhookDialog
|
||||
runType="workflow_run"
|
||||
runId={null}
|
||||
initialWebhookUrl={
|
||||
data.webhookCallbackUrl || undefined
|
||||
}
|
||||
trigger={
|
||||
<Button
|
||||
type="button"
|
||||
variant="secondary"
|
||||
className="self-start"
|
||||
disabled={!data.webhookCallbackUrl}
|
||||
>
|
||||
Test Webhook
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<div className="flex gap-2">
|
||||
|
||||
Reference in New Issue
Block a user