- Add GetMetrics method to MetricsClient interface and implement cluster metrics API - Add QuotaPrecheck service for validating resource quotas before deployment - Add auth DTO with role/permission models and auth handler tests - Add instance diagnostics: mounted NFS volumes, labels, annotations in pod diagnostics - Update workspace handler with GetWorkspace endpoint and shared-user list - Fix monitoring handler to use correct service method name - Add tail_lines fallback in instance handler for snake_case query params - Update nginx config for SSE log streaming support (no buffering) - Add comprehensive test coverage: auth_service_test, auth_handler_test, auth_dto_test, metrics_client_test, quota_precheck_test - Update error messages for quota validation and instance operations - ModifyModal: fix YAML lineWidth:0, modified keys summary, delta-only submit - InstanceCard: correctly disable scale-minus when replicas <= 0 - SidebarLayout: add hover transition for sidebar items - Update todo.md and lessons.md with latest fixes
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import React, { useState } from "react";
|
|
import SidebarNav from "./SidebarNav";
|
|
import type { NavItem } from "./SidebarNav";
|
|
|
|
interface SidebarLayoutProps {
|
|
items?: NavItem[];
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
export default function SidebarLayout({ items, children }: SidebarLayoutProps) {
|
|
const [isSidebarOpen, setIsSidebarOpen] = useState(false);
|
|
|
|
return (
|
|
<div className="relative min-h-screen flex bg-dark text-primary overflow-hidden">
|
|
<div
|
|
className="pointer-events-none absolute inset-0 bg-app-gradient"
|
|
aria-hidden="true"
|
|
/>
|
|
<SidebarNav
|
|
items={items ?? []}
|
|
isOpen={isSidebarOpen}
|
|
onClose={() => setIsSidebarOpen(false)}
|
|
/>
|
|
<div className="relative z-10 flex min-w-0 flex-1 flex-col">
|
|
{React.Children.map(children, (child) => {
|
|
// 将 toggleSidebar 函数传递给子组件
|
|
if (React.isValidElement(child)) {
|
|
return React.cloneElement(child, {
|
|
// @ts-ignore - 动态传递 props
|
|
onToggleSidebar: () => setIsSidebarOpen(!isSidebarOpen),
|
|
} as any);
|
|
}
|
|
return child;
|
|
})}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|