"use client" import Link from "next/link" import {useDataSource} from "@/lib/data-source" import {useEvoBGP} from "@/lib/evobgp-context" import {can} from "@/lib/auth" import {Alert,AlertTitle,AlertDescription} from "@/components/reui/alert" import {Button} from "@/components/ui/button" import {EmptyState} from "@/components/empty-state" import {AlertCircleIcon} from "lucide-react" export function useEvoCatalogView(){ const {mode,backendStatus}=useDataSource(),evo=useEvoBGP() const allowed=can("mm:settings:admin") const snapshot=mode==="live"&&allowed&&evo.enabled?evo.snapshot:null return {evo,mode,backendStatus,allowed,snapshot,known:mode==="mock"||!!snapshot,loading:mode==="live"&&allowed&&!snapshot&&(evo.settingsLoading||evo.loading)} } export function EvoBgpCatalogStatus(){ const {evo,mode,backendStatus,allowed,snapshot}=useEvoCatalogView() if(mode==="mock")return
Демонстрационный каталог
const reason=!allowed?"Нет доступа к каталогу EvoBGP":!evo.settingsLoaded?evo.settingsLoading?"Загрузка настроек EvoBGP…":"Настройки EvoBGP неизвестны":!evo.enabled?"Интеграция EvoBGP выключена":!snapshot?evo.loading?"Загрузка каталога EvoBGP…":"Каталог EvoBGP не получен":null const error=evo.settingsError||evo.catalogError return{reason}
:null} {snapshot?Каталог EvoBGP получен: {evo.catalogReceivedAt?new Date(evo.catalogReceivedAt).toLocaleString("ru-RU"):"—"}{evo.loading?" · обновление…":""}
:null} {error?