fix: OpenSearch status field mismatch, adopt RouteFlow flows prop
Fix admin OpenSearch page always showing "Disconnected" by aligning frontend field names (reachable/nodeCount/host) with backend DTO. Update design system to v0.1.10 and adopt the new multi-flow RouteFlow API — error-handler nodes now render as labeled segments with error variant instead of relying on legacy auto-separation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { RouteNode } from '@cameleer/design-system';
|
||||
import type { RouteNode, FlowSegment } from '@cameleer/design-system';
|
||||
|
||||
// Map NodeType strings to RouteNode types
|
||||
function mapNodeType(type: string): RouteNode['type'] {
|
||||
@@ -53,3 +53,29 @@ export function mapDiagramToRouteNodes(
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits a flat RouteNode[] into FlowSegment[] (main route + error handlers).
|
||||
* Returns the segments and an index map: indexMap[newFlatIndex] = originalIndex.
|
||||
*/
|
||||
export function toFlowSegments(nodes: RouteNode[]): { flows: FlowSegment[]; indexMap: number[] } {
|
||||
const mainIndices: number[] = [];
|
||||
const errorIndices: number[] = [];
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].type === 'error-handler') {
|
||||
errorIndices.push(i);
|
||||
} else {
|
||||
mainIndices.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
const flows: FlowSegment[] = [
|
||||
{ label: 'Main Route', nodes: mainIndices.map(i => nodes[i]) },
|
||||
];
|
||||
if (errorIndices.length > 0) {
|
||||
flows.push({ label: 'Error Handler', nodes: errorIndices.map(i => nodes[i]), variant: 'error' });
|
||||
}
|
||||
|
||||
const indexMap = [...mainIndices, ...errorIndices];
|
||||
return { flows, indexMap };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user