fix(ui): correlated exchange click updates local state instead of navigating
This commit is contained in:
@@ -9,6 +9,7 @@ import styles from './ExchangeHeader.module.css';
|
|||||||
|
|
||||||
interface ExchangeHeaderProps {
|
interface ExchangeHeaderProps {
|
||||||
detail: ExecutionDetail;
|
detail: ExecutionDetail;
|
||||||
|
onCorrelatedSelect?: (executionId: string, applicationName: string, routeId: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
type StatusVariant = 'success' | 'error' | 'running' | 'warning';
|
type StatusVariant = 'success' | 'error' | 'running' | 'warning';
|
||||||
@@ -37,7 +38,7 @@ function formatDuration(ms: number): string {
|
|||||||
return `${ms}ms`;
|
return `${ms}ms`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ExchangeHeader({ detail }: ExchangeHeaderProps) {
|
export function ExchangeHeader({ detail, onCorrelatedSelect }: ExchangeHeaderProps) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { data: chainResult } = useCorrelationChain(detail.correlationId ?? null);
|
const { data: chainResult } = useCorrelationChain(detail.correlationId ?? null);
|
||||||
const chain = chainResult?.data;
|
const chain = chainResult?.data;
|
||||||
@@ -106,8 +107,8 @@ export function ExchangeHeader({ detail }: ExchangeHeaderProps) {
|
|||||||
<button
|
<button
|
||||||
className={`${styles.chainNode} ${statusCls} ${isCurrent ? styles.chainNodeCurrent : ''}`}
|
className={`${styles.chainNode} ${statusCls} ${isCurrent ? styles.chainNodeCurrent : ''}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (!isCurrent) {
|
if (!isCurrent && onCorrelatedSelect) {
|
||||||
navigate(`/exchanges/${ce.applicationName ?? detail.applicationName}/${ce.routeId}/${ce.executionId}`);
|
onCorrelatedSelect(ce.executionId, ce.applicationName ?? detail.applicationName, ce.routeId);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
title={`${ce.executionId}\n${ce.routeId} \u2014 ${formatDuration(ce.durationMs)}`}
|
title={`${ce.executionId}\n${ce.routeId} \u2014 ${formatDuration(ce.durationMs)}`}
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ export default function ExchangesPage() {
|
|||||||
setSelected(exchange);
|
setSelected(exchange);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const handleCorrelatedSelect = useCallback((executionId: string, applicationName: string, routeId: string) => {
|
||||||
|
setSelected({ executionId, applicationName, routeId });
|
||||||
|
}, []);
|
||||||
|
|
||||||
const handleSplitterDown = useCallback((e: React.PointerEvent) => {
|
const handleSplitterDown = useCallback((e: React.PointerEvent) => {
|
||||||
e.currentTarget.setPointerCapture(e.pointerId);
|
e.currentTarget.setPointerCapture(e.pointerId);
|
||||||
const container = containerRef.current;
|
const container = containerRef.current;
|
||||||
@@ -57,6 +61,7 @@ export default function ExchangesPage() {
|
|||||||
appId={selected.applicationName}
|
appId={selected.applicationName}
|
||||||
routeId={selected.routeId}
|
routeId={selected.routeId}
|
||||||
exchangeId={selected.executionId}
|
exchangeId={selected.executionId}
|
||||||
|
onCorrelatedSelect={handleCorrelatedSelect}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -69,9 +74,10 @@ interface DiagramPanelProps {
|
|||||||
appId: string;
|
appId: string;
|
||||||
routeId: string;
|
routeId: string;
|
||||||
exchangeId: string;
|
exchangeId: string;
|
||||||
|
onCorrelatedSelect: (executionId: string, applicationName: string, routeId: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DiagramPanel({ appId, routeId, exchangeId }: DiagramPanelProps) {
|
function DiagramPanel({ appId, routeId, exchangeId, onCorrelatedSelect }: DiagramPanelProps) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { timeRange } = useGlobalFilters();
|
const { timeRange } = useGlobalFilters();
|
||||||
const timeFrom = timeRange.start.toISOString();
|
const timeFrom = timeRange.start.toISOString();
|
||||||
@@ -101,7 +107,7 @@ function DiagramPanel({ appId, routeId, exchangeId }: DiagramPanelProps) {
|
|||||||
if (detail) {
|
if (detail) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ExchangeHeader detail={detail} />
|
<ExchangeHeader detail={detail} onCorrelatedSelect={onCorrelatedSelect} />
|
||||||
<ExecutionDiagram
|
<ExecutionDiagram
|
||||||
executionId={exchangeId}
|
executionId={exchangeId}
|
||||||
executionDetail={detail}
|
executionDetail={detail}
|
||||||
|
|||||||
Reference in New Issue
Block a user