feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
All checks were successful
CI / cleanup-branch (push) Has been skipped
CI / build (push) Successful in 1m0s
CI / docker (push) Successful in 56s
CI / deploy-feature (push) Has been skipped
CI / deploy (push) Successful in 38s

New interactive route diagram component with SVG rendering using
server-computed ELK layout coordinates. TIBCO BW5-inspired top-bar
card node style with zoom/pan, hover toolbars, config badges, and
error handler sections below the main flow.

Backend: add direction query parameter (LR/TB) to diagram render
endpoints, defaulting to left-to-right layout.

Frontend: 14-file ProcessDiagram component in ui/src/components/
with DiagramNode, CompoundNode, DiagramEdge, ConfigBadge, NodeToolbar,
ErrorSection, ZoomControls, and supporting hooks. Dev test page at
/dev/diagram for validation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-03-27 13:55:29 +01:00
parent 78e12f5cf9
commit ac32396a57
24 changed files with 7264 additions and 18 deletions

File diff suppressed because one or more lines are too long

View File

@@ -12,19 +12,32 @@ export interface DiagramNode {
children?: DiagramNode[];
}
interface DiagramLayout {
export interface DiagramEdge {
sourceId: string;
targetId: string;
label?: string;
points: number[][];
}
export interface DiagramLayout {
width?: number;
height?: number;
nodes?: DiagramNode[];
edges?: Array<{ from?: string; to?: string }>;
edges?: DiagramEdge[];
}
export function useDiagramLayout(contentHash: string | null) {
export function useDiagramLayout(
contentHash: string | null,
direction: 'LR' | 'TB' = 'LR',
) {
return useQuery({
queryKey: ['diagrams', 'layout', contentHash],
queryKey: ['diagrams', 'layout', contentHash, direction],
queryFn: async () => {
const { data, error } = await api.GET('/diagrams/{contentHash}/render', {
params: { path: { contentHash: contentHash! } },
params: {
path: { contentHash: contentHash! },
query: { direction },
},
headers: { Accept: 'application/json' },
});
if (error) throw new Error('Failed to load diagram layout');
@@ -34,15 +47,19 @@ export function useDiagramLayout(contentHash: string | null) {
});
}
export function useDiagramByRoute(application: string | undefined, routeId: string | undefined) {
export function useDiagramByRoute(
application: string | undefined,
routeId: string | undefined,
direction: 'LR' | 'TB' = 'LR',
) {
return useQuery({
queryKey: ['diagrams', 'byRoute', application, routeId],
queryKey: ['diagrams', 'byRoute', application, routeId, direction],
queryFn: async () => {
const { data, error } = await api.GET('/diagrams', {
params: { query: { application: application!, routeId: routeId! } },
params: { query: { application: application!, routeId: routeId!, direction } },
});
if (error) throw new Error('Failed to load diagram for route');
return data!;
return data as DiagramLayout;
},
enabled: !!application && !!routeId,
});

View File

@@ -3642,6 +3642,8 @@ export interface operations {
query: {
application: string;
routeId: string;
/** @description Layout direction: LR (left-to-right) or TB (top-to-bottom) */
direction?: "LR" | "TB";
};
header?: never;
path?: never;
@@ -3671,7 +3673,10 @@ export interface operations {
};
renderDiagram: {
parameters: {
query?: never;
query?: {
/** @description Layout direction: LR (left-to-right) or TB (top-to-bottom) */
direction?: "LR" | "TB";
};
header?: never;
path: {
contentHash: string;