diff --git a/src/components/layout/Sidebar.test.tsx b/src/components/layout/Sidebar.test.tsx index 69df9c8..e6ae485 100644 --- a/src/components/layout/Sidebar.test.tsx +++ b/src/components/layout/Sidebar.test.tsx @@ -127,6 +127,21 @@ describe("AppSidebar", () => { expect(screen.getByRole("button", { name: "Settings" })).toHaveAttribute("data-active", "true"); }); + it("does not render hidden nav items (Playground, Agents, REST API, gRPC)", () => { + mockUseRouter.mockReturnValue({ + path: "/app/", + params: {}, + navigate: mockNavigate, + }); + + renderSidebar(); + + expect(screen.queryByRole("button", { name: "Playground" })).not.toBeInTheDocument(); + expect(screen.queryByRole("button", { name: "Agents" })).not.toBeInTheDocument(); + expect(screen.queryByRole("button", { name: "REST API" })).not.toBeInTheDocument(); + expect(screen.queryByRole("button", { name: "gRPC" })).not.toBeInTheDocument(); + }); + it("does not render the Administration section for platform admin users", () => { mockUseRouter.mockReturnValue({ path: "/app/", diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx index cc620e1..cf52792 100644 --- a/src/components/layout/Sidebar.tsx +++ b/src/components/layout/Sidebar.tsx @@ -34,19 +34,25 @@ interface NavItem { labelKey: string; path: string; icon: React.ComponentType<{ className?: string }>; + hidden?: boolean; } const MAIN_NAV_ITEMS: NavItem[] = [ { labelKey: "navigation.dashboard", path: "/app/", icon: House }, { labelKey: "navigation.virtualServers", path: "/app/gateways", icon: Server }, - { labelKey: "navigation.playground", path: "/app/playground", icon: MessageSquareMore }, + { + labelKey: "navigation.playground", + path: "/app/playground", + icon: MessageSquareMore, + hidden: true, + }, ]; const COMPONENTS_NAV_ITEMS: NavItem[] = [ { labelKey: "navigation.servers", path: "/app/servers", icon: MCPIcon }, - { labelKey: "navigation.agents", path: "/app/agents", icon: AgentIcon }, - { labelKey: "navigation.restApi", path: "/app/rest-api", icon: Code }, - { labelKey: "navigation.grpc", path: "/app/grpc", icon: Unplug }, + { labelKey: "navigation.agents", path: "/app/agents", icon: AgentIcon, hidden: true }, + { labelKey: "navigation.restApi", path: "/app/rest-api", icon: Code, hidden: true }, + { labelKey: "navigation.grpc", path: "/app/grpc", icon: Unplug, hidden: true }, { labelKey: "navigation.tools", path: "/app/tools", icon: Wrench }, { labelKey: "navigation.resources", path: "/app/resources", icon: Box }, { labelKey: "navigation.prompts", path: "/app/prompts", icon: MessageSquareCode }, @@ -68,17 +74,19 @@ export function AppSidebar() { const { path, navigate } = useRouter(); const renderNavItems = (items: NavItem[]) => { - return items.map(({ labelKey, path: itemPath, icon: Icon }) => { - const isActive = path === itemPath || (itemPath !== "/app/" && path.startsWith(itemPath)); - return ( - - navigate(itemPath)}> - - {intl.formatMessage({ id: labelKey })} - - - ); - }); + return items + .filter((item) => !item.hidden) + .map(({ labelKey, path: itemPath, icon: Icon }) => { + const isActive = path === itemPath || (itemPath !== "/app/" && path.startsWith(itemPath)); + return ( + + navigate(itemPath)}> + + {intl.formatMessage({ id: labelKey })} + + + ); + }); }; return (