chore: synchronize pending app/backend updates and repository hygiene

Includes current frontend and backend work in progress and removes generated artifacts from tracking to keep the repository clean for дальнейшая разработка.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Denozordec
2026-05-07 12:29:04 +07:00
co-authored by Cursor
parent bdb9b72fac
commit 5f31bb47fb
81 changed files with 11976 additions and 1239 deletions
+55
View File
@@ -0,0 +1,55 @@
import {
asns,
domains,
filters,
greTunnels,
ipRanges,
pingProbes,
routerCertificates,
routerContainers,
servers,
} from "@/lib/data"
/** Число мок-сессий BGP (см. `SESSIONS` в `app/(main)/bgp/page.tsx`). */
export const MOCK_BGP_SESSION_COUNT = 12
/** Компактная подпись: тысячи как «1.8к» (кириллица), как в старом меню. */
export function formatSidebarBadgeCount(n: number): string {
if (!Number.isFinite(n) || n < 0) return "0"
if (n < 1000) return String(Math.round(n))
const k = n / 1000
const s = k >= 10 ? String(Math.round(k)) : k.toFixed(1).replace(/\.0$/, "")
return `${s}к`
}
function mockWireGuardIfacesCount(): number {
let n = 0
for (const s of servers) n += s.wireGuardIfaces?.length ?? 0
return n
}
/** Счётчики из `lib/data` для режима mock. */
export function mockSidebarBadgesByUrl(): Record<string, string> {
return {
"/uptime": formatSidebarBadgeCount(pingProbes.length),
"/domains": formatSidebarBadgeCount(domains.length),
"/ip-ranges": formatSidebarBadgeCount(ipRanges.length),
"/asns": formatSidebarBadgeCount(asns.length),
"/servers": formatSidebarBadgeCount(servers.length),
"/filters": formatSidebarBadgeCount(filters.length),
"/wireguard": formatSidebarBadgeCount(mockWireGuardIfacesCount()),
"/gre": formatSidebarBadgeCount(greTunnels.length),
"/containers": formatSidebarBadgeCount(routerContainers.length),
"/certificates": formatSidebarBadgeCount(routerCertificates.length),
"/bgp": formatSidebarBadgeCount(MOCK_BGP_SESSION_COUNT),
}
}
export interface SidebarCountsDto {
servers: number
filterRules: number
uptimeProbes: number
uptimeSpeedProbes: number
monitoringItems: number
recursiveRoutes: number
}