Skip to content

feat: replace mock data with dynamic workflow options in test run dropdown#24320

Merged
crazywoola merged 4 commits intolanggenius:feat/triggerfrom
lyzno1:feat/test-run-dropdown
Aug 22, 2025
Merged

feat: replace mock data with dynamic workflow options in test run dropdown#24320
crazywoola merged 4 commits intolanggenius:feat/triggerfrom
lyzno1:feat/test-run-dropdown

Conversation

@lyzno1
Copy link
Copy Markdown
Member

@lyzno1 lyzno1 commented Aug 22, 2025

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)

lyzno1 added 3 commits August 22, 2025 12:18
- Fix divider line issue in test run dropdown when userInput is missing
- Hide Start block in block selector when already exists in workflow
- Prevent duplicate Start nodes and improve UX consistency
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. 💪 enhancement New feature or request labels Aug 22, 2025
@lyzno1 lyzno1 marked this pull request as draft August 22, 2025 05:25
…ture

- Add new run-all-triggers.svg icon following project standards
- Generate RunAllTriggers React component via pnpm gen-icons
- Clean up test-run-dropdown.tsx by removing unused mock data
- Optimize useDynamicTestRunOptions performance with stable function references
- Maintain single source of truth pattern with clear separation of concerns
@lyzno1 lyzno1 marked this pull request as ready for review August 22, 2025 07:34
@lyzno1
Copy link
Copy Markdown
Member Author

lyzno1 commented Aug 22, 2025

image

@dosubot dosubot bot added the 🌊 feat:workflow Workflow related stuff. label Aug 22, 2025
@crazywoola crazywoola merged commit 392e353 into langgenius:feat/trigger Aug 22, 2025
1 check passed
@lyzno1 lyzno1 deleted the feat/test-run-dropdown branch August 22, 2025 08:42
ZeroZ-lab pushed a commit to ZeroZ-lab/dify that referenced this pull request Aug 25, 2025
@dosubot dosubot bot mentioned this pull request Sep 3, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💪 enhancement New feature or request 🌊 feat:workflow Workflow related stuff. size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants