/** * Pipeline Status Component * Отображает прогресс обработки pipeline */ import { cn } from "@/lib/utils" import type { PipelineProgress } from "../../shared/types" import { ProcessingStatus } from "../../shared/types" interface PipelineStatusProps { progress: PipelineProgress | null className?: string } export function PipelineStatus({ progress, className }: PipelineStatusProps) { if (!progress) return null const getStatusColor = (status: ProcessingStatus) => { switch (status) { case ProcessingStatus.COMPLETED: return "bg-green-500" case ProcessingStatus.RUNNING: return "bg-blue-500" case ProcessingStatus.FAILED: return "bg-red-500" case ProcessingStatus.SKIPPED: return "bg-gray-400" default: return "bg-gray-300" } } const getStatusIcon = (status: ProcessingStatus) => { switch (status) { case ProcessingStatus.COMPLETED: return "✓" case ProcessingStatus.RUNNING: return "⟳" case ProcessingStatus.FAILED: return "✗" case ProcessingStatus.SKIPPED: return "⊘" default: return "○" } } return (
{/* Overall Progress */}
Processing Pipeline {Math.round(progress.overall)}%
{/* Current Step */} {progress.currentStep &&
Current: {progress.currentStep}
} {/* Step Details */}
{progress.steps.map((step, index) => (
{getStatusIcon(step.status)}
{step.name} {step.status === ProcessingStatus.RUNNING && ( {step.progress}% )}
{step.subSteps && step.subSteps.length > 0 && (
{step.subSteps.map((subStep, subIndex) => (
{subStep.name} ({subStep.progress}%)
))}
)}
))}
{/* Time Remaining */} {progress.estimatedTimeRemaining && (
Estimated time remaining: {formatTime(progress.estimatedTimeRemaining)}
)}
) } function formatTime(seconds: number): string { if (seconds < 60) return `${Math.round(seconds)}s` if (seconds < 3600) return `${Math.round(seconds / 60)}m` return `${Math.round(seconds / 3600)}h ${Math.round((seconds % 3600) / 60)}m` }