2026-03-30 18:08:40 +02:00
|
|
|
|
import React from 'react';
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
import type { DiagramNode as DiagramNodeType } from '../../api/queries/diagrams';
|
2026-03-29 23:32:42 +02:00
|
|
|
|
import type { NodeConfig, LatencyHeatmapEntry } from './types';
|
2026-03-27 18:44:16 +01:00
|
|
|
|
import type { NodeExecutionState } from '../ExecutionDiagram/types';
|
2026-03-29 11:56:19 +02:00
|
|
|
|
import { colorForType, iconForType, type IconElement } from './node-colors';
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
|
|
|
|
|
|
const TOP_BAR_HEIGHT = 6;
|
2026-03-28 17:16:36 +01:00
|
|
|
|
const TEXT_LEFT = 32;
|
|
|
|
|
|
const TEXT_RIGHT_PAD = 24;
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
const CORNER_RADIUS = 4;
|
|
|
|
|
|
|
|
|
|
|
|
interface DiagramNodeProps {
|
|
|
|
|
|
node: DiagramNodeType;
|
|
|
|
|
|
isHovered: boolean;
|
|
|
|
|
|
isSelected: boolean;
|
|
|
|
|
|
config?: NodeConfig;
|
2026-03-27 18:44:16 +01:00
|
|
|
|
executionState?: NodeExecutionState;
|
|
|
|
|
|
overlayActive?: boolean;
|
2026-03-29 23:32:42 +02:00
|
|
|
|
heatmapEntry?: LatencyHeatmapEntry;
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
onClick: () => void;
|
2026-03-27 16:58:35 +01:00
|
|
|
|
onDoubleClick?: () => void;
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
onMouseEnter: () => void;
|
|
|
|
|
|
onMouseLeave: () => void;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-29 23:32:42 +02:00
|
|
|
|
/** Interpolate green (120°) → yellow (60°) → red (0°) based on pctOfRoute */
|
|
|
|
|
|
function heatmapColor(pct: number): string {
|
|
|
|
|
|
const clamped = Math.max(0, Math.min(100, pct));
|
|
|
|
|
|
// 0% → hue 120 (green), 50% → hue 60 (yellow), 100% → hue 0 (red)
|
|
|
|
|
|
const hue = 120 - (clamped / 100) * 120;
|
|
|
|
|
|
return `hsl(${Math.round(hue)}, 70%, 92%)`;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function heatmapBorderColor(pct: number): string {
|
|
|
|
|
|
const clamped = Math.max(0, Math.min(100, pct));
|
|
|
|
|
|
const hue = 120 - (clamped / 100) * 120;
|
|
|
|
|
|
return `hsl(${Math.round(hue)}, 60%, 50%)`;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-27 18:44:16 +01:00
|
|
|
|
function formatDuration(ms: number): string {
|
|
|
|
|
|
if (ms < 1000) return `${ms}ms`;
|
|
|
|
|
|
return `${(ms / 1000).toFixed(1)}s`;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
export function DiagramNode({
|
2026-03-27 18:44:16 +01:00
|
|
|
|
node, isHovered, isSelected, config,
|
2026-03-29 23:32:42 +02:00
|
|
|
|
executionState, overlayActive, heatmapEntry,
|
2026-03-27 18:44:16 +01:00
|
|
|
|
onClick, onDoubleClick, onMouseEnter, onMouseLeave,
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
}: DiagramNodeProps) {
|
|
|
|
|
|
const x = node.x ?? 0;
|
|
|
|
|
|
const y = node.y ?? 0;
|
|
|
|
|
|
const w = node.width ?? 120;
|
|
|
|
|
|
const h = node.height ?? 40;
|
|
|
|
|
|
const color = colorForType(node.type);
|
2026-03-29 11:56:19 +02:00
|
|
|
|
const iconElements = iconForType(node.type);
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
|
|
|
|
|
|
// Extract label parts: type name and detail
|
|
|
|
|
|
const typeName = node.type?.replace(/^EIP_/, '').replace(/_/g, ' ') ?? '';
|
|
|
|
|
|
const detail = node.label || '';
|
2026-03-29 16:30:11 +02:00
|
|
|
|
const resolvedUri = executionState?.resolvedEndpointUri;
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
|
2026-03-27 18:44:16 +01:00
|
|
|
|
// Overlay state derivation
|
|
|
|
|
|
const isCompleted = executionState?.status === 'COMPLETED';
|
|
|
|
|
|
const isFailed = executionState?.status === 'FAILED';
|
|
|
|
|
|
const isSkipped = overlayActive && !executionState;
|
|
|
|
|
|
|
2026-03-29 23:32:42 +02:00
|
|
|
|
// Colors based on execution state (heatmap takes priority when no execution overlay)
|
2026-03-27 18:44:16 +01:00
|
|
|
|
let cardFill = isHovered ? '#F5F0EA' : 'white';
|
|
|
|
|
|
let borderStroke = isHovered || isSelected ? color : '#E4DFD8';
|
|
|
|
|
|
let borderWidth = isHovered || isSelected ? 1.5 : 1;
|
|
|
|
|
|
let topBarColor = color;
|
|
|
|
|
|
let labelColor = '#1A1612';
|
|
|
|
|
|
|
|
|
|
|
|
if (isCompleted) {
|
|
|
|
|
|
cardFill = isHovered ? '#E4F5E6' : '#F0F9F1';
|
|
|
|
|
|
borderStroke = '#3D7C47';
|
|
|
|
|
|
borderWidth = 1.5;
|
|
|
|
|
|
topBarColor = '#3D7C47';
|
|
|
|
|
|
} else if (isFailed) {
|
|
|
|
|
|
cardFill = isHovered ? '#F9E4E1' : '#FDF2F0';
|
|
|
|
|
|
borderStroke = '#C0392B';
|
|
|
|
|
|
borderWidth = 2;
|
|
|
|
|
|
topBarColor = '#C0392B';
|
|
|
|
|
|
labelColor = '#C0392B';
|
2026-03-29 23:32:42 +02:00
|
|
|
|
} else if (heatmapEntry && !overlayActive) {
|
|
|
|
|
|
cardFill = heatmapColor(heatmapEntry.pctOfRoute);
|
|
|
|
|
|
borderStroke = heatmapBorderColor(heatmapEntry.pctOfRoute);
|
|
|
|
|
|
borderWidth = 1.5;
|
|
|
|
|
|
topBarColor = heatmapBorderColor(heatmapEntry.pctOfRoute);
|
2026-03-27 18:44:16 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const statusColor = isCompleted ? '#3D7C47' : isFailed ? '#C0392B' : undefined;
|
|
|
|
|
|
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
return (
|
|
|
|
|
|
<g
|
|
|
|
|
|
data-node-id={node.id}
|
|
|
|
|
|
transform={`translate(${x}, ${y})`}
|
|
|
|
|
|
onClick={(e) => { e.stopPropagation(); onClick(); }}
|
2026-03-27 16:58:35 +01:00
|
|
|
|
onDoubleClick={(e) => { e.stopPropagation(); onDoubleClick?.(); }}
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
onMouseEnter={onMouseEnter}
|
|
|
|
|
|
onMouseLeave={onMouseLeave}
|
|
|
|
|
|
style={{ cursor: 'pointer' }}
|
2026-03-27 18:44:16 +01:00
|
|
|
|
opacity={isSkipped ? 0.35 : undefined}
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
>
|
|
|
|
|
|
{/* Selection ring */}
|
|
|
|
|
|
{isSelected && (
|
|
|
|
|
|
<rect
|
|
|
|
|
|
x={-2}
|
|
|
|
|
|
y={-2}
|
|
|
|
|
|
width={w + 4}
|
|
|
|
|
|
height={h + 4}
|
|
|
|
|
|
rx={CORNER_RADIUS + 2}
|
|
|
|
|
|
fill="none"
|
|
|
|
|
|
stroke="#C6820E"
|
|
|
|
|
|
strokeWidth={2.5}
|
|
|
|
|
|
/>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
{/* Card background */}
|
|
|
|
|
|
<rect
|
|
|
|
|
|
x={0}
|
|
|
|
|
|
y={0}
|
|
|
|
|
|
width={w}
|
|
|
|
|
|
height={h}
|
|
|
|
|
|
rx={CORNER_RADIUS}
|
2026-03-27 18:44:16 +01:00
|
|
|
|
fill={cardFill}
|
|
|
|
|
|
stroke={borderStroke}
|
|
|
|
|
|
strokeWidth={borderWidth}
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
{/* Colored top bar */}
|
2026-03-27 18:44:16 +01:00
|
|
|
|
<rect x={0} y={0} width={w} height={TOP_BAR_HEIGHT} rx={CORNER_RADIUS} fill={topBarColor} />
|
|
|
|
|
|
<rect x={CORNER_RADIUS} y={0} width={w - CORNER_RADIUS * 2} height={TOP_BAR_HEIGHT} fill={topBarColor} />
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
|
2026-03-28 17:16:36 +01:00
|
|
|
|
{/* Clip path for text area */}
|
|
|
|
|
|
<clipPath id={`clip-${node.id}`}>
|
|
|
|
|
|
<rect x={TEXT_LEFT} y={TOP_BAR_HEIGHT} width={w - TEXT_LEFT - TEXT_RIGHT_PAD} height={h - TOP_BAR_HEIGHT} />
|
|
|
|
|
|
</clipPath>
|
|
|
|
|
|
|
2026-03-29 11:56:19 +02:00
|
|
|
|
{/* Icon (lucide 24×24 scaled to 14px) */}
|
|
|
|
|
|
<g transform={`translate(6, ${h / 2 - 7}) scale(0.583)`}>
|
|
|
|
|
|
{iconElements.map((el: IconElement, i: number) =>
|
|
|
|
|
|
'd' in el
|
|
|
|
|
|
? <path key={i} d={el.d} fill="none" stroke={statusColor ?? color} strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" />
|
|
|
|
|
|
: <circle key={i} cx={el.cx} cy={el.cy} r={el.r} fill="none" stroke={statusColor ?? color} strokeWidth={2} />
|
|
|
|
|
|
)}
|
|
|
|
|
|
</g>
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
|
2026-03-29 16:30:11 +02:00
|
|
|
|
{/* Type name + detail + resolved URI (clipped to available width) */}
|
2026-03-28 17:16:36 +01:00
|
|
|
|
<g clipPath={`url(#clip-${node.id})`}>
|
2026-03-29 16:30:11 +02:00
|
|
|
|
{resolvedUri ? (
|
|
|
|
|
|
<>
|
|
|
|
|
|
<text x={TEXT_LEFT} y={TOP_BAR_HEIGHT + 12} fill={labelColor} fontSize={11} fontWeight={600}>
|
|
|
|
|
|
{typeName}
|
|
|
|
|
|
</text>
|
|
|
|
|
|
{detail && detail !== typeName && (
|
|
|
|
|
|
<text x={TEXT_LEFT} y={TOP_BAR_HEIGHT + 24} fill={isFailed ? '#C0392B' : '#5C5347'} fontSize={10}>
|
|
|
|
|
|
{detail}
|
|
|
|
|
|
</text>
|
|
|
|
|
|
)}
|
2026-03-30 16:35:28 +02:00
|
|
|
|
<text x={TEXT_LEFT} y={TOP_BAR_HEIGHT + (detail && detail !== typeName ? 35 : 24)} fill="#1A7F8E" fontSize={9} fontStyle="italic">
|
2026-03-29 16:30:11 +02:00
|
|
|
|
→ {resolvedUri.split('?')[0]}
|
|
|
|
|
|
</text>
|
|
|
|
|
|
</>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<>
|
|
|
|
|
|
<text x={TEXT_LEFT} y={h / 2 - 1} fill={labelColor} fontSize={11} fontWeight={600}>
|
|
|
|
|
|
{typeName}
|
|
|
|
|
|
</text>
|
|
|
|
|
|
{detail && detail !== typeName && (
|
|
|
|
|
|
<text x={TEXT_LEFT} y={h / 2 + 12} fill={isFailed ? '#C0392B' : '#5C5347'} fontSize={10}>
|
|
|
|
|
|
{detail}
|
|
|
|
|
|
</text>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</>
|
2026-03-28 17:16:36 +01:00
|
|
|
|
)}
|
|
|
|
|
|
</g>
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
|
2026-03-30 18:08:40 +02:00
|
|
|
|
{/* Inline badges row: hasTrace, hasTap, status — inside card, top-right */}
|
|
|
|
|
|
{(() => {
|
|
|
|
|
|
const BADGE_R = 6;
|
|
|
|
|
|
const BADGE_D = BADGE_R * 2;
|
|
|
|
|
|
const BADGE_GAP = 3;
|
|
|
|
|
|
const cy = TOP_BAR_HEIGHT + BADGE_R + 2;
|
|
|
|
|
|
const showTrace = config?.traceEnabled || executionState?.hasTraceData;
|
|
|
|
|
|
const showTap = !!config?.tapExpression;
|
|
|
|
|
|
if (!showTrace && !showTap && !isCompleted && !isFailed) return null;
|
|
|
|
|
|
const badges: React.ReactNode[] = [];
|
|
|
|
|
|
let slot = 0;
|
2026-03-27 18:44:16 +01:00
|
|
|
|
|
2026-03-30 18:08:40 +02:00
|
|
|
|
// Status badge (rightmost, only during overlay)
|
|
|
|
|
|
const statusCx = w - BADGE_R - 4;
|
|
|
|
|
|
if (isCompleted) {
|
|
|
|
|
|
badges.push(
|
|
|
|
|
|
<g key="status">
|
|
|
|
|
|
<circle cx={statusCx} cy={cy} r={BADGE_R} fill="#3D7C47" />
|
|
|
|
|
|
<path d={`M${statusCx - 3} ${cy} l2 2 4-4`} fill="none" stroke="white" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round" />
|
|
|
|
|
|
</g>
|
|
|
|
|
|
);
|
|
|
|
|
|
slot++;
|
|
|
|
|
|
} else if (isFailed) {
|
|
|
|
|
|
badges.push(
|
|
|
|
|
|
<g key="status">
|
|
|
|
|
|
<circle cx={statusCx} cy={cy} r={BADGE_R} fill="none" stroke="#C0392B" strokeWidth={2} opacity={0.5}>
|
|
|
|
|
|
<animate attributeName="r" values="6;14" dur="1.5s" repeatCount="indefinite" />
|
|
|
|
|
|
<animate attributeName="opacity" values="0.5;0" dur="1.5s" repeatCount="indefinite" />
|
|
|
|
|
|
</circle>
|
|
|
|
|
|
<circle cx={statusCx} cy={cy} r={BADGE_R} fill="none" stroke="#C0392B" strokeWidth={2} opacity={0.5}>
|
|
|
|
|
|
<animate attributeName="r" values="6;14" dur="1.5s" begin="0.75s" repeatCount="indefinite" />
|
|
|
|
|
|
<animate attributeName="opacity" values="0.5;0" dur="1.5s" begin="0.75s" repeatCount="indefinite" />
|
|
|
|
|
|
</circle>
|
|
|
|
|
|
<circle cx={statusCx} cy={cy} r={BADGE_R} fill="#C0392B" />
|
|
|
|
|
|
<path d={`M${statusCx} ${cy - 3} v4 M${statusCx} ${cy + 2.5} v0.5`} fill="none" stroke="white" strokeWidth={1.5} strokeLinecap="round" />
|
|
|
|
|
|
</g>
|
|
|
|
|
|
);
|
|
|
|
|
|
slot++;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Tap badge (before status)
|
|
|
|
|
|
if (showTap) {
|
|
|
|
|
|
const tapCx = statusCx - slot * (BADGE_D + BADGE_GAP);
|
|
|
|
|
|
badges.push(
|
|
|
|
|
|
<g key="tap">
|
|
|
|
|
|
<circle cx={tapCx} cy={cy} r={BADGE_R} fill="#7C3AED" />
|
|
|
|
|
|
<g transform={`translate(${tapCx - 5}, ${cy - 5})`} stroke="white" strokeWidth={1.4} fill="none" strokeLinecap="round" strokeLinejoin="round">
|
|
|
|
|
|
<path d="M5 1 C5 1 2 4.5 2 6.5a3 3 0 006 0C8 4.5 5 1 5 1z" />
|
|
|
|
|
|
</g>
|
|
|
|
|
|
</g>
|
|
|
|
|
|
);
|
|
|
|
|
|
slot++;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Trace badge (leftmost)
|
|
|
|
|
|
if (showTrace) {
|
|
|
|
|
|
const traceCx = statusCx - slot * (BADGE_D + BADGE_GAP);
|
|
|
|
|
|
const tracePulse = overlayActive && executionState?.hasTraceData;
|
|
|
|
|
|
const traceHasData = executionState?.hasTraceData;
|
|
|
|
|
|
badges.push(
|
|
|
|
|
|
<g key="trace">
|
|
|
|
|
|
{tracePulse && (
|
|
|
|
|
|
<>
|
|
|
|
|
|
<circle cx={traceCx} cy={cy} r={BADGE_R} fill="none" stroke="#1A7F8E" strokeWidth={2} opacity={0.5}>
|
|
|
|
|
|
<animate attributeName="r" values={`${BADGE_R};${BADGE_R + 8}`} dur="1.5s" repeatCount="indefinite" />
|
|
|
|
|
|
<animate attributeName="opacity" values="0.5;0" dur="1.5s" repeatCount="indefinite" />
|
|
|
|
|
|
</circle>
|
|
|
|
|
|
<circle cx={traceCx} cy={cy} r={BADGE_R} fill="none" stroke="#1A7F8E" strokeWidth={2} opacity={0.5}>
|
|
|
|
|
|
<animate attributeName="r" values={`${BADGE_R};${BADGE_R + 8}`} dur="1.5s" begin="0.75s" repeatCount="indefinite" />
|
|
|
|
|
|
<animate attributeName="opacity" values="0.5;0" dur="1.5s" begin="0.75s" repeatCount="indefinite" />
|
|
|
|
|
|
</circle>
|
|
|
|
|
|
</>
|
|
|
|
|
|
)}
|
|
|
|
|
|
<circle cx={traceCx} cy={cy} r={BADGE_R} fill={traceHasData ? '#1A7F8E' : '#1A7F8E'} opacity={traceHasData ? 1 : 0.2} />
|
|
|
|
|
|
<g transform={`translate(${traceCx - 5}, ${cy - 5}) scale(${10/24})`} stroke={traceHasData ? 'white' : '#1A7F8E'} strokeWidth={2.4} fill="none" strokeLinecap="round" strokeLinejoin="round">
|
|
|
|
|
|
<path d="M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z" />
|
|
|
|
|
|
<path d="M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z" />
|
|
|
|
|
|
<path d="M16 17h4" />
|
|
|
|
|
|
<path d="M4 13h4" />
|
|
|
|
|
|
</g>
|
|
|
|
|
|
</g>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return <>{badges}</>;
|
|
|
|
|
|
})()}
|
2026-03-27 18:44:16 +01:00
|
|
|
|
|
|
|
|
|
|
{/* Execution overlay: duration text at bottom-right */}
|
|
|
|
|
|
{executionState && statusColor && (
|
|
|
|
|
|
<text
|
|
|
|
|
|
x={w - 6}
|
|
|
|
|
|
y={h - 4}
|
|
|
|
|
|
textAnchor="end"
|
|
|
|
|
|
fill={statusColor}
|
|
|
|
|
|
fontSize={9}
|
|
|
|
|
|
fontWeight={500}
|
|
|
|
|
|
>
|
|
|
|
|
|
{formatDuration(executionState.durationMs)}
|
|
|
|
|
|
</text>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
2026-03-29 23:32:42 +02:00
|
|
|
|
{/* Heatmap: avg duration label at bottom-right */}
|
|
|
|
|
|
{heatmapEntry && !overlayActive && !executionState && (
|
|
|
|
|
|
<text
|
|
|
|
|
|
x={w - 6}
|
|
|
|
|
|
y={h - 4}
|
|
|
|
|
|
textAnchor="end"
|
|
|
|
|
|
fill={heatmapBorderColor(heatmapEntry.pctOfRoute)}
|
|
|
|
|
|
fontSize={9}
|
|
|
|
|
|
fontWeight={600}
|
|
|
|
|
|
>
|
|
|
|
|
|
{formatDuration(heatmapEntry.avgDurationMs)}
|
|
|
|
|
|
</text>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
2026-03-27 18:44:16 +01:00
|
|
|
|
{/* Sub-route failure: drill-down arrow at bottom-left */}
|
|
|
|
|
|
{isFailed && executionState?.subRouteFailed && (
|
2026-03-27 23:16:39 +01:00
|
|
|
|
<g transform={`translate(4, ${h - 14})`}>
|
|
|
|
|
|
<path
|
|
|
|
|
|
d="M2 2 v5 a3 3 0 003 3 h5"
|
|
|
|
|
|
fill="none" stroke="#C0392B" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<path d="M8 8 l2 2 -2 2" fill="none" stroke="#C0392B" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round" />
|
|
|
|
|
|
</g>
|
2026-03-27 18:44:16 +01:00
|
|
|
|
)}
|
feat: add interactive ProcessDiagram SVG component (sub-project 1/3)
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>
2026-03-27 13:55:29 +01:00
|
|
|
|
</g>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|