import { Badge } from '@cameleer/design-system'; import type { ProcessorNode, ExecutionDetail } from '../types'; import { attributeBadgeColor } from '../../../utils/attribute-color'; import styles from '../ExecutionDiagram.module.css'; interface InfoTabProps { processor: ProcessorNode | null; executionDetail: ExecutionDetail; } function formatTime(iso: string | undefined): string { if (!iso) return '-'; try { const d = new Date(iso); const h = String(d.getHours()).padStart(2, '0'); const m = String(d.getMinutes()).padStart(2, '0'); const s = String(d.getSeconds()).padStart(2, '0'); const ms = String(d.getMilliseconds()).padStart(3, '0'); return `${h}:${m}:${s}.${ms}`; } catch { return iso; } } function formatDuration(ms: number | undefined): string { if (ms === undefined || ms === null) return '-'; if (ms < 1000) return `${ms}ms`; return `${(ms / 1000).toFixed(1)}s`; } function statusClass(status: string): string { const s = status?.toUpperCase(); if (s === 'COMPLETED') return styles.statusCompleted; if (s === 'FAILED') return styles.statusFailed; return ''; } function Field({ label, value, mono }: { label: string; value: string; mono?: boolean }) { return (
{label}
{value || '-'}
); } function Attributes({ attrs }: { attrs: Record | undefined }) { if (!attrs) return null; const entries = Object.entries(attrs); if (entries.length === 0) return null; return (
Attributes
{entries.map(([k, v]) => ( ))}
); } export function InfoTab({ processor, executionDetail }: InfoTabProps) { if (processor) { return (
Status
{processor.status}
); } // Exchange-level view return (
Status
{executionDetail.status}
); }