[PR #25368] feat: implement unified API Key configuration for trigger plugins #31034

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

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

State: closed
Merged: No


Summary

This PR implements a streamlined unified API Key configuration flow for trigger plugins, combining previously separated configuration steps into a single intuitive modal experience.

Key Changes

🎯 Unified Configuration Modal

  • New Component: UnifiedApiKeyConfigModal provides single-modal experience
  • Multi-step Flow: credentials → verify → parameters → build
  • Dynamic Forms: All steps use dynamic forms based on plugin schemas
  • Error Handling: Comprehensive validation and error recovery

🔧 API Service Layer Updates

  • Enhanced useTriggerPluginDynamicOptions for trigger-specific dynamic options
  • Updated subscription builder flow with proper parameter handling
  • Streamlined API calls removing unnecessary hardcoded fields
  • Support for credential verification before parameter configuration

📋 Form Component Enhancements

  • TriggerForm & TriggerFormItem: New components for trigger parameter rendering
  • Enhanced FormInputItem: Improved trigger support with isTrigger flag
  • Dynamic Options: Proper trigger vs tool API routing
  • Type Safety: Comprehensive TypeScript support

🌐 Internationalization

  • Added i18n keys for new configuration flow
  • Consistent UI text across the modal experience

Technical Details

Before: Separate configuration steps scattered across different UI components

After: Unified single-modal flow with proper validation and error handling

Step 1: Pure Credentials Configuration (dynamic schema-based forms)
   ↓
Step 2: Credential Verification (with loading states)  
   ↓
Step 3: Parameters Configuration (combined subscription + trigger parameters)
   ↓  
Step 4: Subscription Building (automatic server-side naming)

Architecture Improvements

  • Schema-Driven: All forms generated from plugin schemas
  • Separation of Concerns: Clear distinction between credentials and parameters
  • Error Recovery: Graceful handling of API failures with proper user feedback
  • State Management: Clean state flow with proper loading and error states

Bug Fixes

  • Fixed dynamic options API routing for trigger plugins
  • Resolved credential_type enum value inconsistencies
  • Improved TypeScript type safety across components
  • Fixed ESLint violations and formatting issues

Testing Notes

  • Credentials validation flow
  • Parameter configuration with dynamic options
  • Error handling for invalid credentials
  • Multi-step navigation (forward/back)
  • Integration with existing trigger plugin system

Note: During testing, discovered that some trigger plugins (e.g., GitHub) do not implement the _fetch_parameter_options method required for dynamic select parameters. This is a backend plugin implementation issue, not a frontend issue. The frontend correctly handles the API calls and gracefully degrades when dynamic options are unavailable.

**Original Pull Request:** https://github.com/langgenius/dify/pull/25368 **State:** closed **Merged:** No --- ## Summary This PR implements a streamlined unified API Key configuration flow for trigger plugins, combining previously separated configuration steps into a single intuitive modal experience. ### Key Changes #### 🎯 **Unified Configuration Modal** - **New Component**: `UnifiedApiKeyConfigModal` provides single-modal experience - **Multi-step Flow**: credentials → verify → parameters → build - **Dynamic Forms**: All steps use dynamic forms based on plugin schemas - **Error Handling**: Comprehensive validation and error recovery #### 🔧 **API Service Layer Updates** - Enhanced `useTriggerPluginDynamicOptions` for trigger-specific dynamic options - Updated subscription builder flow with proper parameter handling - Streamlined API calls removing unnecessary hardcoded fields - Support for credential verification before parameter configuration #### 📋 **Form Component Enhancements** - **TriggerForm & TriggerFormItem**: New components for trigger parameter rendering - **Enhanced FormInputItem**: Improved trigger support with `isTrigger` flag - **Dynamic Options**: Proper trigger vs tool API routing - **Type Safety**: Comprehensive TypeScript support #### 🌐 **Internationalization** - Added i18n keys for new configuration flow - Consistent UI text across the modal experience ### Technical Details #### **Before**: Separate configuration steps scattered across different UI components #### **After**: Unified single-modal flow with proper validation and error handling ``` Step 1: Pure Credentials Configuration (dynamic schema-based forms) ↓ Step 2: Credential Verification (with loading states) ↓ Step 3: Parameters Configuration (combined subscription + trigger parameters) ↓ Step 4: Subscription Building (automatic server-side naming) ``` ### Architecture Improvements - **Schema-Driven**: All forms generated from plugin schemas - **Separation of Concerns**: Clear distinction between credentials and parameters - **Error Recovery**: Graceful handling of API failures with proper user feedback - **State Management**: Clean state flow with proper loading and error states ### Bug Fixes - Fixed dynamic options API routing for trigger plugins - Resolved credential_type enum value inconsistencies - Improved TypeScript type safety across components - Fixed ESLint violations and formatting issues ### Testing Notes - ✅ Credentials validation flow - ✅ Parameter configuration with dynamic options - ✅ Error handling for invalid credentials - ✅ Multi-step navigation (forward/back) - ✅ Integration with existing trigger plugin system **Note**: During testing, discovered that some trigger plugins (e.g., GitHub) do not implement the `_fetch_parameter_options` method required for dynamic select parameters. This is a backend plugin implementation issue, not a frontend issue. The frontend correctly handles the API calls and gracefully degrades when dynamic options are unavailable.
yindo added the pull-request label 2026-02-21 20:48:42 -05:00
yindo closed this issue 2026-02-21 20:48:42 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#31034