"use client"
import { Suspense, useCallback, useEffect, useMemo, useRef, useState } from "react"
import { useSearchParams } from "next/navigation"
import { readContainersUrl, patchContainersUrl, type ContainerStatusFilter } from "@/lib/containers-url-state"
import { PageHeader } from "@/components/page-header"
import { routerContainers as mockContainers, servers as mockServers } from "@/lib/data"
import type { RouterContainer, Server } from "@/lib/data"
import { Flag } from "@/components/flag"
import { Frame, FramePanel } from "@/components/reui/frame"
import { KpiStatGrid } from "@/components/reui-kit/kpi-stat-grid"
import { OpsPanel } from "@/components/ops-panel"
import { Button } from "@/components/ui/button"
import { Alert, AlertDescription } from "@/components/ui/alert"
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@/components/ui/alert-dialog"
import { cn } from "@/lib/utils"
import { toast } from "sonner"
import {
DropdownMenu, DropdownMenuTrigger, DropdownMenuContent,
DropdownMenuItem, DropdownMenuSeparator,
} from "@/components/ui/dropdown-menu"
import {
BoxIcon, PlayIcon, StopCircleIcon, SearchIcon,
MoreHorizontalIcon, Trash2Icon, PencilIcon, PowerIcon,
CodeXmlIcon, ActivityIcon, ServerIcon,
TerminalIcon, AlertCircleIcon, RefreshCwIcon,
} from "lucide-react"
import { CodeExportSheet } from "@/components/reui-kit/code-export-sheet"
import { useDataSource } from "@/lib/data-source"
import { ApiClientError, requestJson } from "@/shared/api/http-client"
import { mutateContainer, type ContainerAction, readContainersState } from "@/shared/api/containers"
import { serverListSchema } from "@mmapp/contracts/servers"
import type { ContainerServerState, ContainersState } from "@mmapp/contracts/containers"
import { can } from "@/lib/auth"
import { userApiError } from "@/shared/api/users"
import { ServerRailLayout, ServerRailMobileButton } from "@/components/server-rail-layout"
import { ALL_SERVERS_ID, type ServerTileItem } from "@/components/server-tile-rail"
type ContainerView = Omit
{container.comment}
)}Загрузка настроек контейнеров…
return{operationNotice}
} {operationError && !deleteTarget &&Для каталога контейнеров требуется mm:dashboard:read.
} {isLive && !canReadServers &&Для каталога серверов требуется mm:servers:read. Команды недоступны.
} {isLive && loading && !state &&Загрузка контейнеров…
} {isLive && readAt &&Каталог контейнеров получен: {new Date(readAt).toLocaleTimeString("ru-RU")}
} {isLive && serversReadAt &&Серверы получены: {new Date(serversReadAt).toLocaleTimeString("ru-RU")}
} {isLive && liveError &&Сервер {serverById[String(node.serverId)]?.name ?? node.serverId}: пакет container недоступен.
: null)} {isLive && selectedServerId !== ALL_SERVERS_ID && !displayServers.some(server => server.id === selectedServerId) &&Выбранный сервер недоступен в каталоге. Выберите другое устройство; фильтр сохранён.
} {mode === "mock" && ( Моковые данные )} , iconClassName: "text-muted-foreground", }, { id: "running", label: "Работает", value: statusKnown ? running : "—", icon: , iconClassName: "text-success", }, { id: "stopped", label: "Остановлен", value: statusKnown ? stopped : "—", icon: , iconClassName: "text-muted-foreground", }, { id: "errors", label: "Ошибок", value: statusKnown ? errors : "—", icon: , iconClassName: "text-destructive", variant: errors > 0 ? "destructive" : "default", }, ]} />Контейнеры доступны с RouterOS 7.4+
Поддерживаются Docker-совместимые образы. Требуется установка пакета container.
Сеть veth настраивается на устройстве. Создание контейнеров в интерфейсе пока недоступно.
Список контейнеров пока неизвестен.
: (Контейнеры не найдены
{scoped.length ? "Измените фильтр или поиск" : "Подтверждённый каталог пуст"}
{b.title}
{b.lines.join("\n")}
{operationError}
}