fix: simplify sidebar to Applications + Starred + Admin footer
All checks were successful
CI / cleanup-branch (push) Has been skipped
CI / build (push) Successful in 1m7s
CI / docker (push) Successful in 59s
CI / deploy-feature (push) Has been skipped
CI / deploy (push) Successful in 42s

Remove Agents and Routes sections from sidebar. Layout is now:
Header (camel logo + Cameleer) → Search → Applications section →
Starred section (when items exist) → Footer (Admin + API Docs).

Admin accordion: clicking Admin navigates to /admin/rbac and
expands Admin section at top while collapsing Applications and
Starred. Clicking Applications exits admin mode.

Removed buildAgentTreeNodes and buildRouteTreeNodes from
sidebar-utils (no longer needed).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-02 22:29:44 +02:00
parent e495b80432
commit b676450995
2 changed files with 118 additions and 199 deletions

View File

@@ -12,20 +12,12 @@ export interface SidebarRoute {
routeState?: 'stopped' | 'suspended';
}
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[];
}
/* ------------------------------------------------------------------ */
@@ -101,67 +93,6 @@ export function buildAppTreeNodes(
}));
}
/**
* Agents tree — one node per app, agents as children.
* Paths: /agents/{appId}, /agents/{appId}/{agentId}
* Badge shows "N/M live".
*/
export function buildAgentTreeNodes(
apps: SidebarApp[],
statusDot: (health: string) => ReactNode,
): SidebarTreeNode[] {
return apps.map((app) => {
const liveCount = app.agents.filter((a) => a.status === 'live').length;
return {
id: `agent:${app.id}`,
label: app.name,
icon: statusDot(app.health),
badge: `${liveCount}/${app.agents.length} live`,
path: `/agents/${app.id}`,
children: app.agents.map((a) => ({
id: `agent:${app.id}/${a.id}`,
label: a.name,
icon: statusDot(a.status),
badge: a.tps != null ? `${a.tps.toFixed(1)} msg/s` : undefined,
path: `/agents/${app.id}/${a.id}`,
})),
};
});
}
/**
* Routes stats tree — one node per app, routes as children.
* Paths: /routes/{appId}, /routes/{appId}/{routeId}
*/
export function buildRouteTreeNodes(
apps: SidebarApp[],
statusDot: (health: string) => ReactNode,
chevron: () => ReactNode,
stopIcon?: () => ReactNode,
pauseIcon?: () => ReactNode,
): SidebarTreeNode[] {
return apps.map((app) => ({
id: `route:${app.id}`,
label: app.name,
icon: statusDot(app.health),
badge: `${app.routes.length} routes`,
path: `/routes/${app.id}`,
children: app.routes.map((r) => ({
id: `route:${app.id}/${r.id}`,
label: r.name,
icon: r.routeState === 'stopped' && stopIcon
? stopIcon()
: r.routeState === 'suspended' && pauseIcon
? pauseIcon()
: chevron(),
badge: r.routeState
? `${r.routeState.toUpperCase()} \u00b7 ${formatCount(r.exchangeCount)}`
: formatCount(r.exchangeCount),
path: `/routes/${app.id}/${r.id}`,
})),
}));
}
/**
* Admin tree — static 6 nodes.
*/