feat(ui): redesign ExchangeHeader with info bar, arrows, and navigation
- Always shows exchange info row: status dot, badge, ID, route, app, duration - Correlation chain: arrow connectors between nodes, route name + duration per node - Click on correlated exchange navigates to /exchanges/:app/:route/:exchangeId - Compact styling with bg-raised background, proper visual hierarchy - Horizontal scroll for long correlation chains Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { useNavigate } from 'react-router';
|
||||
import { StatusDot, MonoText, Badge } from '@cameleer/design-system';
|
||||
import { useCorrelationChain } from '../../api/queries/correlation';
|
||||
import type { ExecutionDetail } from '../../components/ExecutionDiagram/types';
|
||||
@@ -5,7 +6,6 @@ import styles from './ExchangeHeader.module.css';
|
||||
|
||||
interface ExchangeHeaderProps {
|
||||
detail: ExecutionDetail;
|
||||
onExchangeClick?: (executionId: string) => void;
|
||||
}
|
||||
|
||||
type StatusVariant = 'success' | 'error' | 'running' | 'warning';
|
||||
@@ -19,25 +19,45 @@ function statusVariant(s: string): StatusVariant {
|
||||
}
|
||||
}
|
||||
|
||||
function statusLabel(s: string): string {
|
||||
switch (s) {
|
||||
case 'COMPLETED': return 'OK';
|
||||
case 'FAILED': return 'ERR';
|
||||
case 'RUNNING': return 'RUN';
|
||||
default: return s;
|
||||
}
|
||||
}
|
||||
|
||||
function formatDuration(ms: number): string {
|
||||
if (ms >= 60_000) return `${(ms / 1000).toFixed(0)}s`;
|
||||
if (ms >= 1000) return `${(ms / 1000).toFixed(2)}s`;
|
||||
return `${ms}ms`;
|
||||
}
|
||||
|
||||
export function ExchangeHeader({ detail, onExchangeClick }: ExchangeHeaderProps) {
|
||||
export function ExchangeHeader({ detail }: ExchangeHeaderProps) {
|
||||
const navigate = useNavigate();
|
||||
const { data: chainResult } = useCorrelationChain(detail.correlationId ?? null);
|
||||
const chain = chainResult?.data;
|
||||
const showChain = chain && chain.length > 1;
|
||||
|
||||
if (!showChain) return null;
|
||||
|
||||
return (
|
||||
<div className={styles.header}>
|
||||
{/* Exchange info — always shown */}
|
||||
<div className={styles.info}>
|
||||
<StatusDot variant={statusVariant(detail.status)} />
|
||||
<Badge label={statusLabel(detail.status)} color={statusVariant(detail.status)} />
|
||||
<MonoText size="xs">{(detail.exchangeId || detail.executionId).slice(0, 16)}</MonoText>
|
||||
<span className={styles.separator} />
|
||||
<span className={styles.route}>{detail.routeId}</span>
|
||||
<span className={styles.app}>{detail.applicationName}</span>
|
||||
<span className={styles.duration}>{formatDuration(detail.durationMs)}</span>
|
||||
</div>
|
||||
|
||||
{/* Correlation chain — only when multiple correlated exchanges exist */}
|
||||
{showChain && (
|
||||
<div className={styles.chain}>
|
||||
<span className={styles.chainLabel}>Correlated Exchanges</span>
|
||||
{chain.map((ce: any) => {
|
||||
<span className={styles.chainLabel}>Correlated</span>
|
||||
{chain.map((ce: any, i: number) => {
|
||||
const isCurrent = ce.executionId === detail.executionId;
|
||||
const variant = statusVariant(ce.status);
|
||||
const statusCls =
|
||||
@@ -46,15 +66,22 @@ export function ExchangeHeader({ detail, onExchangeClick }: ExchangeHeaderProps)
|
||||
: variant === 'running' ? styles.chainNodeRunning
|
||||
: styles.chainNodeWarning;
|
||||
return (
|
||||
<button
|
||||
key={ce.executionId}
|
||||
className={`${styles.chainNode} ${statusCls} ${isCurrent ? styles.chainNodeCurrent : ''}`}
|
||||
onClick={() => { if (!isCurrent) onExchangeClick?.(ce.executionId); }}
|
||||
title={`${ce.executionId} \u2014 ${ce.routeId}`}
|
||||
>
|
||||
<StatusDot variant={variant} />
|
||||
<span>{ce.routeId}</span>
|
||||
</button>
|
||||
<span key={ce.executionId} className={styles.chainEntry}>
|
||||
{i > 0 && <span className={styles.chainArrow}>→</span>}
|
||||
<button
|
||||
className={`${styles.chainNode} ${statusCls} ${isCurrent ? styles.chainNodeCurrent : ''}`}
|
||||
onClick={() => {
|
||||
if (!isCurrent) {
|
||||
navigate(`/exchanges/${ce.applicationName ?? detail.applicationName}/${ce.routeId}/${ce.executionId}`);
|
||||
}
|
||||
}}
|
||||
title={`${ce.executionId}\n${ce.routeId} \u2014 ${formatDuration(ce.durationMs)}`}
|
||||
>
|
||||
<StatusDot variant={variant} />
|
||||
<span className={styles.chainRoute}>{ce.routeId}</span>
|
||||
<span className={styles.chainDuration}>{formatDuration(ce.durationMs)}</span>
|
||||
</button>
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user