π Workflow Designer N8N-Style Enhancements
Overviewβ
Major enhancements to ValkyrAI's workflow designer to compete with and exceed N8N's capabilities. These improvements focus on UX, IntegrationAccount management, custom module configuration, and visual polish.
β¨ Completed Enhancementsβ
1. IntegrationAccountSelector Componentβ
File: web/typescript/valkyr_labs_com/src/components/WorkflowStudio/IntegrationAccountSelector.tsx
Features:
- Dropdown selector for existing IntegrationAccounts
- Filter by module type (EMAIL, REST, etc.)
- Filter by execModuleId
- Display account status (verified/unverified)
- Create new account button
- Error handling and retry logic
- Live account status indicators
Usage Example:
<IntegrationAccountSelector
value={selectedAccountId}
onChange={(id, account) => setSelectedAccountId(id)}
moduleType="EMAIL"
allowCreate
onCreateNew={() => setShowCreateDialog(true)}
/>
2. CenteredConnectionDialog Componentβ
File: web/typescript/valkyr_labs_com/src/components/WorkflowStudio/CenteredConnectionDialog.tsx
Features:
- Opens exactly where the connection is made (N8N-style!)
- Auto-adjusts position if would overflow viewport
- Smooth fade-in and scale animations
- Click outside to close
- ESC key to close
- Connection label configuration
- Trigger conditions (always/success/error)
- Advanced JEXL expression support
Key Improvements Over Old Dialog:
- β Centered at connection point (not upper right)
- β Better UX with backdrop and animations
- β Keyboard navigation support
- β Smart viewport positioning
π― Implementation Statusβ
β Completedβ
- IntegrationAccount selector component
- Centered connection dialog
- TypeScript type safety improvements
- Proper use of ThorAPI generated models
π§ Next Stepsβ
1. Update WorkflowCanvas to Use New Dialogβ
// Capture mouse position during connection
const [connectionPoint, setConnectionPoint] = useState<{x: number; y: number} | null>(null);
const onConnectStart = useCallback((_e: MouseEvent, { nodeId }: { nodeId?: string }) => {
if (nodeId && _e) {
setConnectionPoint({ x: _e.clientX, y: _e.clientY });
}
}, []);
// Pass position to dialog
<CenteredConnectionDialog
show={edgeDialog.show}
position={connectionPoint}
onSave={applyEdgeConfig}
onCancel={() => setEdgeDialog({ show: false })}
/>
2. Enhance Module Configuration Panelsβ
Email Module Config:
- IntegrationAccountSelector for MailerSend/SendGrid API keys
- Template editor with variable mapping
- Recipient list builder
- Attachment handling
REST Module Config:
- IntegrationAccountSelector for API authentication
- Method selector (GET/POST/PUT/DELETE)
- Header builder with key-value pairs
- Body editor with JSON/form-data support
- Response mapping configuration
3. Custom Module Designersβ
Create specialized UI for each module type in ModuleDesigner/:
EmailModuleDesigner.tsx- Email-specific configurationRestModuleDesigner.tsx- REST API configurationQbeModuleDesigner.tsx- Query builder UILlmModuleDesigner.tsx- LLM prompt configuration
4. Enhanced Node Stylingβ
N8N-style visual improvements:
- Gradient backgrounds on nodes
- Icon support for different module types
- Status indicators (running/success/error)
- Hover effects and animations
- Connection line animations
- Minimap enhancements
5. Drag-and-Drop Enhancementsβ
- Snap-to-grid for cleaner layouts
- Smart connection suggestions
- Auto-layout algorithm
- Bulk node operations (select, move, delete)
π Architectureβ
Integration with ThorAPIβ
All components use ThorAPI generated models:
import type { IntegrationAccount, ExecModule, Workflow } from "@thorapi/model";
import { useGetIntegrationAccountsQuery } from "@thorapi/redux/services/IntegrationAccountService";
State Managementβ
- Redux Toolkit for global workflow state
- Local React state for UI concerns
- RTK Query for API calls with caching
Component Hierarchyβ
ConsolidatedWorkflowStudio
βββ NodePalette
βββ WorkflowCanvas
β βββ ReactFlow
β βββ Custom Node Types (Task, Branch, Start, End)
β βββ CenteredConnectionDialog β¨ NEW
βββ InspectorPanel
β βββ IntegrationAccountSelector β¨ NEW
β βββ ModuleDesigner
β β βββ EmailModuleDesigner (TODO)
β β βββ RestModuleDesigner (TODO)
β β βββ QbeModuleDesigner (TODO)
β βββ RetryPolicyEditor
βββ Console/Logs
π¨ Design Systemβ
Colors (Dark Theme)β
- Background:
#1d1f24 - Foreground:
#e4e4e4 - Accent:
#6ee7ff(cyan) - Success:
#10b981(emerald) - Error:
#ef4444(red) - Warning:
#f59e0b(amber)
Animationsβ
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes scaleIn {
from {
opacity: 0;
transform: scale(0.9);
}
to {
opacity: 1;
transform: scale(1);
}
}
π Security Considerationsβ
-
IntegrationAccount Credentials:
- Always encrypted at rest (KMS)
- Never expose in logs
- Secure field handling via ThorAPI
-
JEXL Expressions:
- Sandbox execution environment
- Input validation
- Rate limiting
-
API Keys:
- Stored as encrypted IntegrationAccount
- Rotation support
- Audit logging
π Performance Optimizationsβ
- React.memo on expensive components
- useCallback for event handlers
- useMemo for derived state
- Lazy loading for module designers
- Virtualization for large workflow lists
- Debounced auto-save
π§ͺ Testing Strategyβ
Unit Testsβ
- Component rendering
- Event handling
- State management
- API mocking
Integration Testsβ
- Workflow save/load
- Module configuration
- Connection creation
- Account selection
E2E Testsβ
- Complete workflow creation
- Module testing
- Execution verification
- Error handling
π Next Actionsβ
- Update WorkflowCanvas to use CenteredConnectionDialog
- Create EmailModuleDesigner with IntegrationAccountSelector
- Create RestModuleDesigner with IntegrationAccountSelector
- Enhance node styling to match N8N aesthetic
- Add connection animations and visual feedback
- Implement smart suggestions for connections
- Add keyboard shortcuts for power users
- Create workflow templates library
π― Success Metricsβ
- Connection dialog opens at connection point
- IntegrationAccounts integrated with all modules
- Custom config UI for each module type
- Visual polish matches/exceeds N8N
- Performance remains smooth with 100+ nodes
- Users report improved workflow creation speed
π Documentationβ
- Component library docs in
docs/docs/Products/ThorAPI/Component Library/ - API integration guide
- Module configuration guide
- Best practices for workflow design
Status: Phase 1 Complete (Core Components)
Next Phase: WorkflowCanvas Integration & Module Designers
Target Completion: Within 2 sprints