Files
design-system/src/mocks/sidebar.ts

91 lines
2.4 KiB
TypeScript
Raw Normal View History

export interface SidebarRoute {
id: string
name: string
exchangeCount: number
}
export interface SidebarAgent {
id: string
name: string
status: 'live' | 'stale' | 'dead'
tps: number
}
export interface SidebarApp {
id: string
name: string
health: 'live' | 'stale' | 'dead'
exchangeCount: number
routes: SidebarRoute[]
agents: SidebarAgent[]
}
/** Build a routeId → appId lookup from the sidebar tree */
export function buildRouteToAppMap(apps: SidebarApp[] = SIDEBAR_APPS): Map<string, string> {
const map = new Map<string, string>()
for (const app of apps) {
for (const route of app.routes) {
map.set(route.id, app.id)
}
}
return map
}
export const SIDEBAR_APPS: SidebarApp[] = [
{
id: 'order-service',
name: 'order-service',
health: 'live',
exchangeCount: 1433,
routes: [
{ id: 'order-intake', name: 'order-intake', exchangeCount: 892 },
{ id: 'order-enrichment', name: 'order-enrichment', exchangeCount: 541 },
],
agents: [
{ id: 'ord-1', name: 'ord-1', status: 'live', tps: 14.2 },
{ id: 'ord-2', name: 'ord-2', status: 'live', tps: 11.8 },
{ id: 'ord-3', name: 'ord-3', status: 'live', tps: 8.4 },
],
},
{
id: 'payment-svc',
name: 'payment-svc',
health: 'live',
exchangeCount: 912,
routes: [
{ id: 'payment-process', name: 'payment-process', exchangeCount: 414 },
{ id: 'payment-validate', name: 'payment-validate', exchangeCount: 498 },
],
agents: [
{ id: 'pay-1', name: 'pay-1', status: 'live', tps: 9.7 },
{ id: 'pay-2', name: 'pay-2', status: 'stale', tps: 0.3 },
],
},
{
id: 'shipment-tracker',
name: 'shipment-tracker',
health: 'live',
exchangeCount: 471,
routes: [
{ id: 'shipment-dispatch', name: 'shipment-dispatch', exchangeCount: 387 },
{ id: 'shipment-track', name: 'shipment-track', exchangeCount: 923 },
],
agents: [
{ id: 'ship-1', name: 'ship-1', status: 'live', tps: 12.1 },
{ id: 'ship-2', name: 'ship-2', status: 'live', tps: 9.1 },
],
},
{
id: 'notification-hub',
name: 'notification-hub',
health: 'stale',
exchangeCount: 128,
routes: [
{ id: 'notification-dispatch', name: 'notification-dispatch', exchangeCount: 471 },
],
agents: [
{ id: 'notif-1', name: 'notif-1', status: 'dead', tps: 0 },
],
},
]