{
- handleWorkflowStartRunInWorkflow()
- }}
- >
- {
- isRunning
- ? (
- <>
-
- {t('workflow.common.running')}
- >
- )
- : (
- <>
+ {
+ isRunning
+ ? (
+
+
+ {t('workflow.common.running')}
+
+ )
+ : (
+
+
{t('workflow.common.run')}
- >
- )
- }
-
+
+
+ )
+ }
{
isRunning && (
void
+ children: React.ReactNode
+}
+
+const createMockOptions = (): TestRunOptions => {
+ const userInput: TriggerOption = {
+ id: 'user-input-1',
+ type: 'user_input',
+ name: 'User Input',
+ icon: (
+
+
+
+ ),
+ nodeId: 'start-node-1',
+ enabled: true,
+ }
+
+ const runAll: TriggerOption = {
+ id: 'run-all',
+ type: 'all',
+ name: 'Run all triggers',
+ icon: (
+
+ ),
+ enabled: true,
+ }
+
+ const triggers: TriggerOption[] = [
+ {
+ id: 'slack-trigger-1',
+ type: 'plugin',
+ name: 'Slack Trigger',
+ icon: (
+
+ ),
+ nodeId: 'slack-trigger-1',
+ enabled: true,
+ },
+ {
+ id: 'zapier-trigger-1',
+ type: 'plugin',
+ name: 'Zapier Trigger',
+ icon: (
+
+ ),
+ nodeId: 'zapier-trigger-1',
+ enabled: true,
+ },
+ {
+ id: 'gmail-trigger-1',
+ type: 'plugin',
+ name: 'Gmail Sender',
+ icon: (
+
+
+
+ ),
+ nodeId: 'gmail-trigger-1',
+ enabled: true,
+ },
+ ]
+
+ return {
+ userInput,
+ triggers,
+ runAll: triggers.length > 1 ? runAll : undefined,
+ }
+}
+
+const TestRunDropdown: FC
= ({
+ options,
+ onSelect,
+ children,
+}) => {
+ const { t } = useTranslation()
+ const [open, setOpen] = useState(false)
+
+ const handleSelect = (option: TriggerOption) => {
+ onSelect(option)
+ setOpen(false)
+ }
+
+ const renderOption = (option: TriggerOption, numberDisplay: string) => (
+ handleSelect(option)}
+ >
+
+ {option.icon}
+ {option.name}
+
+
+ {numberDisplay}
+
+
+ )
+
+ const hasUserInput = !!options.userInput
+ const hasTriggers = options.triggers.length > 0
+ const hasRunAll = !!options.runAll
+
+ let currentIndex = 0
+
+ return (
+
+ setOpen(!open)}>
+
+ {children}
+
+
+
+
+
+ {t('workflow.common.chooseStartNodeToRun')}
+
+
+ {hasUserInput && renderOption(options.userInput!, '~')}
+
+ {(hasTriggers || hasRunAll) && hasUserInput && (
+
+ )}
+
+ {hasRunAll && renderOption(options.runAll!, String(currentIndex++))}
+
+ {hasTriggers && options.triggers.map(trigger =>
+ renderOption(trigger, String(currentIndex++)),
+ )}
+
+
+
+
+ )
+}
+
+export { createMockOptions }
+export default TestRunDropdown
diff --git a/web/app/components/workflow/nodes/_base/components/trigger-container.tsx b/web/app/components/workflow/nodes/_base/components/trigger-container.tsx
index 97853126c0..a4c3224eab 100644
--- a/web/app/components/workflow/nodes/_base/components/trigger-container.tsx
+++ b/web/app/components/workflow/nodes/_base/components/trigger-container.tsx
@@ -28,10 +28,10 @@ const TriggerContainer: FC = ({
}, [status, customLabel, t])
return (
-
-
-
-
+
+
diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts
index d7133bec41..ce058668ff 100644
--- a/web/i18n/en-US/workflow.ts
+++ b/web/i18n/en-US/workflow.ts
@@ -11,6 +11,7 @@ const translation = {
publishUpdate: 'Publish Update',
run: 'Test Run',
running: 'Running',
+ chooseStartNodeToRun: 'Choose the start node to run',
inRunMode: 'In Run Mode',
inPreview: 'In Preview',
inPreviewMode: 'In Preview Mode',
diff --git a/web/i18n/ja-JP/workflow.ts b/web/i18n/ja-JP/workflow.ts
index 16d3b2f789..83885d0134 100644
--- a/web/i18n/ja-JP/workflow.ts
+++ b/web/i18n/ja-JP/workflow.ts
@@ -11,6 +11,7 @@ const translation = {
publishUpdate: '更新を公開',
run: 'テスト実行',
running: '実行中',
+ chooseStartNodeToRun: '実行する開始ノードを選択',
inRunMode: '実行モード中',
inPreview: 'プレビュー中',
inPreviewMode: 'プレビューモード中',
diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts
index 8c293dd6aa..d5a1f2115a 100644
--- a/web/i18n/zh-Hans/workflow.ts
+++ b/web/i18n/zh-Hans/workflow.ts
@@ -11,6 +11,7 @@ const translation = {
publishUpdate: '发布更新',
run: '测试运行',
running: '运行中',
+ chooseStartNodeToRun: '选择启动节点进行运行',
inRunMode: '在运行模式中',
inPreview: '预览中',
inPreviewMode: '预览中',