fix: align all pages with design system mocks — stat cards, tables, detail panels
Dashboard: correct stat card labels (Exchanges/Success Rate/Errors/Throughput/Latency p99), add detail text, trends, sparklines on all cards, Agent column, LIVE badge, expanded detail panel with Agent/Correlation/Timestamp, "Open full details" link. Agent Health: per-group meta (TPS/routes) in GroupCard header, proper HTML table with column headers for instance list. Agent Instance: stat card detail props (heap info, start date), scope trail with inline status/version/routes badges. Routes: 5th In-Flight stat card, enriched stat card props (detail/trend/sparkline), SLA threshold line on latency chart. Exchange Detail: Agent stat box in header. Also: vite proxy CORS fix, cross-env dev scripts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
26
ui/package-lock.json
generated
26
ui/package-lock.json
generated
@@ -24,6 +24,7 @@
|
|||||||
"@types/react": "^19.2.14",
|
"@types/react": "^19.2.14",
|
||||||
"@types/react-dom": "^19.2.3",
|
"@types/react-dom": "^19.2.3",
|
||||||
"@vitejs/plugin-react": "^6.0.0",
|
"@vitejs/plugin-react": "^6.0.0",
|
||||||
|
"cross-env": "^10.1.0",
|
||||||
"eslint": "^9.39.4",
|
"eslint": "^9.39.4",
|
||||||
"eslint-plugin-react-hooks": "^7.0.1",
|
"eslint-plugin-react-hooks": "^7.0.1",
|
||||||
"eslint-plugin-react-refresh": "^0.5.2",
|
"eslint-plugin-react-refresh": "^0.5.2",
|
||||||
@@ -323,6 +324,13 @@
|
|||||||
"tslib": "^2.4.0"
|
"tslib": "^2.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@epic-web/invariant": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@epic-web/invariant/-/invariant-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@eslint-community/eslint-utils": {
|
"node_modules/@eslint-community/eslint-utils": {
|
||||||
"version": "4.9.1",
|
"version": "4.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz",
|
||||||
@@ -1629,6 +1637,24 @@
|
|||||||
"url": "https://opencollective.com/express"
|
"url": "https://opencollective.com/express"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/cross-env": {
|
||||||
|
"version": "10.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-10.1.0.tgz",
|
||||||
|
"integrity": "sha512-GsYosgnACZTADcmEyJctkJIoqAhHjttw7RsFrVoJNXbsWWqaq6Ym+7kZjq6mS45O0jij6vtiReppKQEtqWy6Dw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@epic-web/invariant": "^1.0.0",
|
||||||
|
"cross-spawn": "^7.0.6"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"cross-env": "dist/bin/cross-env.js",
|
||||||
|
"cross-env-shell": "dist/bin/cross-env-shell.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/cross-spawn": {
|
"node_modules/cross-spawn": {
|
||||||
"version": "7.0.6",
|
"version": "7.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
"dev:local": "cross-env VITE_API_TARGET=http://localhost:8081 vite",
|
||||||
|
"dev:remote": "cross-env VITE_API_TARGET=http://192.168.50.86:30090 vite",
|
||||||
"build": "tsc -p tsconfig.app.json --noEmit && vite build",
|
"build": "tsc -p tsconfig.app.json --noEmit && vite build",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
@@ -28,6 +30,7 @@
|
|||||||
"@types/react": "^19.2.14",
|
"@types/react": "^19.2.14",
|
||||||
"@types/react-dom": "^19.2.3",
|
"@types/react-dom": "^19.2.3",
|
||||||
"@vitejs/plugin-react": "^6.0.0",
|
"@vitejs/plugin-react": "^6.0.0",
|
||||||
|
"cross-env": "^10.1.0",
|
||||||
"eslint": "^9.39.4",
|
"eslint": "^9.39.4",
|
||||||
"eslint-plugin-react-hooks": "^7.0.1",
|
"eslint-plugin-react-hooks": "^7.0.1",
|
||||||
"eslint-plugin-react-refresh": "^0.5.2",
|
"eslint-plugin-react-refresh": "^0.5.2",
|
||||||
|
|||||||
@@ -19,15 +19,54 @@
|
|||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.instanceRow {
|
/* GroupCard meta strip */
|
||||||
|
.groupMeta {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
gap: 16px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
font-size: 12px;
|
||||||
padding: 8px 12px;
|
color: var(--text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.groupMeta strong {
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Instance table */
|
||||||
|
.instanceTable {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.instanceTable thead tr {
|
||||||
|
border-bottom: 1px solid var(--border-subtle);
|
||||||
|
}
|
||||||
|
|
||||||
|
.instanceTable thead th {
|
||||||
|
padding: 6px 8px;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text-muted);
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thStatus {
|
||||||
|
width: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tdStatus {
|
||||||
|
width: 24px;
|
||||||
|
padding: 0 4px 0 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.instanceRow {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background 0.1s;
|
transition: background 0.1s;
|
||||||
border-bottom: 1px solid var(--border-subtle);
|
border-bottom: 1px solid var(--border-subtle);
|
||||||
font-size: 12px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.instanceRow:last-child {
|
.instanceRow:last-child {
|
||||||
@@ -38,6 +77,15 @@
|
|||||||
background: var(--bg-hover);
|
background: var(--bg-hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.instanceRow td {
|
||||||
|
padding: 7px 8px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.instanceRowActive {
|
||||||
|
background: var(--bg-selected, var(--bg-hover));
|
||||||
|
}
|
||||||
|
|
||||||
.instanceName {
|
.instanceName {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
@@ -49,6 +97,24 @@
|
|||||||
font-family: var(--font-mono);
|
font-family: var(--font-mono);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.instanceError {
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--error);
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
}
|
||||||
|
|
||||||
|
.instanceHeartbeatDead {
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--error);
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
}
|
||||||
|
|
||||||
|
.instanceHeartbeatStale {
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--warning);
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
}
|
||||||
|
|
||||||
.instanceLink {
|
.instanceLink {
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|||||||
@@ -246,43 +246,102 @@ export default function AgentHealth() {
|
|||||||
<div className={styles.groupGrid}>
|
<div className={styles.groupGrid}>
|
||||||
{Object.entries(apps).map(([group, groupAgents]) => {
|
{Object.entries(apps).map(([group, groupAgents]) => {
|
||||||
const deadInGroup = (groupAgents || []).filter((a: any) => a.status === 'DEAD');
|
const deadInGroup = (groupAgents || []).filter((a: any) => a.status === 'DEAD');
|
||||||
|
const groupTps = (groupAgents || []).reduce((s: number, a: any) => s + (a.tps || 0), 0);
|
||||||
|
const groupActiveRoutes = (groupAgents || []).reduce((s: number, a: any) => s + (a.activeRoutes || 0), 0);
|
||||||
|
const groupTotalRoutes = (groupAgents || []).reduce((s: number, a: any) => s + (a.totalRoutes || 0), 0);
|
||||||
|
const liveInGroup = (groupAgents || []).filter((a: any) => a.status === 'LIVE').length;
|
||||||
return (
|
return (
|
||||||
<GroupCard
|
<GroupCard
|
||||||
key={group}
|
key={group}
|
||||||
title={group}
|
title={group}
|
||||||
headerRight={<Badge label={`${groupAgents?.length ?? 0} instances`} />}
|
headerRight={
|
||||||
|
<Badge
|
||||||
|
label={`${liveInGroup}/${groupAgents?.length ?? 0} LIVE`}
|
||||||
|
color={
|
||||||
|
groupAgents?.some((a: any) => a.status === 'DEAD') ? 'error'
|
||||||
|
: groupAgents?.some((a: any) => a.status === 'STALE') ? 'warning'
|
||||||
|
: 'success'
|
||||||
|
}
|
||||||
|
variant="filled"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
meta={
|
||||||
|
<div className={styles.groupMeta}>
|
||||||
|
<span><strong>{groupTps.toFixed(1)}</strong> msg/s</span>
|
||||||
|
<span><strong>{groupActiveRoutes}</strong>/{groupTotalRoutes} routes</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
accent={
|
accent={
|
||||||
groupAgents?.some((a: any) => a.status === 'DEAD') ? 'error'
|
groupAgents?.some((a: any) => a.status === 'DEAD') ? 'error'
|
||||||
: groupAgents?.some((a: any) => a.status === 'STALE') ? 'warning'
|
: groupAgents?.some((a: any) => a.status === 'STALE') ? 'warning'
|
||||||
: 'success'
|
: 'success'
|
||||||
}
|
}
|
||||||
onClick={() => navigate(`/agents/${group}`)}
|
|
||||||
>
|
>
|
||||||
{deadInGroup.length > 0 && (
|
{deadInGroup.length > 0 && (
|
||||||
<Alert variant="error">{deadInGroup.length} instance(s) unreachable</Alert>
|
<Alert variant="error">{deadInGroup.length} instance(s) unreachable</Alert>
|
||||||
)}
|
)}
|
||||||
{(groupAgents || []).map((agent: any) => (
|
<table className={styles.instanceTable}>
|
||||||
<div
|
<thead>
|
||||||
key={agent.id}
|
<tr>
|
||||||
className={styles.instanceRow}
|
<th className={styles.thStatus} />
|
||||||
onClick={(e) => {
|
<th>Instance</th>
|
||||||
e.stopPropagation();
|
<th>State</th>
|
||||||
setSelectedAgent(agent);
|
<th>Uptime</th>
|
||||||
navigate(`/agents/${group}/${agent.id}`);
|
<th>TPS</th>
|
||||||
}}
|
<th>Errors</th>
|
||||||
>
|
<th>Heartbeat</th>
|
||||||
<StatusDot variant={agent.status === 'LIVE' ? 'live' : agent.status === 'STALE' ? 'stale' : 'dead'} />
|
</tr>
|
||||||
<span className={styles.instanceName}>{agent.name}</span>
|
</thead>
|
||||||
<Badge label={agent.status} color={agent.status === 'LIVE' ? 'success' : agent.status === 'STALE' ? 'warning' : 'error'} />
|
<tbody>
|
||||||
<span className={styles.instanceMeta}>{formatUptime(agent.uptimeSeconds)}</span>
|
{(groupAgents || []).map((agent: any) => (
|
||||||
{agent.tps != null && <span className={styles.instanceMeta}>{(agent.tps || 0).toFixed(1)} tps</span>}
|
<tr
|
||||||
{agent.errorRate != null && (
|
key={agent.id}
|
||||||
<span className={styles.instanceMeta}>{(agent.errorRate * 100).toFixed(1)}% err</span>
|
className={[
|
||||||
)}
|
styles.instanceRow,
|
||||||
<span className={styles.instanceMeta}>{formatRelativeTime(agent.lastHeartbeat)}</span>
|
selectedAgent?.id === agent.id ? styles.instanceRowActive : '',
|
||||||
<span className={styles.instanceLink} aria-label="View instance">›</span>
|
].filter(Boolean).join(' ')}
|
||||||
</div>
|
onClick={() => {
|
||||||
))}
|
setSelectedAgent(agent);
|
||||||
|
navigate(`/agents/${group}/${agent.id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<td className={styles.tdStatus}>
|
||||||
|
<StatusDot variant={agent.status === 'LIVE' ? 'live' : agent.status === 'STALE' ? 'stale' : 'dead'} />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<MonoText size="sm" className={styles.instanceName}>{agent.name ?? agent.id}</MonoText>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Badge
|
||||||
|
label={agent.status}
|
||||||
|
color={agent.status === 'LIVE' ? 'success' : agent.status === 'STALE' ? 'warning' : 'error'}
|
||||||
|
variant="filled"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span className={styles.instanceMeta}>{formatUptime(agent.uptimeSeconds)}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span className={styles.instanceMeta}>{agent.tps != null ? `${(agent.tps as number).toFixed(1)}/s` : '—'}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span className={agent.errorRate != null ? styles.instanceError : styles.instanceMeta}>
|
||||||
|
{agent.errorRate != null ? `${((agent.errorRate as number) * 100).toFixed(1)}%` : '—'}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span className={
|
||||||
|
agent.status === 'DEAD' ? styles.instanceHeartbeatDead
|
||||||
|
: agent.status === 'STALE' ? styles.instanceHeartbeatStale
|
||||||
|
: styles.instanceMeta
|
||||||
|
}>
|
||||||
|
{formatRelativeTime(agent.lastHeartbeat)}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</GroupCard>
|
</GroupCard>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -110,6 +110,35 @@
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scopeTrail {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
font-size: 13px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scopeLink {
|
||||||
|
color: var(--text-accent, var(--text-primary));
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scopeLink:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scopeSep {
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scopeCurrent {
|
||||||
|
color: var(--text-primary);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
.paneTitle {
|
.paneTitle {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
|||||||
@@ -122,10 +122,35 @@ export default function AgentInstance() {
|
|||||||
|
|
||||||
<div className={styles.statStrip}>
|
<div className={styles.statStrip}>
|
||||||
<StatCard label="CPU" value={cpuPct != null ? `${(cpuPct * 100).toFixed(0)}%` : '—'} />
|
<StatCard label="CPU" value={cpuPct != null ? `${(cpuPct * 100).toFixed(0)}%` : '—'} />
|
||||||
<StatCard label="Memory" value={memPct != null ? `${memPct.toFixed(0)}%` : '—'} />
|
<StatCard
|
||||||
|
label="Memory"
|
||||||
|
value={memPct != null ? `${memPct.toFixed(0)}%` : '—'}
|
||||||
|
detail={heapUsed != null && heapMax != null ? `${(heapUsed / (1024 * 1024)).toFixed(0)} MB / ${(heapMax / (1024 * 1024)).toFixed(0)} MB` : undefined}
|
||||||
|
/>
|
||||||
<StatCard label="Throughput" value={agent?.tps != null ? `${agent.tps.toFixed(1)}/s` : '—'} />
|
<StatCard label="Throughput" value={agent?.tps != null ? `${agent.tps.toFixed(1)}/s` : '—'} />
|
||||||
<StatCard label="Errors" value={agent?.errorRate != null ? `${(agent.errorRate * 100).toFixed(1)}%` : '—'} accent={agent?.errorRate > 0 ? 'error' : undefined} />
|
<StatCard label="Errors" value={agent?.errorRate != null ? `${(agent.errorRate * 100).toFixed(1)}%` : '—'} accent={agent?.errorRate > 0 ? 'error' : undefined} />
|
||||||
<StatCard label="Uptime" value={formatUptime(agent?.uptimeSeconds)} />
|
<StatCard
|
||||||
|
label="Uptime"
|
||||||
|
value={formatUptime(agent?.uptimeSeconds)}
|
||||||
|
detail={agent?.registeredAt ? `since ${new Date(agent.registeredAt).toLocaleDateString()}` : undefined}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.scopeTrail}>
|
||||||
|
<a href="/agents" className={styles.scopeLink}>All Agents</a>
|
||||||
|
<span className={styles.scopeSep}>▸</span>
|
||||||
|
<a href={`/agents/${appId}`} className={styles.scopeLink}>{appId}</a>
|
||||||
|
<span className={styles.scopeSep}>▸</span>
|
||||||
|
<span className={styles.scopeCurrent}>{agent.name}</span>
|
||||||
|
<Badge
|
||||||
|
label={agent.status.toUpperCase()}
|
||||||
|
color={agent.status === 'LIVE' ? 'success' : agent.status === 'STALE' ? 'warning' : 'error'}
|
||||||
|
/>
|
||||||
|
{agent.version && <Badge label={agent.version} variant="outlined" />}
|
||||||
|
<Badge
|
||||||
|
label={`${agent.activeRoutes ?? (agent.routeIds?.length ?? 0)}/${agent.totalRoutes ?? (agent.routeIds?.length ?? 0)} routes`}
|
||||||
|
color={(agent.activeRoutes ?? 0) < (agent.totalRoutes ?? 0) ? 'warning' : 'success'}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Card className={styles.infoCard}>
|
<Card className={styles.infoCard}>
|
||||||
|
|||||||
@@ -82,3 +82,19 @@
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
padding-top: 2px;
|
padding-top: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.openDetailLink {
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--accent, #c6820e);
|
||||||
|
cursor: pointer;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.openDetailLink:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,20 +1,28 @@
|
|||||||
import { useState, useMemo } from 'react';
|
import { useState, useMemo } from 'react';
|
||||||
import { useParams } from 'react-router';
|
import { useParams, useNavigate } from 'react-router';
|
||||||
import {
|
import {
|
||||||
StatCard, StatusDot, Badge, MonoText, Sparkline,
|
StatCard, StatusDot, Badge, MonoText,
|
||||||
DataTable, DetailPanel, ProcessorTimeline, RouteFlow,
|
DataTable, DetailPanel, ProcessorTimeline, RouteFlow,
|
||||||
Alert, Collapsible, CodeBlock,
|
Alert, Collapsible, CodeBlock, ShortcutsBar,
|
||||||
} from '@cameleer/design-system';
|
} from '@cameleer/design-system';
|
||||||
import type { Column } from '@cameleer/design-system';
|
import type { Column } from '@cameleer/design-system';
|
||||||
import { useSearchExecutions, useExecutionStats, useStatsTimeseries, useExecutionDetail, useProcessorSnapshot } from '../../api/queries/executions';
|
import { useSearchExecutions, useExecutionStats, useStatsTimeseries, useExecutionDetail, useProcessorSnapshot } from '../../api/queries/executions';
|
||||||
|
import { useDiagramByRoute } from '../../api/queries/diagrams';
|
||||||
import { useGlobalFilters } from '@cameleer/design-system';
|
import { useGlobalFilters } from '@cameleer/design-system';
|
||||||
import type { ExecutionSummary } from '../../api/types';
|
import type { ExecutionSummary } from '../../api/types';
|
||||||
|
import { mapDiagramToRouteNodes } from '../../utils/diagram-mapping';
|
||||||
import styles from './Dashboard.module.css';
|
import styles from './Dashboard.module.css';
|
||||||
|
|
||||||
interface Row extends ExecutionSummary { id: string }
|
interface Row extends ExecutionSummary { id: string }
|
||||||
|
|
||||||
|
function formatDuration(ms: number): string {
|
||||||
|
if (ms < 1000) return `${ms}ms`;
|
||||||
|
return `${(ms / 1000).toFixed(1)}s`;
|
||||||
|
}
|
||||||
|
|
||||||
export default function Dashboard() {
|
export default function Dashboard() {
|
||||||
const { appId, routeId } = useParams();
|
const { appId, routeId } = useParams();
|
||||||
|
const navigate = useNavigate();
|
||||||
const { timeRange } = useGlobalFilters();
|
const { timeRange } = useGlobalFilters();
|
||||||
const timeFrom = timeRange.start.toISOString();
|
const timeFrom = timeRange.start.toISOString();
|
||||||
const timeTo = timeRange.end.toISOString();
|
const timeTo = timeRange.end.toISOString();
|
||||||
@@ -35,29 +43,58 @@ export default function Dashboard() {
|
|||||||
}, true);
|
}, true);
|
||||||
const { data: detail } = useExecutionDetail(selectedId);
|
const { data: detail } = useExecutionDetail(selectedId);
|
||||||
const { data: snapshot } = useProcessorSnapshot(selectedId, processorIdx);
|
const { data: snapshot } = useProcessorSnapshot(selectedId, processorIdx);
|
||||||
|
const { data: diagram } = useDiagramByRoute(detail?.groupName, detail?.routeId);
|
||||||
|
|
||||||
const rows: Row[] = useMemo(() =>
|
const rows: Row[] = useMemo(() =>
|
||||||
(searchResult?.data || []).map((e: ExecutionSummary) => ({ ...e, id: e.executionId })),
|
(searchResult?.data || []).map((e: ExecutionSummary) => ({ ...e, id: e.executionId })),
|
||||||
[searchResult],
|
[searchResult],
|
||||||
);
|
);
|
||||||
|
|
||||||
const sparklineData = useMemo(() =>
|
const totalCount = stats?.totalCount ?? 0;
|
||||||
(timeseries?.buckets || []).map((b: any) => b.totalCount as number),
|
const failedCount = stats?.failedCount ?? 0;
|
||||||
[timeseries],
|
const successRate = totalCount > 0 ? ((totalCount - failedCount) / totalCount * 100) : 100;
|
||||||
);
|
const throughput = timeWindowSeconds > 0 ? totalCount / timeWindowSeconds : 0;
|
||||||
|
|
||||||
|
const sparkExchanges = useMemo(() =>
|
||||||
|
(timeseries?.buckets || []).map((b: any) => b.totalCount as number), [timeseries]);
|
||||||
|
const sparkErrors = useMemo(() =>
|
||||||
|
(timeseries?.buckets || []).map((b: any) => b.failedCount as number), [timeseries]);
|
||||||
|
const sparkLatency = useMemo(() =>
|
||||||
|
(timeseries?.buckets || []).map((b: any) => b.p99DurationMs as number), [timeseries]);
|
||||||
|
const sparkThroughput = useMemo(() =>
|
||||||
|
(timeseries?.buckets || []).map((b: any) => {
|
||||||
|
const bucketSeconds = timeWindowSeconds / Math.max((timeseries?.buckets || []).length, 1);
|
||||||
|
return bucketSeconds > 0 ? (b.totalCount as number) / bucketSeconds : 0;
|
||||||
|
}), [timeseries, timeWindowSeconds]);
|
||||||
|
|
||||||
|
const prevTotal = stats?.prevTotalCount ?? 0;
|
||||||
|
const prevFailed = stats?.prevFailedCount ?? 0;
|
||||||
|
const exchangeTrend = prevTotal > 0 ? ((totalCount - prevTotal) / prevTotal * 100) : 0;
|
||||||
|
const prevSuccessRate = prevTotal > 0 ? ((prevTotal - prevFailed) / prevTotal * 100) : 100;
|
||||||
|
const successRateDelta = successRate - prevSuccessRate;
|
||||||
|
const errorDelta = failedCount - prevFailed;
|
||||||
|
|
||||||
const columns: Column<Row>[] = [
|
const columns: Column<Row>[] = [
|
||||||
{
|
{
|
||||||
key: 'status', header: 'Status', width: '80px',
|
key: 'status', header: 'Status', width: '80px',
|
||||||
render: (v) => <StatusDot variant={v === 'COMPLETED' ? 'success' : v === 'FAILED' ? 'error' : 'running'} />,
|
render: (v, row) => (
|
||||||
|
<span style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||||
|
<StatusDot variant={v === 'COMPLETED' ? 'success' : v === 'FAILED' ? 'error' : 'running'} />
|
||||||
|
<MonoText size="xs">{v === 'COMPLETED' ? 'OK' : v === 'FAILED' ? 'ERR' : 'RUN'}</MonoText>
|
||||||
|
</span>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{ key: 'routeId', header: 'Route', render: (v) => <MonoText size="sm">{String(v)}</MonoText> },
|
{ key: 'routeId', header: 'Route', sortable: true, render: (v) => <span>{String(v)}</span> },
|
||||||
{ key: 'groupName', header: 'App', render: (v) => <Badge label={String(v)} color="auto" /> },
|
{ key: 'groupName', header: 'Application', sortable: true, render: (v) => <span>{String(v ?? '')}</span> },
|
||||||
{ key: 'executionId', header: 'Exchange ID', render: (v) => <MonoText size="xs">{String(v).slice(0, 12)}</MonoText> },
|
{ key: 'executionId', header: 'Exchange ID', sortable: true, render: (v) => <MonoText size="xs">{String(v)}</MonoText> },
|
||||||
{ key: 'startTime', header: 'Started', sortable: true, render: (v) => new Date(v as string).toLocaleTimeString() },
|
{ key: 'startTime', header: 'Started', sortable: true, render: (v) => <MonoText size="xs">{new Date(v as string).toISOString().replace('T', ' ').slice(0, 19)}</MonoText> },
|
||||||
{
|
{
|
||||||
key: 'durationMs', header: 'Duration', sortable: true,
|
key: 'durationMs', header: 'Duration', sortable: true,
|
||||||
render: (v) => `${v}ms`,
|
render: (v) => <MonoText size="sm">{formatDuration(v as number)}</MonoText>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'agentId', header: 'Agent',
|
||||||
|
render: (v) => v ? <Badge label={String(v)} color="auto" /> : null,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -67,23 +104,42 @@ export default function Dashboard() {
|
|||||||
content: (
|
content: (
|
||||||
<>
|
<>
|
||||||
<div className={styles.panelSection}>
|
<div className={styles.panelSection}>
|
||||||
<div className={styles.panelSectionTitle}>Details</div>
|
<button
|
||||||
|
className={styles.openDetailLink}
|
||||||
|
onClick={() => navigate(`/exchanges/${detail.executionId}`)}
|
||||||
|
>
|
||||||
|
Open full details →
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className={styles.panelSection}>
|
||||||
|
<div className={styles.panelSectionTitle}>Overview</div>
|
||||||
<div className={styles.overviewGrid}>
|
<div className={styles.overviewGrid}>
|
||||||
<div className={styles.overviewRow}>
|
<div className={styles.overviewRow}>
|
||||||
<span className={styles.overviewLabel}>Exchange ID</span>
|
<span className={styles.overviewLabel}>Status</span>
|
||||||
<MonoText size="sm">{detail.executionId}</MonoText>
|
<span style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||||
|
<StatusDot variant={detail.status === 'COMPLETED' ? 'success' : 'error'} />
|
||||||
|
<span>{detail.status}</span>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.overviewRow}>
|
<div className={styles.overviewRow}>
|
||||||
<span className={styles.overviewLabel}>Status</span>
|
<span className={styles.overviewLabel}>Duration</span>
|
||||||
<Badge label={detail.status} color={detail.status === 'COMPLETED' ? 'success' : 'error'} />
|
<MonoText size="sm">{formatDuration(detail.durationMs)}</MonoText>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.overviewRow}>
|
<div className={styles.overviewRow}>
|
||||||
<span className={styles.overviewLabel}>Route</span>
|
<span className={styles.overviewLabel}>Route</span>
|
||||||
<span>{detail.routeId}</span>
|
<span>{detail.routeId}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.overviewRow}>
|
<div className={styles.overviewRow}>
|
||||||
<span className={styles.overviewLabel}>Duration</span>
|
<span className={styles.overviewLabel}>Agent</span>
|
||||||
<span>{detail.durationMs}ms</span>
|
<MonoText size="sm">{detail.agentId ?? '—'}</MonoText>
|
||||||
|
</div>
|
||||||
|
<div className={styles.overviewRow}>
|
||||||
|
<span className={styles.overviewLabel}>Correlation</span>
|
||||||
|
<MonoText size="xs">{detail.correlationId ?? '—'}</MonoText>
|
||||||
|
</div>
|
||||||
|
<div className={styles.overviewRow}>
|
||||||
|
<span className={styles.overviewLabel}>Timestamp</span>
|
||||||
|
<MonoText size="xs">{detail.startTime ? new Date(detail.startTime).toISOString().replace('T', ' ').slice(0, 19) : '—'}</MonoText>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -118,42 +174,71 @@ export default function Dashboard() {
|
|||||||
) : <div style={{ padding: '1rem' }}>No processor data</div>;
|
) : <div style={{ padding: '1rem' }}>No processor data</div>;
|
||||||
})(),
|
})(),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Route Flow', value: 'flow',
|
||||||
|
content: diagram ? (
|
||||||
|
<RouteFlow
|
||||||
|
nodes={mapDiagramToRouteNodes(
|
||||||
|
diagram.nodes || [],
|
||||||
|
detail.processors?.length ? detail.processors : (detail.children ?? [])
|
||||||
|
)}
|
||||||
|
onNodeClick={(_node, _i) => { /* optionally select processor */ }}
|
||||||
|
/>
|
||||||
|
) : <div style={{ padding: '1rem' }}>No diagram available</div>,
|
||||||
|
},
|
||||||
] : [];
|
] : [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className={styles.healthStrip}>
|
<div className={styles.healthStrip}>
|
||||||
<StatCard
|
<StatCard
|
||||||
label="Throughput"
|
label="Exchanges"
|
||||||
value={timeWindowSeconds > 0 ? `${((stats?.totalCount ?? 0) / timeWindowSeconds).toFixed(2)} ex/s` : '0.00 ex/s'}
|
value={totalCount.toLocaleString()}
|
||||||
sparkline={sparklineData}
|
detail={`${successRate.toFixed(1)}% success rate`}
|
||||||
|
trend={exchangeTrend > 0 ? 'up' : exchangeTrend < 0 ? 'down' : 'neutral'}
|
||||||
|
trendValue={exchangeTrend > 0 ? `+${exchangeTrend.toFixed(0)}%` : `${exchangeTrend.toFixed(0)}%`}
|
||||||
|
sparkline={sparkExchanges}
|
||||||
|
accent="amber"
|
||||||
/>
|
/>
|
||||||
<StatCard
|
<StatCard
|
||||||
label="Error Rate"
|
label="Success Rate"
|
||||||
value={(stats?.totalCount ?? 0) > 0 ? `${((stats?.failedCount ?? 0) / stats!.totalCount * 100).toFixed(1)}%` : '0.0%'}
|
value={`${successRate.toFixed(1)}%`}
|
||||||
|
detail={`${(totalCount - failedCount).toLocaleString()} ok / ${failedCount} error`}
|
||||||
|
trend={successRateDelta >= 0 ? 'up' : 'down'}
|
||||||
|
trendValue={`${successRateDelta >= 0 ? '+' : ''}${successRateDelta.toFixed(1)}%`}
|
||||||
|
accent="success"
|
||||||
|
/>
|
||||||
|
<StatCard
|
||||||
|
label="Errors"
|
||||||
|
value={failedCount}
|
||||||
|
detail={`${failedCount} errors in selected period`}
|
||||||
|
trend={errorDelta > 0 ? 'up' : errorDelta < 0 ? 'down' : 'neutral'}
|
||||||
|
trendValue={errorDelta > 0 ? `+${errorDelta}` : `${errorDelta}`}
|
||||||
|
sparkline={sparkErrors}
|
||||||
accent="error"
|
accent="error"
|
||||||
/>
|
/>
|
||||||
<StatCard
|
<StatCard
|
||||||
label="Avg Latency"
|
label="Throughput"
|
||||||
value={`${stats?.avgDurationMs ?? 0}ms`}
|
value={throughput.toFixed(1)}
|
||||||
/>
|
detail={`${throughput.toFixed(1)} msg/s`}
|
||||||
<StatCard
|
sparkline={sparkThroughput}
|
||||||
label="P99 Latency"
|
|
||||||
value={`${stats?.p99LatencyMs ?? 0}ms`}
|
|
||||||
accent="warning"
|
|
||||||
/>
|
|
||||||
<StatCard
|
|
||||||
label="In-Flight"
|
|
||||||
value={stats?.activeCount ?? 0}
|
|
||||||
accent="running"
|
accent="running"
|
||||||
/>
|
/>
|
||||||
|
<StatCard
|
||||||
|
label="Latency p99"
|
||||||
|
value={stats?.p99LatencyMs ?? 0}
|
||||||
|
detail={`${stats?.p99LatencyMs ?? 0}ms`}
|
||||||
|
sparkline={sparkLatency}
|
||||||
|
accent="warning"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.tableSection}>
|
<div className={styles.tableSection}>
|
||||||
<div className={styles.tableHeader}>
|
<div className={styles.tableHeader}>
|
||||||
<span className={styles.tableTitle}>Recent Exchanges</span>
|
<span className={styles.tableTitle}>Recent Exchanges</span>
|
||||||
<div className={styles.tableRight}>
|
<div className={styles.tableRight}>
|
||||||
<span className={styles.tableMeta}>{rows.length} results</span>
|
<span className={styles.tableMeta}>{rows.length} of {searchResult?.total ?? 0} exchanges</span>
|
||||||
|
<Badge label="LIVE" color="success" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<DataTable
|
<DataTable
|
||||||
|
|||||||
@@ -68,6 +68,10 @@ export default function ExchangeDetail() {
|
|||||||
<div className={styles.headerStatLabel}>Duration</div>
|
<div className={styles.headerStatLabel}>Duration</div>
|
||||||
<div className={styles.headerStatValue}>{detail.durationMs}ms</div>
|
<div className={styles.headerStatValue}>{detail.durationMs}ms</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className={styles.headerStat}>
|
||||||
|
<div className={styles.headerStatLabel}>Agent</div>
|
||||||
|
<div className={styles.headerStatValue}>{detail.agentId}</div>
|
||||||
|
</div>
|
||||||
<div className={styles.headerStat}>
|
<div className={styles.headerStat}>
|
||||||
<div className={styles.headerStatLabel}>Processors</div>
|
<div className={styles.headerStatLabel}>Processors</div>
|
||||||
<div className={styles.headerStatValue}>{countProcessors(detail.processors || detail.children || [])}</div>
|
<div className={styles.headerStatValue}>{countProcessors(detail.processors || detail.children || [])}</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
.statStrip {
|
.statStrip {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(4, 1fr);
|
grid-template-columns: repeat(5, 1fr);
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,13 +81,84 @@ export default function RoutesMetrics() {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const errorRate = stats?.totalCount
|
||||||
|
? (((stats.failedCount ?? 0) / stats.totalCount) * 100)
|
||||||
|
: 0;
|
||||||
|
const prevErrorRate = stats?.prevTotalCount
|
||||||
|
? (((stats.prevFailedCount ?? 0) / stats.prevTotalCount) * 100)
|
||||||
|
: 0;
|
||||||
|
const errorTrend: 'up' | 'down' | 'neutral' = errorRate > prevErrorRate ? 'up' : errorRate < prevErrorRate ? 'down' : 'neutral';
|
||||||
|
const errorTrendValue = stats?.prevTotalCount
|
||||||
|
? `${Math.abs(errorRate - prevErrorRate).toFixed(2)}%`
|
||||||
|
: undefined;
|
||||||
|
|
||||||
|
const p99Ms = stats?.p99LatencyMs ?? 0;
|
||||||
|
const prevP99Ms = stats?.prevP99LatencyMs ?? 0;
|
||||||
|
const latencyTrend: 'up' | 'down' | 'neutral' = p99Ms > prevP99Ms ? 'up' : p99Ms < prevP99Ms ? 'down' : 'neutral';
|
||||||
|
const latencyTrendValue = prevP99Ms ? `${Math.abs(p99Ms - prevP99Ms)}ms` : undefined;
|
||||||
|
|
||||||
|
const totalCount = stats?.totalCount ?? 0;
|
||||||
|
const prevTotalCount = stats?.prevTotalCount ?? 0;
|
||||||
|
const throughputTrend: 'up' | 'down' | 'neutral' = totalCount > prevTotalCount ? 'up' : totalCount < prevTotalCount ? 'down' : 'neutral';
|
||||||
|
const throughputTrendValue = prevTotalCount
|
||||||
|
? `${Math.abs(((totalCount - prevTotalCount) / prevTotalCount) * 100).toFixed(0)}%`
|
||||||
|
: undefined;
|
||||||
|
|
||||||
|
const successRate = stats?.totalCount
|
||||||
|
? (((stats.totalCount - (stats.failedCount ?? 0)) / stats.totalCount) * 100)
|
||||||
|
: 100;
|
||||||
|
|
||||||
|
const activeCount = stats?.activeCount ?? 0;
|
||||||
|
|
||||||
|
const errorSparkline = (timeseries?.buckets || []).map((b: any) => b.failedCount as number);
|
||||||
|
const latencySparkline = (timeseries?.buckets || []).map((b: any) => b.p99DurationMs as number);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className={styles.statStrip}>
|
<div className={styles.statStrip}>
|
||||||
<StatCard label="Total Throughput" value={stats?.totalCount ?? 0} sparkline={sparklineData} />
|
<StatCard
|
||||||
<StatCard label="Error Rate" value={stats?.totalCount ? `${(((stats.failedCount ?? 0) / stats.totalCount) * 100).toFixed(1)}%` : '0%'} accent="error" />
|
label="Total Throughput"
|
||||||
<StatCard label="P99 Latency" value={`${stats?.p99LatencyMs ?? 0}ms`} accent="warning" />
|
value={totalCount.toLocaleString()}
|
||||||
<StatCard label="Success Rate" value={stats?.totalCount ? `${(((stats.totalCount - (stats.failedCount ?? 0)) / stats.totalCount) * 100).toFixed(1)}%` : '100%'} accent="success" />
|
detail="exchanges"
|
||||||
|
trend={throughputTrend}
|
||||||
|
trendValue={throughputTrendValue}
|
||||||
|
accent="amber"
|
||||||
|
sparkline={sparklineData}
|
||||||
|
/>
|
||||||
|
<StatCard
|
||||||
|
label="System Error Rate"
|
||||||
|
value={`${errorRate.toFixed(2)}%`}
|
||||||
|
detail={`${stats?.failedCount ?? 0} errors / ${totalCount.toLocaleString()} total`}
|
||||||
|
trend={errorTrend}
|
||||||
|
trendValue={errorTrendValue}
|
||||||
|
accent={errorRate < 1 ? 'success' : 'error'}
|
||||||
|
sparkline={errorSparkline}
|
||||||
|
/>
|
||||||
|
<StatCard
|
||||||
|
label="P99 Latency"
|
||||||
|
value={`${p99Ms}ms`}
|
||||||
|
detail={`Avg: ${stats?.avgDurationMs ?? 0}ms`}
|
||||||
|
trend={latencyTrend}
|
||||||
|
trendValue={latencyTrendValue}
|
||||||
|
accent={p99Ms > 300 ? 'error' : p99Ms > 200 ? 'warning' : 'success'}
|
||||||
|
sparkline={latencySparkline}
|
||||||
|
/>
|
||||||
|
<StatCard
|
||||||
|
label="Success Rate"
|
||||||
|
value={`${successRate.toFixed(1)}%`}
|
||||||
|
detail={`${activeCount} active routes`}
|
||||||
|
accent="success"
|
||||||
|
sparkline={sparklineData.map((v, i) => {
|
||||||
|
const failed = errorSparkline[i] ?? 0;
|
||||||
|
return v > 0 ? ((v - failed) / v) * 100 : 100;
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
<StatCard
|
||||||
|
label="In-Flight"
|
||||||
|
value={activeCount}
|
||||||
|
detail="active exchanges"
|
||||||
|
accent="amber"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.tableSection}>
|
<div className={styles.tableSection}>
|
||||||
@@ -111,7 +182,11 @@ export default function RoutesMetrics() {
|
|||||||
</div>
|
</div>
|
||||||
<div className={styles.chartCard}>
|
<div className={styles.chartCard}>
|
||||||
<div className={styles.chartTitle}>Latency</div>
|
<div className={styles.chartTitle}>Latency</div>
|
||||||
<LineChart series={[{ label: 'Latency', data: chartData.map((d: any, i: number) => ({ x: i, y: d.latency })) }]} height={200} />
|
<LineChart
|
||||||
|
series={[{ label: 'Latency', data: chartData.map((d: any, i: number) => ({ x: i, y: d.latency })) }]}
|
||||||
|
height={200}
|
||||||
|
threshold={{ value: 300, label: 'SLA 300ms' }}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.chartCard}>
|
<div className={styles.chartCard}>
|
||||||
<div className={styles.chartTitle}>Errors</div>
|
<div className={styles.chartTitle}>Errors</div>
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ export default defineConfig({
|
|||||||
target: apiTarget,
|
target: apiTarget,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
secure: false,
|
secure: false,
|
||||||
|
configure: (proxy) => {
|
||||||
|
proxy.on('proxyReq', (proxyReq) => {
|
||||||
|
proxyReq.removeHeader('origin');
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user