fix(ui): restore TRACE/TAP badges on diagram nodes via nodeConfigs
This commit is contained in:
@@ -4,7 +4,9 @@ import { useGlobalFilters } from '@cameleer/design-system';
|
|||||||
import { useExecutionDetail } from '../../api/queries/executions';
|
import { useExecutionDetail } from '../../api/queries/executions';
|
||||||
import { useDiagramByRoute } from '../../api/queries/diagrams';
|
import { useDiagramByRoute } from '../../api/queries/diagrams';
|
||||||
import { useRouteCatalog } from '../../api/queries/catalog';
|
import { useRouteCatalog } from '../../api/queries/catalog';
|
||||||
import type { NodeAction } from '../../components/ProcessDiagram/types';
|
import { useApplicationConfig } from '../../api/queries/commands';
|
||||||
|
import { useTracingStore } from '../../stores/tracing-store';
|
||||||
|
import type { NodeAction, NodeConfig } from '../../components/ProcessDiagram/types';
|
||||||
import { ExchangeHeader } from './ExchangeHeader';
|
import { ExchangeHeader } from './ExchangeHeader';
|
||||||
import { ExecutionDiagram } from '../../components/ExecutionDiagram/ExecutionDiagram';
|
import { ExecutionDiagram } from '../../components/ExecutionDiagram/ExecutionDiagram';
|
||||||
import { ProcessDiagram } from '../../components/ProcessDiagram';
|
import { ProcessDiagram } from '../../components/ProcessDiagram';
|
||||||
@@ -134,6 +136,27 @@ function DiagramPanel({ appId, routeId, exchangeId, onCorrelatedSelect, onClearS
|
|||||||
return ids;
|
return ids;
|
||||||
}, [catalog]);
|
}, [catalog]);
|
||||||
|
|
||||||
|
// Build nodeConfigs from tracing store + app config (for TRACE/TAP badges)
|
||||||
|
const { data: appConfig } = useApplicationConfig(appId);
|
||||||
|
const tracedMap = useTracingStore((s) => s.tracedProcessors[appId]);
|
||||||
|
const nodeConfigs = useMemo(() => {
|
||||||
|
const map = new Map<string, NodeConfig>();
|
||||||
|
if (tracedMap) {
|
||||||
|
for (const pid of Object.keys(tracedMap)) {
|
||||||
|
map.set(pid, { traceEnabled: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (appConfig?.taps) {
|
||||||
|
for (const tap of appConfig.taps) {
|
||||||
|
if (tap.enabled) {
|
||||||
|
const existing = map.get(tap.processorId);
|
||||||
|
map.set(tap.processorId, { ...existing, tapExpression: tap.expression });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}, [tracedMap, appConfig]);
|
||||||
|
|
||||||
const handleNodeAction = useCallback((nodeId: string, action: NodeAction) => {
|
const handleNodeAction = useCallback((nodeId: string, action: NodeAction) => {
|
||||||
if (action === 'configure-tap') {
|
if (action === 'configure-tap') {
|
||||||
navigate(`/admin/appconfig?app=${encodeURIComponent(appId)}&processor=${encodeURIComponent(nodeId)}`);
|
navigate(`/admin/appconfig?app=${encodeURIComponent(appId)}&processor=${encodeURIComponent(nodeId)}`);
|
||||||
@@ -150,6 +173,7 @@ function DiagramPanel({ appId, routeId, exchangeId, onCorrelatedSelect, onClearS
|
|||||||
executionDetail={detail}
|
executionDetail={detail}
|
||||||
knownRouteIds={knownRouteIds}
|
knownRouteIds={knownRouteIds}
|
||||||
onNodeAction={handleNodeAction}
|
onNodeAction={handleNodeAction}
|
||||||
|
nodeConfigs={nodeConfigs}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -164,6 +188,7 @@ function DiagramPanel({ appId, routeId, exchangeId, onCorrelatedSelect, onClearS
|
|||||||
diagramLayout={diagramQuery.data}
|
diagramLayout={diagramQuery.data}
|
||||||
knownRouteIds={knownRouteIds}
|
knownRouteIds={knownRouteIds}
|
||||||
onNodeAction={handleNodeAction}
|
onNodeAction={handleNodeAction}
|
||||||
|
nodeConfigs={nodeConfigs}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user