[PR #24320] feat: replace mock data with dynamic workflow options in test run dropdown #30577

Closed
opened 2026-02-21 20:47:49 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/24320

State: closed
Merged: Yes


Problem

The test run dropdown previously used hardcoded mock data instead of real workflow node data. This meant users couldn't execute workflows based on actual nodes in their canvas.

Changes Made

Core Implementation

  • Replaced mock data with dynamic data: Created use-dynamic-test-run-options.tsx hook that generates test run options from actual ReactFlow nodes
  • Multi-node type support: Processes Start, TriggerSchedule, TriggerWebhook, and TriggerPlugin nodes
  • Icon resolution: Implements dynamic icon retrieval for different plugin types (builtin, custom, workflow, mcp)
  • Fallback logic: Uses getWorkflowEntryNode when no Start node exists

UI Improvements

  • Fixed dropdown alignment: Adjusted width to 284px to align with publish button
  • Resolved z-index issues: Set z-index to z-[12] for proper layering
  • Improved spacing: Reduced icon-text spacing from ml-3 to ml-2

Bug Fixes

  • Fixed divider line logic: Added condition to ensure divider only shows when userInput exists and other options are available
  • Prevented duplicate Start nodes: Modified block selector to hide Start option when Start node already exists in workflow
  • Corrected trigger handling: Fixed handleTriggerSelect to only execute workflow start for user_input type, added TODO placeholders for other trigger types

Testing

  • Comprehensive test coverage: Added 16 test cases covering empty workflows, multiple node types, and complex scenarios
  • High coverage: Achieved 91.27% code coverage

Integration

  • Updated translations: Added runAllTriggers translation key
  • Maintained compatibility: Preserved existing workflow behavior while enhancing functionality

Files Modified

  • use-dynamic-test-run-options.tsx (new, 172 lines)
  • run-and-history.tsx (integrated dynamic options)
  • test-run-dropdown.tsx (UI adjustments)
  • start-blocks.tsx (duplicate prevention logic)
  • use-dynamic-test-run-options.test.tsx (new test suite)
  • workflow.ts (translation updates)
**Original Pull Request:** https://github.com/langgenius/dify/pull/24320 **State:** closed **Merged:** Yes --- ## Problem The test run dropdown previously used hardcoded mock data instead of real workflow node data. This meant users couldn't execute workflows based on actual nodes in their canvas. ## Changes Made ### Core Implementation - **Replaced mock data with dynamic data**: Created `use-dynamic-test-run-options.tsx` hook that generates test run options from actual ReactFlow nodes - **Multi-node type support**: Processes Start, TriggerSchedule, TriggerWebhook, and TriggerPlugin nodes - **Icon resolution**: Implements dynamic icon retrieval for different plugin types (builtin, custom, workflow, mcp) - **Fallback logic**: Uses `getWorkflowEntryNode` when no Start node exists ### UI Improvements - **Fixed dropdown alignment**: Adjusted width to 284px to align with publish button - **Resolved z-index issues**: Set z-index to z-[12] for proper layering - **Improved spacing**: Reduced icon-text spacing from ml-3 to ml-2 ### Bug Fixes - **Fixed divider line logic**: Added condition to ensure divider only shows when userInput exists and other options are available - **Prevented duplicate Start nodes**: Modified block selector to hide Start option when Start node already exists in workflow - **Corrected trigger handling**: Fixed handleTriggerSelect to only execute workflow start for user_input type, added TODO placeholders for other trigger types ### Testing - **Comprehensive test coverage**: Added 16 test cases covering empty workflows, multiple node types, and complex scenarios - **High coverage**: Achieved 91.27% code coverage ### Integration - **Updated translations**: Added `runAllTriggers` translation key - **Maintained compatibility**: Preserved existing workflow behavior while enhancing functionality ## Files Modified - `use-dynamic-test-run-options.tsx` (new, 172 lines) - `run-and-history.tsx` (integrated dynamic options) - `test-run-dropdown.tsx` (UI adjustments) - `start-blocks.tsx` (duplicate prevention logic) - `use-dynamic-test-run-options.test.tsx` (new test suite) - `workflow.ts` (translation updates)
yindo added the pull-request label 2026-02-21 20:47:49 -05:00
yindo closed this issue 2026-02-21 20:47:49 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#30577