Skip to content

feat: comprehensive trigger node system with Schedule Trigger implementation#24039

Merged
crazywoola merged 48 commits intolanggenius:feat/triggerfrom
lyzno1:feat/trigger
Aug 18, 2025
Merged

feat: comprehensive trigger node system with Schedule Trigger implementation#24039
crazywoola merged 48 commits intolanggenius:feat/triggerfrom
lyzno1:feat/trigger

Conversation

@lyzno1
Copy link
Copy Markdown
Member

@lyzno1 lyzno1 commented Aug 16, 2025

Related #24001
Related #23981

Summary

Implements the foundational architecture for trigger-based workflow nodes, introducing three new trigger types and a conditional Start tab system.

Changes:

  • Add 3 trigger node types: Schedule, Webhook, Plugin
  • Implement conditional Start tab in block selector (shows only trigger nodes)
  • Add workflow entry point abstraction with trigger priority
  • Integrate export functionality into More Actions dropdown

Current Limitations

  • Start node exclusion: Due to code constraints, the traditional Start node (User Input) cannot appear in the Start tab currently
  • No uniqueness constraint: All entry nodes (triggers + start) lack global uniqueness enforcement - multiple entry nodes can exist simultaneously
  • Placeholder implementations: Schedule/Webhook/Plugin panels show placeholder content only
  • Missing Test Run: Preview button not yet replaced with Test Run dropdown

Next Steps

  • Implement Schedule Trigger configuration panel
  • Add Test Run functionality
  • Enforce entry node uniqueness constraints
  • Include User Input in Start tab

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

lyzno1 and others added 10 commits August 16, 2025 21:18
Core Features:
- Add Start tab system with conditional display in the left panel
- Create START_BLOCKS constant to separate start-type nodes
- Implement StartBlocks component to render Start tab content
- Place Start tab at the third position, keep Blocks tab selected by default

Technical Implementation:
- Add showStartTab parameter (default: false) to minimize code changes
- Add useStartBlocks hook for translations
- Update useTabs to support conditional Start tab
- Integrate into existing tab system architecture

Node Configuration:
- User Input node (renamed from Start node)
- Schedule Trigger
- Webhook Trigger
- Plugin Trigger

User Experience:
- Show Start tab only in left panel, hide when inserting in canvas
- Keep Blocks tab as the default selected for consistency
- Apply unified width for consistent UI
- Remove title text inside Start tab for a simplified interface
@lyzno1
Copy link
Copy Markdown
Member Author

lyzno1 commented Aug 17, 2025

Schedule Trigger Implementation Status

✅ Completed Core Features

  • Schedule Trigger Node: Complete implementation with dual-mode configuration (Visual Picker + Cron Expression)
  • Visual Picker Configuration: All 5 frequency types implemented
    • Hourly: Start time + recur every (Hours/Minutes toggle)
    • Daily: Time picker with Now/OK buttons (white/blue styling)
    • Weekly: Time picker + weekday selector (7-button grid)
    • Monthly: Time picker + days selector (1-31 grid + Last day with tooltip)
    • Once: Date-time picker for one-time execution
  • Cron Expression Mode: Full cron parser with validation and preview
  • Next Execution Display: Shows next 5 execution times in node and panel
  • Execute Now Button: Horizontal button for immediate workflow triggering
  • Timezone Handling: Unified system timezone across all calculations (46 test cases, 100% coverage)

✅ Architecture & UI Implementation

  • Start Tab System: Conditional tab showing trigger nodes only
  • Node Panel Structure: Settings tab implemented (Last Run tab placeholder ready)
  • Responsive Design: Grid-based layouts, dark mode support, proper spacing alignment
  • International Support: Complete translations for Chinese (zh-Hans) and Japanese (ja-JP)

✅ Technical Quality

  • Comprehensive Testing: 46 test cases covering all execution scenarios
  • Smart Algorithm: Monthly last-day handling, timezone consistency, duplicate prevention
  • Component Architecture: Reusable DateTimePicker, FrequencySelector, ExecutionTimeCalculator
  • Performance: Efficient state management and render optimization

🔄 Remaining Items (Per Design Doc)

  • Last Run tab implementation (execution history display)
  • Test Run functionality enhancement (replacing Preview button)
  • Webhook/Plugin trigger configuration panels
  • Trigger variable integration into workflow variable system

The Schedule Trigger implementation fully satisfies the design requirements from the frontend specification document and provides a solid foundation for the complete trigger system.

@lyzno1 lyzno1 changed the title feat: implement trigger nodes foundation with conditional Start tab feat: comprehensive trigger node system with Schedule Trigger implementation Aug 17, 2025
@lyzno1 lyzno1 marked this pull request as ready for review August 17, 2025 09:23
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. 🌊 feat:workflow Workflow related stuff. labels Aug 17, 2025
lyzno1 added 12 commits August 17, 2025 19:36
…ive tests

- Modify pickers to only apply changes when OK button is clicked, not on selection
- Add auto-scroll functionality to center selected values when TimePicker opens
- Add user-select: none to prevent text selection in picker overlays
- Create comprehensive test suites for both components (21 total tests)
- Fix ESLint errors including global -> globalThis and formatting issues
- Ensure consistent behavior with temporary state management
- Validate accessibility and user interaction patterns
@crazywoola crazywoola merged commit 74ad21b into langgenius:feat/trigger Aug 18, 2025
1 check passed
@lyzno1 lyzno1 deleted the feat/trigger branch August 18, 2025 01:47
lyzno1 added a commit to lyzno1/dify that referenced this pull request Aug 20, 2025
…ntation (langgenius#24039)

Co-authored-by: zhangxuhe1 <xuhezhang6@gmail.com>
@dosubot dosubot bot mentioned this pull request Aug 21, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌊 feat:workflow Workflow related stuff. size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants