diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx index 8797249b0b..75d7649165 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx @@ -1,9 +1,12 @@ import { memo, useCallback, useState } from 'react' -import { useTranslation } from 'react-i18next' -import { RiCloseLine } from '@remixicon/react' +import { Trans, useTranslation } from 'react-i18next' +import { useAppContext } from '@/context/app-context' +import { RiBugLine, RiCloseLine } from '@remixicon/react' import Modal from '@/app/components/base/modal' import Input from '@/app/components/base/input' import Button from '@/app/components/base/button' +import Divider from '@/app/components/base/divider' +import Switch from '@/app/components/base/switch' import Recipient from './recipient' import MailBodyInput from './mail-body-input' import Toast from '@/app/components/base/toast' @@ -34,10 +37,11 @@ const EmailConfigureModal = ({ availableNodes = [], }: EmailConfigureModalProps) => { const { t } = useTranslation() - + const { userProfile } = useAppContext() const [recipients, setRecipients] = useState(config?.recipients || { whole_workspace: false, items: [] }) const [subject, setSubject] = useState(config?.subject || '') const [body, setBody] = useState(config?.body || '') + const [debugMode, setDebugMode] = useState(config?.debug || false) const checkValidConfig = () => { if (!subject.trim()) { @@ -77,6 +81,7 @@ const EmailConfigureModal = ({ recipients, subject, body, + debug: debugMode, }) }, [subject, body, onConfirm]) @@ -94,15 +99,6 @@ const EmailConfigureModal = ({
{t(`${i18nPrefix}.deliveryMethod.emailConfigure.description`)}
-
-
- {t(`${i18nPrefix}.deliveryMethod.emailConfigure.recipient`)} -
- -
{t(`${i18nPrefix}.deliveryMethod.emailConfigure.subject`)} @@ -125,6 +121,36 @@ const EmailConfigureModal = ({ availableNodes={availableNodes} />
+
+
+ {t(`${i18nPrefix}.deliveryMethod.emailConfigure.recipient`)} +
+ +
+ +
+
+ +
+
+
{t(`${i18nPrefix}.deliveryMethod.emailConfigure.debugMode`)}
+
+ {userProfile.email} }} + values={{ email: userProfile.email }} + /> +
{t(`${i18nPrefix}.deliveryMethod.emailConfigure.debugModeTip2`)}
+
+
+ setDebugMode(checked)} + /> +
)}
{method.type}
+ {method.type === DeliveryMethodType.Email && method.config?.debug && DEBUG}
{method.type === DeliveryMethodType.Email && method.config && ( - setShowEmailModal(true)}> - - + <> + setShowEmailModal(true)}> + + + setShowEmailModal(true)}> + + + )}
setIsHovering(true)} diff --git a/web/app/components/workflow/nodes/human-input/types.ts b/web/app/components/workflow/nodes/human-input/types.ts index 30e90148e1..2f55095db5 100644 --- a/web/app/components/workflow/nodes/human-input/types.ts +++ b/web/app/components/workflow/nodes/human-input/types.ts @@ -31,6 +31,7 @@ export type EmailConfig = { recipients: RecipientData subject: string body: string + debug: boolean } export type DeliveryMethod = { diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index d4588211de..b500744b12 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -959,6 +959,9 @@ const translation = { add: '+ Add', added: 'Added', }, + debugMode: 'Debug Mode', + debugModeTip1: 'During debug mode, emails will only be sent to your account email {{email}}.', + debugModeTip2: 'The production environment is not affected.', }, }, formContent: { diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index 716eb71b9e..6779825cfb 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -959,6 +959,9 @@ const translation = { add: '+ 添加', added: '已添加', }, + debugMode: '调试模式', + debugModeTip1: '在调试模式下,电子邮件将仅发送到您的帐户电子邮件 {{email}}。', + debugModeTip2: '生产环境不受影响。', }, }, formContent: {