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 schedule cron input (#41550)

yyh72458d575010
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json
index 9cb1ae7a569..ca325a5858a 100644
--- a/oxlint-suppressions.json
+++ b/oxlint-suppressions.json
@@ -4349,11 +4349,6 @@
"count": 4
}
},
- "web/app/components/workflow/nodes/trigger-schedule/panel.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
"web/app/components/workflow/nodes/trigger-webhook/components/generic-table.tsx": {
"no-restricted-imports": {
"count": 1
@@ -5390,4 +5385,4 @@
"count": 2
}
}
-}
\ No newline at end of file
+}
diff --git a/web/app/components/workflow/nodes/trigger-schedule/__tests__/panel.spec.tsx b/web/app/components/workflow/nodes/trigger-schedule/__tests__/panel.spec.tsx
index edf8dbe62e5..a0c53bbdbfd 100644
--- a/web/app/components/workflow/nodes/trigger-schedule/__tests__/panel.spec.tsx
+++ b/web/app/components/workflow/nodes/trigger-schedule/__tests__/panel.spec.tsx
@@ -204,7 +204,12 @@ describe('TriggerSchedulePanel', () => {
renderPanel('node-3', createData({ mode: 'cron' }))
- fireEvent.change(screen.getByDisplayValue('0 0 * * *'), { target: { value: '*/5 * * * *' } })
+ fireEvent.change(
+ screen.getByRole('textbox', {
+ name: 'workflow.nodes.triggerSchedule.cronExpression',
+ }),
+ { target: { value: '*/5 * * * *' } },
+ )
expect(handleCronExpressionChange).toHaveBeenCalledWith('*/5 * * * *')
})
@@ -255,7 +260,11 @@ describe('TriggerSchedulePanel', () => {
panelProps={panelProps}
/>,
)
- expect(screen.getByRole('textbox')).toHaveValue('')
+ expect(
+ screen.getByRole('textbox', {
+ name: 'workflow.nodes.triggerSchedule.cronExpression',
+ }),
+ ).toHaveValue('')
})
it('should render the hourly minute selector when the frequency is hourly', async () => {
diff --git a/web/app/components/workflow/nodes/trigger-schedule/panel.tsx b/web/app/components/workflow/nodes/trigger-schedule/panel.tsx
index e12b13815a5..838e4d740e5 100644
--- a/web/app/components/workflow/nodes/trigger-schedule/panel.tsx
+++ b/web/app/components/workflow/nodes/trigger-schedule/panel.tsx
@@ -1,10 +1,10 @@
import type { FC } from 'react'
import type { ScheduleTriggerNodeType } from './types'
import type { NodePanelProps } from '@/app/components/workflow/types'
+import { Input } from '@langgenius/dify-ui/input'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import TimePicker from '@/app/components/base/date-and-time-picker/time-picker'
-import Input from '@/app/components/base/input'
import Field from '@/app/components/workflow/nodes/_base/components/field'
import FrequencySelector from './components/frequency-selector'
import ModeToggle from './components/mode-toggle'
@@ -18,6 +18,7 @@ const i18nPrefix = 'nodes.triggerSchedule'
const Panel: FC<NodePanelProps<ScheduleTriggerNodeType>> = ({ id, data }) => {
const { t } = useTranslation()
+ const cronExpressionId = React.useId()
const {
inputs,
setInputs,
@@ -112,12 +113,16 @@ const Panel: FC<NodePanelProps<ScheduleTriggerNodeType>> = ({ id, data }) => {
{inputs.mode === 'cron' && (
<div className="space-y-2">
<div>
- <label className="mb-2 block text-xs font-medium text-gray-500">
+ <label
+ htmlFor={cronExpressionId}
+ className="mb-2 block text-xs font-medium text-gray-500"
+ >
{t(($) => $['nodes.triggerSchedule.cronExpression'], { ns: 'workflow' })}
</label>
<Input
+ id={cronExpressionId}
value={inputs.cron_expression || ''}
- onChange={(e) => handleCronExpressionChange(e.target.value)}
+ onValueChange={(value) => handleCronExpressionChange(value)}
placeholder="0 0 * * *"
className="font-mono"
/>