mirror of
https://github.com/xtr-dev/payload-automation.git
synced 2025-12-11 17:23:23 +00:00
## Critical Fixes Implemented: ### 1. Hook Execution Reliability (src/plugin/index.ts) - Replaced fragile global variable pattern with proper dependency injection - Added structured executor registry with initialization tracking - Implemented proper logging using PayloadCMS logger instead of console - Added graceful handling for executor unavailability scenarios ### 2. Error Handling & Workflow Run Tracking - Fixed error swallowing in hook execution - Added createFailedWorkflowRun() to track hook execution failures - Improved error categorization and user-friendly error messages - Enhanced workflow run status tracking with detailed context ### 3. Enhanced HTTP Step (src/steps/) - Complete rewrite of HTTP request handler with enterprise features: - Multiple authentication methods (Bearer, Basic Auth, API Key) - Configurable timeouts and retry logic with exponential backoff - Comprehensive error handling for different failure scenarios - Support for all HTTP methods with proper request/response parsing - Request duration tracking and detailed logging ### 4. User Experience Improvements - Added StatusCell component with visual status indicators - Created ErrorDisplay component with user-friendly error explanations - Added WorkflowExecutionStatus component for real-time execution monitoring - Enhanced collections with better error display and conditional fields ### 5. Comprehensive Testing Suite - Added hook-reliability.spec.ts: Tests executor availability and concurrent execution - Added error-scenarios.spec.ts: Tests timeout, network, validation, and HTTP errors - Added webhook-triggers.spec.ts: Tests webhook endpoints, conditions, and concurrent requests - Fixed existing test to work with enhanced HTTP step schema ## Technical Improvements: - Proper TypeScript interfaces for all new components - Safe serialization handling for circular references - Comprehensive logging with structured data - Modular component architecture with proper exports - Enhanced collection schemas with conditional field visibility ## Impact: - Eliminates silent workflow execution failures - Provides clear error visibility for users - Makes HTTP requests production-ready with auth and retry capabilities - Significantly improves debugging and monitoring experience - Adds comprehensive test coverage for reliability 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
'use client'
|
|
|
|
import React from 'react'
|
|
|
|
interface StatusCellProps {
|
|
cellData: string
|
|
}
|
|
|
|
export const StatusCell: React.FC<StatusCellProps> = ({ cellData }) => {
|
|
const getStatusDisplay = (status: string) => {
|
|
switch (status) {
|
|
case 'pending':
|
|
return { icon: '⏳', color: '#6B7280', label: 'Pending' }
|
|
case 'running':
|
|
return { icon: '🔄', color: '#3B82F6', label: 'Running' }
|
|
case 'completed':
|
|
return { icon: '✅', color: '#10B981', label: 'Completed' }
|
|
case 'failed':
|
|
return { icon: '❌', color: '#EF4444', label: 'Failed' }
|
|
case 'cancelled':
|
|
return { icon: '⏹️', color: '#F59E0B', label: 'Cancelled' }
|
|
default:
|
|
return { icon: '❓', color: '#6B7280', label: status || 'Unknown' }
|
|
}
|
|
}
|
|
|
|
const { icon, color, label } = getStatusDisplay(cellData)
|
|
|
|
return (
|
|
<div style={{
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
gap: '8px',
|
|
padding: '4px 8px',
|
|
borderRadius: '6px',
|
|
backgroundColor: `${color}15`,
|
|
border: `1px solid ${color}30`,
|
|
fontSize: '14px',
|
|
fontWeight: '500'
|
|
}}>
|
|
<span style={{ fontSize: '16px' }}>{icon}</span>
|
|
<span style={{ color }}>{label}</span>
|
|
</div>
|
|
)
|
|
} |