Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(workflow): migrate email subject input (#41551)

yyhf92f7e92c333
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json
index ca325a5858a..7ed1922796b 100644
--- a/oxlint-suppressions.json
+++ b/oxlint-suppressions.json
@@ -3853,11 +3853,6 @@
"count": 4
}
},
- "web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
"web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx": {
"jsx-a11y/click-events-have-key-events": {
"count": 2
@@ -5385,4 +5380,4 @@
"count": 2
}
}
-}
+}
\ No newline at end of file
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/__tests__/email-configure-modal.spec.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/__tests__/email-configure-modal.spec.tsx
index 31189fc3f7b..3388236f0eb 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/__tests__/email-configure-modal.spec.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/__tests__/email-configure-modal.spec.tsx
@@ -115,9 +115,9 @@ describe('human-input/delivery-method/email-configure-modal', () => {
)
fireEvent.change(
- screen.getByPlaceholderText(
- 'workflow.nodes.humanInput.deliveryMethod.emailConfigure.subjectPlaceholder',
- ),
+ screen.getByRole('textbox', {
+ name: 'workflow.nodes.humanInput.deliveryMethod.emailConfigure.subject',
+ }),
{
target: { value: 'Budget alert' },
},
@@ -151,9 +151,9 @@ describe('human-input/delivery-method/email-configure-modal', () => {
)
fireEvent.change(
- screen.getByPlaceholderText(
- 'workflow.nodes.humanInput.deliveryMethod.emailConfigure.subjectPlaceholder',
- ),
+ screen.getByRole('textbox', {
+ name: 'workflow.nodes.humanInput.deliveryMethod.emailConfigure.subject',
+ }),
{
target: { value: 'Subject ready' },
},
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 e9f2067d338..2a4f8614eec 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
@@ -3,13 +3,13 @@ import type { Node, NodeOutPutVar } from '@/app/components/workflow/types'
import { Button } from '@langgenius/dify-ui/button'
import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
import { IconButton } from '@langgenius/dify-ui/icon-button'
+import { Input } from '@langgenius/dify-ui/input'
import { Switch } from '@langgenius/dify-ui/switch'
import { toast } from '@langgenius/dify-ui/toast'
import { RiBugLine } from '@remixicon/react'
import { useSuspenseQuery } from '@tanstack/react-query'
-import { memo, useCallback, useState } from 'react'
+import { memo, useCallback, useId, useState } from 'react'
import { Trans, useTranslation } from 'react-i18next'
-import Input from '@/app/components/base/input'
import { userProfileQueryOptions } from '@/features/account-profile/client'
import MailBodyInput from './mail-body-input'
import Recipient from './recipient'
@@ -34,6 +34,7 @@ const EmailConfigureModal = ({
availableNodes = [],
}: EmailConfigureModalProps) => {
const { t } = useTranslation()
+ const subjectId = useId()
const { data: email } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile.email,
@@ -116,15 +117,19 @@ const EmailConfigureModal = ({
</div>
<div className="mt-6 space-y-5">
<div>
- <div className="mb-1 flex h-6 items-center system-sm-medium text-text-secondary">
+ <label
+ htmlFor={subjectId}
+ className="mb-1 flex h-6 items-center system-sm-medium text-text-secondary"
+ >
{t(($) => $[`${i18nPrefix}.deliveryMethod.emailConfigure.subject`], {
ns: 'workflow',
})}
- </div>
+ </label>
<Input
+ id={subjectId}
className="w-full"
value={subject}
- onChange={(e) => setSubject(e.target.value)}
+ onValueChange={setSubject}
placeholder={t(
($) => $[`${i18nPrefix}.deliveryMethod.emailConfigure.subjectPlaceholder`],
{ ns: 'workflow' },