CI / changes (push) Successful in 17s
CI / commitlint (push) Has been skipped
CI / openapi (push) Successful in 26s
CI / web (push) Successful in 46s
CI / go (push) Successful in 1m1s
CI / bird2 (push) Successful in 17s
CI / release (push) Failing after 2m22s
Web UI полностью переведён с SvelteKit на новый стек: React 19, TanStack Router/Query/Table/Virtual, shadcn/ui (base-nova) и ReUI enterprise-компоненты (data-grid, filters, autocomplete). Новый код разложен по слоям: packages/ui (shadcn-примитивы), apps/web (роуты, shared-обёртки, ReUI-адаптации). BREAKING CHANGE: меняется структура и инструментинг фронтенда. - apps/web/ — новый Vite + React-проект (@evobgp/web), file-based роуты TanStack Router; экраны dashboard, modules, monitoring, network, operations, schedule, settings, tenant-settings, access, directories. - packages/ui/ — shadcn/ui-примитивы (@evobgp/ui) с общими стилями globals.css и cn-утилитой; CLI shadcn запускается из apps/web. - apps/web/src/components/reui/ — enterprise-паттерны ReUI. - pnpm workspace (pnpm-workspace.yaml, pnpm-lock.yaml, tsconfig.base.json) заменяет npm-проект в web/. - web/ переименован в web-legacy-svelte/ (архив-референс для миграции); импорты оттуда запрещены правилом WEB-22. - CI (.gitea/workflows/ci.yaml): job web переведён на Node 22 + pnpm 10 (typecheck/lint/build через pnpm --filter @evobgp/web); пути триггеров обновлены под apps/web|packages/ui. - deploy/docker/evobgp-web/Dockerfile: сборка из корня репозитория, pnpm install --frozen-lockfile, выход dist из apps/web/dist. - .cursor/rules/web-shadcn.mdc, context7-stack.mdc, engineering.mdc, AGENTS.md — обновлены под React-стек (WEB-01..WEB-22, DOC-SYNC-06/07). Проверки WEB-19 локально: typecheck, lint, build — exit 0. Co-authored-by: Cursor <cursoragent@cursor.com>
173 lines
5.5 KiB
TypeScript
173 lines
5.5 KiB
TypeScript
import {
|
|
LayoutDashboard,
|
|
Boxes,
|
|
Network,
|
|
Cog,
|
|
ListChecks,
|
|
Activity,
|
|
Settings,
|
|
BookText,
|
|
KeyRound,
|
|
ServerCog,
|
|
} from 'lucide-react'
|
|
|
|
import {
|
|
Sidebar,
|
|
SidebarContent,
|
|
SidebarFooter,
|
|
SidebarGroup,
|
|
SidebarGroupContent,
|
|
SidebarGroupLabel,
|
|
SidebarHeader,
|
|
SidebarInset,
|
|
SidebarMenu,
|
|
SidebarMenuButton,
|
|
SidebarMenuItem,
|
|
SidebarProvider,
|
|
SidebarTrigger,
|
|
} from '@evobgp/ui/components/sidebar'
|
|
import {
|
|
Breadcrumb,
|
|
BreadcrumbItem,
|
|
BreadcrumbLink,
|
|
BreadcrumbList,
|
|
BreadcrumbPage,
|
|
BreadcrumbSeparator,
|
|
} from '@evobgp/ui/components/breadcrumb'
|
|
import { Separator } from '@evobgp/ui/components/separator'
|
|
|
|
import { Link, useRouterState } from '@tanstack/react-router'
|
|
import type { ComponentType, ReactNode } from 'react'
|
|
|
|
import { ModeToggle } from '@/components/mode-toggle'
|
|
|
|
interface NavItem {
|
|
to: string
|
|
label: string
|
|
icon: ComponentType<{ className?: string }>
|
|
}
|
|
|
|
interface NavGroup {
|
|
label: string
|
|
items: NavItem[]
|
|
}
|
|
|
|
const NAV_GROUPS: NavGroup[] = [
|
|
{
|
|
label: 'Обзор',
|
|
items: [{ to: '/dashboard', label: 'Dashboard', icon: LayoutDashboard }],
|
|
},
|
|
{
|
|
label: 'Маршрутизация',
|
|
items: [
|
|
{ to: '/modules', label: 'Модули', icon: Boxes },
|
|
{ to: '/network', label: 'Сеть', icon: Network },
|
|
{ to: '/directories', label: 'Справочники', icon: BookText },
|
|
],
|
|
},
|
|
{
|
|
label: 'Операции',
|
|
items: [
|
|
{ to: '/operations', label: 'Операции', icon: Cog },
|
|
{ to: '/schedule', label: 'Задачи', icon: ListChecks },
|
|
{ to: '/monitoring', label: 'Мониторинг', icon: Activity },
|
|
],
|
|
},
|
|
{
|
|
label: 'Система',
|
|
items: [
|
|
{ to: '/access', label: 'Доступ', icon: KeyRound },
|
|
{ to: '/tenant-settings', label: 'Настройки BIRD', icon: ServerCog },
|
|
{ to: '/settings', label: 'Настройки UI', icon: Settings },
|
|
],
|
|
},
|
|
]
|
|
|
|
const ALL_NAV_ITEMS = NAV_GROUPS.flatMap((g) => g.items)
|
|
|
|
const ROUTE_LABELS: Record<string, string> = Object.fromEntries(
|
|
ALL_NAV_ITEMS.map((i) => [i.to, i.label]),
|
|
)
|
|
|
|
const PARENT_ROUTE: Record<string, string> = {}
|
|
|
|
export function AppShell({ children }: { children: ReactNode }) {
|
|
const pathname = useRouterState({ select: (s) => s.location.pathname })
|
|
const activeItem =
|
|
ALL_NAV_ITEMS.find((i) => pathname === i.to || (i.to !== '/' && pathname.startsWith(`${i.to}/`))) ??
|
|
ALL_NAV_ITEMS[0]
|
|
const parentTo = PARENT_ROUTE[activeItem.to]
|
|
const parentLabel = parentTo ? ROUTE_LABELS[parentTo] : null
|
|
|
|
return (
|
|
<SidebarProvider>
|
|
<Sidebar collapsible="icon">
|
|
<SidebarHeader>
|
|
<div className="flex items-center gap-2 px-2 py-1.5">
|
|
<div className="flex size-8 items-center justify-center rounded-md bg-primary text-primary-foreground text-sm font-bold">
|
|
B
|
|
</div>
|
|
<div className="flex flex-col overflow-hidden group-data-[collapsible=icon]:hidden">
|
|
<span className="truncate text-sm font-semibold">EvoBGP</span>
|
|
<span className="truncate text-xs text-muted-foreground">Control Plane</span>
|
|
</div>
|
|
</div>
|
|
</SidebarHeader>
|
|
<SidebarContent>
|
|
{NAV_GROUPS.map((group) => (
|
|
<SidebarGroup key={group.label}>
|
|
<SidebarGroupLabel>{group.label}</SidebarGroupLabel>
|
|
<SidebarGroupContent>
|
|
<SidebarMenu>
|
|
{group.items.map((item) => {
|
|
const Icon = item.icon
|
|
const isActive = pathname === item.to || pathname.startsWith(`${item.to}/`)
|
|
return (
|
|
<SidebarMenuItem key={item.to}>
|
|
<SidebarMenuButton
|
|
render={<Link to={item.to} />}
|
|
isActive={isActive}
|
|
tooltip={item.label}
|
|
>
|
|
<Icon className="size-4" />
|
|
<span>{item.label}</span>
|
|
</SidebarMenuButton>
|
|
</SidebarMenuItem>
|
|
)
|
|
})}
|
|
</SidebarMenu>
|
|
</SidebarGroupContent>
|
|
</SidebarGroup>
|
|
))}
|
|
</SidebarContent>
|
|
<SidebarFooter />
|
|
</Sidebar>
|
|
<SidebarInset>
|
|
<header className="sticky top-0 z-10 flex h-16 shrink-0 items-center gap-2 border-b bg-background/95 px-4 backdrop-blur supports-[backdrop-filter]:bg-background/80">
|
|
<SidebarTrigger />
|
|
<Separator orientation="vertical" className="mr-2 data-[orientation=vertical]:h-4" />
|
|
<Breadcrumb>
|
|
<BreadcrumbList>
|
|
{parentLabel && parentTo ? (
|
|
<>
|
|
<BreadcrumbItem className="hidden md:block">
|
|
<BreadcrumbLink render={<Link to={parentTo} />}>{parentLabel}</BreadcrumbLink>
|
|
</BreadcrumbItem>
|
|
<BreadcrumbSeparator className="hidden md:block" />
|
|
</>
|
|
) : null}
|
|
<BreadcrumbItem>
|
|
<BreadcrumbPage>{ROUTE_LABELS[activeItem.to] ?? activeItem.label}</BreadcrumbPage>
|
|
</BreadcrumbItem>
|
|
</BreadcrumbList>
|
|
</Breadcrumb>
|
|
<div className="ml-auto flex items-center gap-2">
|
|
<ModeToggle />
|
|
</div>
|
|
</header>
|
|
<main className="flex flex-1 flex-col gap-4 p-4 md:gap-6 md:p-6">{children}</main>
|
|
</SidebarInset>
|
|
</SidebarProvider>
|
|
)
|
|
}
|