diff --git a/web/app/components/workflow/variable-inspect/listening.tsx b/web/app/components/workflow/variable-inspect/listening.tsx index b94d9b4aa8..1f2577f150 100644 --- a/web/app/components/workflow/variable-inspect/listening.tsx +++ b/web/app/components/workflow/variable-inspect/listening.tsx @@ -1,4 +1,4 @@ -import type { FC } from 'react' +import { type FC, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { type Node, useStoreApi } from 'reactflow' import Button from '@/app/components/base/button' @@ -11,6 +11,8 @@ import type { TFunction } from 'i18next' import { getNextExecutionTime } from '@/app/components/workflow/nodes/trigger-schedule/utils/execution-time-calculator' import type { ScheduleTriggerNodeType } from '@/app/components/workflow/nodes/trigger-schedule/types' import type { WebhookTriggerNodeType } from '@/app/components/workflow/nodes/trigger-webhook/types' +import Tooltip from '@/app/components/base/tooltip' +import copy from 'copy-to-clipboard' const resolveListeningDescription = ( message: string | undefined, @@ -96,6 +98,20 @@ const Listening: FC = ({ const webhookDebugUrl = triggerType === BlockEnum.TriggerWebhook ? (triggerNode?.data as WebhookTriggerNodeType | undefined)?.webhook_debug_url : undefined + const [debugUrlCopied, setDebugUrlCopied] = useState(false) + + useEffect(() => { + if (!debugUrlCopied) + return + + const timer = window.setTimeout(() => { + setDebugUrlCopied(false) + }, 2000) + + return () => { + window.clearTimeout(timer) + } + }, [debugUrlCopied]) let displayNodes: Node[] = [] @@ -156,13 +172,33 @@ const Listening: FC = ({
{description}
{webhookDebugUrl && ( -
-
+
+
{t('workflow.nodes.triggerWebhook.debugUrlTitle')}
-
- {webhookDebugUrl} -
+ + +
)}