'use client' import React from 'react' import type { PipelineCheckpoint } from '../types' import type { UseRAGPageReturn } from '../_hooks/useRAGPage' interface PipelineTabProps { hook: UseRAGPageReturn } export function PipelineTab({ hook }: PipelineTabProps) { const { pipelineState, pipelineLoading, pipelineStarting, autoRefresh, setAutoRefresh, elapsedTime, fetchPipeline, handleStartPipeline, collectionStatus, } = hook return (
{/* Pipeline Header */}

Compliance Pipeline Status

{pipelineState?.status === 'running' && elapsedTime && (
Laufzeit: {elapsedTime}
)}
{(!pipelineState || pipelineState.status !== 'running') && ( )}
{/* No Data */} {(!pipelineState || pipelineState.status === 'no_data') && !pipelineLoading && ( )} {/* Pipeline Status */} {pipelineState && pipelineState.status !== 'no_data' && ( <> {/* Status Card */} {/* Current Progress */} {pipelineState.status === 'running' && pipelineState.current_phase && ( )} {/* Validation Summary */} {pipelineState.validation_summary && ( )} {/* Checkpoints */} {/* Summary */} {Object.keys(pipelineState.summary || {}).length > 0 && ( )} )}
) } // --- Icons --- function SpinnerIcon() { return ( ) } function PlayIcon() { return ( ) } function RefreshIcon() { return ( ) } // --- Sub-components --- function NoDataCard({ pipelineStarting, handleStartPipeline, }: { pipelineStarting: boolean handleStartPipeline: (skip: boolean) => void }) { return (

Keine Pipeline-Daten

Es wurde noch keine Pipeline ausgefuehrt. Starten Sie die Compliance-Pipeline um Checkpoint-Daten zu sehen.

) } function PipelineStatusCard({ pipelineState }: { pipelineState: any }) { return (
{pipelineState.status === 'completed' && ( )} {pipelineState.status === 'running' && ( )} {pipelineState.status === 'failed' && ( )}

Pipeline {pipelineState.pipeline_id}

Gestartet: {pipelineState.started_at ? new Date(pipelineState.started_at).toLocaleString('de-DE') : '-'} {pipelineState.completed_at && ` | Beendet: ${new Date(pipelineState.completed_at).toLocaleString('de-DE')}`}

{pipelineState.status === 'completed' ? 'Abgeschlossen' : pipelineState.status === 'running' ? 'Laeuft' : pipelineState.status === 'failed' ? 'Fehlgeschlagen' : pipelineState.status}
) } function CurrentProgressCard({ pipelineState, collectionStatus }: { pipelineState: any; collectionStatus: any }) { return (

Aktuelle Verarbeitung

Phase: {pipelineState.current_phase}
{/* Phase Progress Indicator */}
{['ingestion', 'extraction', 'controls', 'measures'].map((phase, idx) => (
c.phase === phase && c.status === 'completed') ? 'bg-green-500' : 'bg-slate-200' }`} /> {idx < 3 &&
}
))}
Ingestion Extraktion Controls Massnahmen
{/* Current checkpoint details */} {pipelineState.checkpoints?.filter((c: PipelineCheckpoint) => c.status === 'running').map((checkpoint: PipelineCheckpoint, idx: number) => (
{checkpoint.name}
{checkpoint.metrics && Object.keys(checkpoint.metrics).length > 0 && (
{Object.entries(checkpoint.metrics).slice(0, 3).map(([key, value]) => ( {key.replace(/_/g, ' ')}: {typeof value === 'number' ? value.toLocaleString() : String(value)} ))}
)}
))} {/* Live chunk count */}
Chunks in Qdrant: {collectionStatus?.totalPoints?.toLocaleString() || '-'}
) } function ValidationSummary({ summary }: { summary: { passed: number; warning: number; failed: number; total: number } }) { return (

Bestanden

{summary.passed}

Warnungen

{summary.warning}

Fehlgeschlagen

{summary.failed}

Gesamt

{summary.total}

) } function CheckpointsList({ checkpoints }: { checkpoints?: PipelineCheckpoint[] }) { return (

Checkpoints ({checkpoints?.length || 0})

{checkpoints?.map((checkpoint, idx) => (
{checkpoint.name} ({checkpoint.phase}) | {checkpoint.duration_seconds ? ` ${checkpoint.duration_seconds.toFixed(1)}s` : ' -'}
{checkpoint.status}
{/* Metrics */} {Object.keys(checkpoint.metrics || {}).length > 0 && (
{Object.entries(checkpoint.metrics).map(([key, value]) => ( {key.replace(/_/g, ' ')}: {typeof value === 'number' ? value.toLocaleString() : String(value)} ))}
)} {/* Validations */} {checkpoint.validations?.length > 0 && (
{checkpoint.validations.map((v, vIdx) => (
{v.status === 'passed' ? '✓' : v.status === 'warning' ? '⚠' : '✗'} {v.name}: {v.message}
))}
)} {/* Error */} {checkpoint.error && (
{checkpoint.error}
)}
))} {(!checkpoints || checkpoints.length === 0) && (
Noch keine Checkpoints vorhanden.
)}
) } function PipelineSummary({ summary }: { summary: Record }) { return (

Zusammenfassung

{Object.entries(summary).map(([key, value]) => (

{key.replace(/_/g, ' ')}

{typeof value === 'number' ? value.toLocaleString() : String(value)}

))}
) }