refactor: remove diagramNodeId indirection, use processorId directly
Agent now uses Camel processorId as RouteNode.id, eliminating the nodeId mapping layer. Drop diagram_node_id column (V6 migration), remove from ProcessorRecord/ProcessorNode/IngestionService/DetailService, add /processor-routes endpoint for processorId→routeId lookup, simplify frontend diagram-mapping and ExchangeDetail overlays, replace N diagram fetches in AppConfigPage with single hook. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -172,19 +172,10 @@ export default function ExchangeDetail() {
|
||||
const { routeFlows, flowIndexMap } = useMemo(() => {
|
||||
let nodes: RouteNode[]
|
||||
if (diagram?.nodes) {
|
||||
// Flatten processors to build diagramNodeId → processorId lookup
|
||||
const flatProcs: Array<{ diagramNodeId?: string; processorId?: string }> = []
|
||||
function flattenProcs(list: any[]) {
|
||||
for (const n of list) { flatProcs.push(n); if (n.children) flattenProcs(n.children) }
|
||||
}
|
||||
flattenProcs(procList)
|
||||
const pidLookup = new Map(flatProcs
|
||||
.filter(p => p.diagramNodeId && p.processorId)
|
||||
.map(p => [p.diagramNodeId!, p.processorId!]))
|
||||
|
||||
// node.id is the processorId (Camel nodeId), so lookup is direct
|
||||
nodes = mapDiagramToRouteNodes(diagram.nodes, procList).map((node, i) => ({
|
||||
...node,
|
||||
badges: badgesFor(pidLookup.get(diagram.nodes[i]?.id ?? '') ?? diagram.nodes[i]?.id ?? ''),
|
||||
badges: badgesFor(diagram.nodes[i]?.id ?? ''),
|
||||
}))
|
||||
} else {
|
||||
// Fallback: build from processor list
|
||||
@@ -211,22 +202,11 @@ export default function ExchangeDetail() {
|
||||
return ids
|
||||
}, [procList])
|
||||
|
||||
// ProcessorId lookup: diagram node index → processorId
|
||||
// ProcessorId lookup: diagram node index → processorId (node.id IS processorId)
|
||||
const flowProcessorIds: string[] = useMemo(() => {
|
||||
if (!diagram?.nodes) return processorIds
|
||||
const flatProcs: Array<{ diagramNodeId?: string; processorId?: string }> = []
|
||||
function flatten(nodes: any[]) {
|
||||
for (const n of nodes) {
|
||||
flatProcs.push(n)
|
||||
if (n.children) flatten(n.children)
|
||||
}
|
||||
}
|
||||
flatten(procList)
|
||||
const lookup = new Map(flatProcs
|
||||
.filter(p => p.diagramNodeId && p.processorId)
|
||||
.map(p => [p.diagramNodeId!, p.processorId!]))
|
||||
return diagram.nodes.map(node => lookup.get(node.id ?? '') ?? node.id ?? '')
|
||||
}, [diagram, procList, processorIds])
|
||||
return diagram.nodes.map(node => node.id ?? '')
|
||||
}, [diagram, processorIds])
|
||||
|
||||
// Map flow display index → processor tree index (for snapshot API)
|
||||
const flowToTreeIndex = useMemo(() =>
|
||||
|
||||
Reference in New Issue
Block a user