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 <[email protected]>
187 lines
7.1 KiB
TypeScript
187 lines
7.1 KiB
TypeScript
import { createFileRoute } from '@tanstack/react-router'
|
||
import { useQuery } from '@tanstack/react-query'
|
||
import { BookText, Globe, Info, RefreshCw, Tags } from 'lucide-react'
|
||
|
||
import { Alert, AlertDescription, AlertTitle } from '@evobgp/ui/components/alert'
|
||
import { Badge } from '@evobgp/ui/components/badge'
|
||
import { Button } from '@evobgp/ui/components/button'
|
||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@evobgp/ui/components/card'
|
||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@evobgp/ui/components/tabs'
|
||
import {
|
||
Table,
|
||
TableBody,
|
||
TableCell,
|
||
TableHead,
|
||
TableHeader,
|
||
TableRow,
|
||
} from '@evobgp/ui/components/table'
|
||
|
||
import { PageHeader } from '@/components/page-header'
|
||
import { QueryState } from '@/components/query-state'
|
||
import { SectionCards, type SectionCardItem } from '@/components/section-cards'
|
||
import { SectionCardsSkeleton, TableSkeleton } from '@/components/skeletons'
|
||
import { directoriesCommunitiesQueryOptions, directoriesDohQueryOptions } from '@/queries/directories'
|
||
|
||
export const Route = createFileRoute('/_auth/directories')({
|
||
component: DirectoriesComponent,
|
||
})
|
||
|
||
function DirectoriesComponent() {
|
||
const communitiesQ = useQuery(directoriesCommunitiesQueryOptions())
|
||
const dohQ = useQuery(directoriesDohQueryOptions())
|
||
|
||
const communities = communitiesQ.data?.items ?? []
|
||
const dohProfiles = dohQ.data?.items ?? []
|
||
const loading = communitiesQ.isLoading || dohQ.isLoading
|
||
|
||
const items: SectionCardItem[] = [
|
||
{
|
||
label: 'Сообщества BGP',
|
||
value: communities.length,
|
||
icon: <Tags className="size-4" />,
|
||
hint: 'теги префиксов в AS- и CDN-модулях',
|
||
},
|
||
{
|
||
label: 'DoH профили',
|
||
value: dohProfiles.length,
|
||
icon: <Globe className="size-4" />,
|
||
hint: 'резолвинг доменных модулей',
|
||
},
|
||
{
|
||
label: 'Справочники',
|
||
value: 'Общие',
|
||
icon: <BookText className="size-4" />,
|
||
hint: 'используются всеми модулями tenant',
|
||
},
|
||
]
|
||
|
||
return (
|
||
<div className="flex flex-col gap-6">
|
||
<PageHeader
|
||
title="Справочники"
|
||
description="Сообщества BGP и DoH-профили для резолвинга доменов"
|
||
actions={
|
||
<Button
|
||
variant="outline"
|
||
size="sm"
|
||
onClick={() => {
|
||
void communitiesQ.refetch()
|
||
void dohQ.refetch()
|
||
}}
|
||
disabled={loading}
|
||
>
|
||
<RefreshCw className={loading ? 'animate-spin' : ''} />
|
||
Обновить
|
||
</Button>
|
||
}
|
||
/>
|
||
|
||
<Alert className="border-info/30 bg-info/5">
|
||
<Info className="text-info" />
|
||
<AlertTitle>О справочниках</AlertTitle>
|
||
<AlertDescription>
|
||
Сообщества BGP используются в AS- и CDN-модулях для тегирования префиксов. DoH-профили — в
|
||
доменных модулях для DNS-over-HTTPS резолвинга.
|
||
</AlertDescription>
|
||
</Alert>
|
||
|
||
{loading ? <SectionCardsSkeleton count={3} /> : <SectionCards items={items} />}
|
||
|
||
<Tabs defaultValue="communities">
|
||
<TabsList>
|
||
<TabsTrigger value="communities">Сообщества BGP</TabsTrigger>
|
||
<TabsTrigger value="doh">DoH профили</TabsTrigger>
|
||
</TabsList>
|
||
|
||
<TabsContent value="communities" className="mt-4">
|
||
<Card>
|
||
<CardHeader className="border-b py-3">
|
||
<CardTitle className="text-base">Сообщества BGP</CardTitle>
|
||
<CardDescription>Теги для префиксов в фильтрах BIRD</CardDescription>
|
||
</CardHeader>
|
||
<CardContent className="p-0">
|
||
<QueryState
|
||
data={communities}
|
||
isLoading={communitiesQ.isLoading}
|
||
isError={communitiesQ.isError}
|
||
error={communitiesQ.error}
|
||
empty={communities.length === 0}
|
||
emptyTitle="Нет сообществ"
|
||
skeleton={<TableSkeleton rows={4} cols={3} />}
|
||
onRetry={() => communitiesQ.refetch()}
|
||
>
|
||
{(items) => (
|
||
<Table>
|
||
<TableHeader>
|
||
<TableRow>
|
||
<TableHead>Название</TableHead>
|
||
<TableHead>Значение</TableHead>
|
||
<TableHead>Тип</TableHead>
|
||
</TableRow>
|
||
</TableHeader>
|
||
<TableBody>
|
||
{items.map((c) => (
|
||
<TableRow key={c.id}>
|
||
<TableCell className="font-medium">{c.title}</TableCell>
|
||
<TableCell className="font-mono text-xs">{c.community}</TableCell>
|
||
<TableCell>
|
||
<Badge variant="outline">community</Badge>
|
||
</TableCell>
|
||
</TableRow>
|
||
))}
|
||
</TableBody>
|
||
</Table>
|
||
)}
|
||
</QueryState>
|
||
</CardContent>
|
||
</Card>
|
||
</TabsContent>
|
||
|
||
<TabsContent value="doh" className="mt-4">
|
||
<Card>
|
||
<CardHeader className="border-b py-3">
|
||
<CardTitle className="text-base">DoH профили</CardTitle>
|
||
<CardDescription>Резолверы DNS-over-HTTPS для доменных модулей</CardDescription>
|
||
</CardHeader>
|
||
<CardContent className="p-0">
|
||
<QueryState
|
||
data={dohProfiles}
|
||
isLoading={dohQ.isLoading}
|
||
isError={dohQ.isError}
|
||
error={dohQ.error}
|
||
empty={dohProfiles.length === 0}
|
||
emptyTitle="Нет DoH профилей"
|
||
skeleton={<TableSkeleton rows={4} cols={3} />}
|
||
onRetry={() => dohQ.refetch()}
|
||
>
|
||
{(items) => (
|
||
<Table>
|
||
<TableHeader>
|
||
<TableRow>
|
||
<TableHead>Название</TableHead>
|
||
<TableHead>URL</TableHead>
|
||
<TableHead>По умолчанию</TableHead>
|
||
</TableRow>
|
||
</TableHeader>
|
||
<TableBody>
|
||
{items.map((p) => (
|
||
<TableRow key={p.id}>
|
||
<TableCell className="font-medium">{p.name ?? p.url}</TableCell>
|
||
<TableCell className="font-mono text-xs">{p.url}</TableCell>
|
||
<TableCell>
|
||
<Badge variant="outline">—</Badge>
|
||
</TableCell>
|
||
</TableRow>
|
||
))}
|
||
</TableBody>
|
||
</Table>
|
||
)}
|
||
</QueryState>
|
||
</CardContent>
|
||
</Card>
|
||
</TabsContent>
|
||
</Tabs>
|
||
</div>
|
||
)
|
||
}
|