fix: OpenSearch status field mismatch, adopt RouteFlow flows prop
All checks were successful
CI / build (push) Successful in 56s
CI / cleanup-branch (push) Has been skipped
CI / docker (push) Successful in 1m43s
CI / deploy (push) Successful in 38s
CI / deploy-feature (push) Has been skipped

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:
hsiegeln
2026-03-25 18:34:58 +01:00
parent 2bbca8ae38
commit 20ee448f4e
8 changed files with 74 additions and 43 deletions

View File

@@ -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 };
}