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]>
54 lines
1.9 KiB
TypeScript
54 lines
1.9 KiB
TypeScript
import { queryOptions } from '@tanstack/react-query'
|
|
import { apiJSON } from '@/lib/api-client'
|
|
import type {
|
|
ModuleRow,
|
|
ModulesResponse,
|
|
Page,
|
|
} from '@/types/api'
|
|
|
|
export const modulesKeys = {
|
|
all: ['modules'] as const,
|
|
list: () => [...modulesKeys.all, 'list'] as const,
|
|
detail: (id: string) => [...modulesKeys.all, 'detail', id] as const,
|
|
domainEntries: (id: string) => [...modulesKeys.all, 'domain-entries', id] as const,
|
|
asEntries: (id: string) => [...modulesKeys.all, 'as-entries', id] as const,
|
|
cdnSources: (id: string) => [...modulesKeys.all, 'cdn-sources', id] as const,
|
|
ipRangeEntries: (id: string) => [...modulesKeys.all, 'ip-range-entries', id] as const,
|
|
}
|
|
|
|
export function modulesListQueryOptions() {
|
|
return queryOptions<ModulesResponse>({
|
|
queryKey: modulesKeys.list(),
|
|
queryFn: () => apiJSON<ModulesResponse>('/v1/modules?limit=200'),
|
|
})
|
|
}
|
|
|
|
export function moduleDetailQueryOptions(id: string) {
|
|
return queryOptions<ModuleRow>({
|
|
queryKey: modulesKeys.detail(id),
|
|
queryFn: () => apiJSON<ModuleRow>(`/v1/modules/${id}`),
|
|
})
|
|
}
|
|
|
|
export type ModuleEntriesPage = Page<Record<string, unknown>>
|
|
|
|
export function moduleEntriesQueryOptions(id: string, type: ModuleRow['type']) {
|
|
const pathByType: Record<ModuleRow['type'], string> = {
|
|
DOMAINS: `/v1/modules/${id}/domain-entries?limit=500`,
|
|
AS_PREFIXES: `/v1/modules/${id}/as-entries?limit=500`,
|
|
CDN_CIDRS: `/v1/modules/${id}/cdn-sources?limit=500`,
|
|
IP_RANGES: `/v1/modules/${id}/ip-range-entries?limit=500`,
|
|
}
|
|
const path = pathByType[type]
|
|
const keyByType: Record<ModuleRow['type'], readonly string[]> = {
|
|
DOMAINS: modulesKeys.domainEntries(id),
|
|
AS_PREFIXES: modulesKeys.asEntries(id),
|
|
CDN_CIDRS: modulesKeys.cdnSources(id),
|
|
IP_RANGES: modulesKeys.ipRangeEntries(id),
|
|
}
|
|
return queryOptions<ModuleEntriesPage>({
|
|
queryKey: keyByType[type],
|
|
queryFn: () => apiJSON<ModuleEntriesPage>(path),
|
|
})
|
|
}
|