- {selected?.configuration.sites.flatMap(site => site.interfaces.filter(binding => binding.provisionWireguard?.hubEndpoint).map(binding =>
-
- ))}
- {linux &&
{linux}}
- {observations.map(site =>
-
-
{nodes.find(node => node.id === site.serverId)?.name || site.serverId}
-
{new Date(site.observedAt).toLocaleString()}
+
+
+
+ {inDetail &&
}
+
+
+
+
+ {inDetail ? selected?.configuration.name ?? "Новый сегмент" : title}
+
+ {inDetail && selected && }
- {site.available ? <>
-
Активные BGP-сессии {site.neighbors.filter(peer => peer.established).length} из {site.neighbors.length}
-
- | Префикс | Шлюз | Фактический next hop | Активен |
- {site.routes.map((route, index) =>
- | {route.prefix} | {route.gateway || "—"} |
- {route.immediateGateway ?? "Не подтверждён"} | {route.active ? "Да" : "Нет"} |
-
)}
-
- > :
Состояние недоступно}
-
)}
-
}
- }
+ {inDetail ? (selected &&
+ Ревизия {selected.revision}{selected.appliedRevision ? ` · Применена ревизия ${selected.appliedRevision}` : ""}
+
) :
Сегменты IX, площадки и маршрутизация
}
+
+ {!inDetail &&
+
+ {canCreate &&
}
+
}
+
+ {error &&
Ошибка IX{error}}
+ {notice &&
{notice}
}
+
+ {!draft ?
+
+ Сегменты{live && !loading ? `Найдено: ${rows.length}` : ""}
+ setFilter(event.target.value)} />
+
+
+
+ } title={listEmpty} description={listDescription}
+ action={live && !filter.trim() && !error && enabledNodes.length === 0 ? } nativeButton={false} size="sm" variant="outline">Открыть серверы : undefined} />
+ } />
+
+
+ :
showTab(value as Tab)} className="min-w-0 gap-3">
+
+
+ Конфигурация
+ Маршруты и BGP
+ План изменений
+
+
+
+
+ {advanced === null ? { setDraft(value); invalidateReview() }} /> :
+ Конфигурация JSONИнтерфейсы, группы шлюзов, маршруты и BGP-политики.
+
+
+ }
+
+ {write && }
+ {advanced === null ? : }
+
+
+
+
+ {!selected?.appliedRevision ? : <>
+
+
+ {linuxBindings.map(({ site, binding }) => )}
+
+ {linux && Конфигурация Linux
+ {linux}}
+ {busy && observations === null && }
+ {observations?.map(site => )}
+ >}
+
+
+
+
+
+ Предпросмотр
+ Объекты RouterOS, которые создаёт текущая конфигурация.
+
+
+
+ {preview &&
+ Объекты RouterOS · {preview.length}
+ {json(preview)}
+ }
+
+
+
+ {write &&
+
+ Применение через MCP
+ План, подтверждение и применение к площадкам сегмента.
+
+
+ {connectionError && {connectionError}
}
+
+
+ Подключение MCP
+
+
+
+ {connections.length === 0 &&
} nativeButton={false} variant="outline" size="sm">Открыть подключения}
+
+ {plan &&
+ {planStates[plan.state] ?? plan.state}
+ } nativeButton={false} size="sm" variant="link">Планы и операции
+ {plan.state === "awaiting-approval" && approve && }
+ {["draft", "approved"].includes(plan.state) && }
+
}
+
+ }
+
+ }
+
>
}
diff --git a/app/(main)/servers/page.tsx b/app/(main)/servers/page.tsx
index 9a41a11b..c93c4054 100644
--- a/app/(main)/servers/page.tsx
+++ b/app/(main)/servers/page.tsx
@@ -38,6 +38,8 @@ import { cn } from "@/lib/utils"
import { KpiStatGrid } from "@/components/reui-kit/kpi-stat-grid"
import { DataPageCard } from "@/components/data-page-card"
import { Button } from "@/components/ui/button"
+import { ButtonGroup } from "@/components/ui/button-group"
+import { Field, FieldTitle } from "@/components/ui/field"
import { Input } from "@/components/ui/input"
import {
Sheet, SheetContent, SheetHeader, SheetTitle,
@@ -772,19 +774,29 @@ function ServersPageContent() {
value={form.name} onChange={e => set("name", e.target.value)} />
-
- set("type", v)}
- options={[
- { value: "home-router", label: "Home Router" },
- { value: "jump-host", label: "JumpHost" },
- { value: "exit-node", label: "Exit Node" },
- { value: "ix-node", label: "IX Node" },
- ]}
- />
-
+
+ Тип узла *
+
+ {([
+ ["home-router", "Home Router"],
+ ["jump-host", "JumpHost"],
+ ["exit-node", "Exit Node"],
+ ["ix-node", "IX Node"],
+ ] as const).map(([value, label]) => (
+
+ ))}
+
+
diff --git a/tests/e2e/ix-context.spec.ts b/tests/e2e/ix-context.spec.ts
new file mode 100644
index 00000000..b1ab774c
--- /dev/null
+++ b/tests/e2e/ix-context.spec.ts
@@ -0,0 +1,85 @@
+import { expect, test } from "@playwright/test"
+import { ixChangeSchema, ixSegmentConfigurationSchema } from "@mmapp/contracts/internet-exchange"
+import { mcpLimitsSchema } from "@mmapp/contracts/mcp"
+
+const id = "fa58fa40-4bcb-4616-9316-cb69463b3150"
+const observedAt = "2026-11-20T00:00:00Z"
+const nodes = [
+ { id: 1, name: "ix-node-01", site: "TEST-1", country: "DE", enabled: true },
+ { id: 2, name: "ix-node-02", site: "TEST-2", country: "FI", enabled: true },
+]
+
+test("IX: карточка доступна на узком экране, сохранение удерживает настройки маршрутизации", async ({ page }, testInfo) => {
+ const configuration = ixSegmentConfigurationSchema.parse({ name: "ix-central", sites: [
+ { serverId: 1, autonomousSystem: 64512, routerId: "192.0.2.10", interfaces: [{ name: "wg-member", kind: "wireguard" }] },
+ { serverId: 2, autonomousSystem: 64512, routerId: "192.0.2.11" },
+ ] })
+ let segment = { id, revision: 1, appliedRevision: 1, configuration, updatedAt: observedAt }
+ await page.route("**/health", route => route.fulfill({ json: { ok: true } }))
+ await page.route("**/api/**", async route => {
+ const request = route.request()
+ const path = new URL(request.url()).pathname
+ const json = (body: unknown) => route.fulfill({ json: body })
+ if (path === "/api/auth/config") return json({ required: false })
+ if (path === "/api/ix/nodes") return json({ items: nodes })
+ if (path === "/api/mcp/connections") return json({ connections: [{
+ id, name: "IX Lab", ownerId: "test", createdAt: observedAt, updatedAt: observedAt, lastUsedAt: null, generationValid: true,
+ policy: { id, version: 1, status: "active", mode: "approval", expiresAt: "2099-01-01T00:00:00Z",
+ permissions: ["mm:network:write"], scope: { serverIds: [1, 2], operationIds: ["network.ix.configure"], allowGlobal: false },
+ dangerousPolicy: "approval", autonomousDangerousOperationIds: [], limits: mcpLimitsSchema.parse({}) },
+ }] })
+ if (path === "/api/mcp/ix/plan") return json({ planId: id, state: "awaiting-approval" })
+ if (path === `/api/mcp/plans/${id}/decision`) return json({ ok: true })
+ if (path === `/api/mcp/plans/${id}/apply`) return json({ id, state: "pending" })
+ if (path === "/api/ix/segments" && request.method() === "POST") {
+ const change = ixChangeSchema.parse(request.postDataJSON())
+ segment = { ...segment, configuration: change.configuration, revision: change.revision + 1 }
+ return json({ segment })
+ }
+ if (path === "/api/ix/segments") return json({ items: [segment] })
+ if (path === `/api/ix/segments/${id}/status`) return json({ sites: [{
+ serverId: 1, available: true, observedAt, neighbors: [{ name: "member", established: true }],
+ routes: [{ prefix: "2001:db8:120::/48", gateway: "2001:db8::1", immediateGateway: "2001:db8::2%wg-member", active: true }],
+ }] })
+ if (path === "/api/ix/preview") return json({ objects: [] })
+ if (path === "/api/servers") return json([])
+ return json({})
+ })
+
+ await page.goto("/ix")
+ const row = page.getByRole("button", { name: "ix-central", exact: true })
+ await expect(row).toBeVisible()
+ const search = page.getByRole("searchbox", { name: "Поиск сегментов" })
+ await search.fill("no-match")
+ await expect(page.getByText("Сегменты не найдены")).toBeVisible()
+ await search.clear()
+ await expect(row).toBeVisible()
+ await page.screenshot({ path: testInfo.outputPath("ix-list-desktop.png"), animations: "disabled" })
+ await row.click()
+ await expect(page.getByRole("heading", { name: "ix-central" })).toBeFocused()
+ await page.screenshot({ path: testInfo.outputPath("ix-detail-desktop.png"), animations: "disabled" })
+
+ await page.setViewportSize({ width: 390, height: 760 })
+ await page.getByLabel("Локальный ASN", { exact: true }).first().fill("64513")
+ const save = page.getByRole("button", { name: "Сохранить черновик" })
+ await save.scrollIntoViewIfNeeded()
+ await expect(save).toBeInViewport()
+ await save.click()
+ await expect(page.getByText("Черновик сохранён")).toBeVisible()
+ expect(segment.configuration.sites[0]).toEqual({ ...configuration.sites[0], autonomousSystem: 64513 })
+ expect(segment.configuration.sites[1]).toEqual(configuration.sites[1])
+
+ await page.getByRole("tab", { name: "Маршруты и BGP" }).click()
+ await expect(page.getByText("2001:db8:120::/48")).toBeVisible()
+ await expect(page.getByText("BGP 1 из 1")).toBeVisible()
+ await page.getByRole("tab", { name: "План изменений" }).click()
+ await page.getByRole("button", { name: "Построить предпросмотр" }).click()
+ await expect(page.getByText("Объекты RouterOS · 0")).toBeVisible()
+ await expect(page.getByText("IX Lab", { exact: true })).toBeVisible()
+ await page.getByRole("button", { name: "Подготовить план MCP" }).click()
+ await expect(page.getByText("Ждёт подтверждения")).toBeVisible()
+ await page.getByRole("button", { name: "Подтвердить", exact: true }).click()
+ await page.getByRole("button", { name: "Применить план" }).click()
+ await expect(page.getByText("В очереди", { exact: true })).toBeVisible()
+ expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(390)
+})
diff --git a/tests/e2e/servers.spec.ts b/tests/e2e/servers.spec.ts
index e588a0fa..622119c1 100644
--- a/tests/e2e/servers.spec.ts
+++ b/tests/e2e/servers.spec.ts
@@ -45,6 +45,29 @@ async function edit(page: Page, id = 1) {
await page.getByRole("menuitem", { name: "Редактировать", exact: true }).click()
}
+test("типы узлов в узкой форме выбираются кнопкой и с клавиатуры", async ({ page }, testInfo) => {
+ await setup(page)
+ await page.setViewportSize({ width: 390, height: 844 })
+ await page.getByRole("button", { name: "Добавить сервер", exact: true }).click()
+ const types = page.getByRole("group", { name: "Тип узла" })
+ const exit = types.getByRole("button", { name: "Exit Node" })
+ const ix = types.getByRole("button", { name: "IX Node" })
+ await expect(exit).toHaveAttribute("aria-pressed", "true")
+ await expect(types).toBeInViewport({ ratio: 1 })
+ const buttonTops = await types.getByRole("button").evaluateAll(buttons => buttons.map(button => button.getBoundingClientRect().top))
+ expect(buttonTops).toHaveLength(4)
+ expect(new Set(buttonTops).size).toBe(1)
+ await ix.click()
+ await expect(ix).toHaveAttribute("aria-pressed", "true")
+ await expect(types.getByRole("button", { pressed: true })).toHaveCount(1)
+ await expect(page.getByPlaceholder("AS65001")).toBeVisible()
+ await page.screenshot({ path: testInfo.outputPath("node-type-mobile.png"), animations: "disabled" })
+ await page.keyboard.press("Shift+Tab")
+ await expect(exit).toBeFocused()
+ await page.keyboard.press("Space")
+ await expect(exit).toHaveAttribute("aria-pressed", "true")
+})
+
test("ссылка на сервер: выбор, опрос одного устройства, сброс и возврат", async ({ page }) => {
const calls: string[] = []
await setup(page, async (route, path) => {