From be1cb6381a8f262f0454a110c09b3e9c9315900e Mon Sep 17 00:00:00 2001 From: Denozordec Date: Mon, 23 Nov 2026 10:22:45 +0700 Subject: [PATCH] =?UTF-8?q?fix(ix):=20=D0=B2=D0=BE=D1=81=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=B8=D1=82=D1=8C=20=D0=BF=D1=80=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=B4=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA?= =?UTF-8?q?=D0=BB=D0=B8=D0=B5=D0=BD=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(main)/ix/ix-site-editor.tsx | 228 +++++++++++++++ app/(main)/ix/ix-view.tsx | 17 +- app/(main)/ix/page.tsx | 263 ++++++++++-------- backend/mcp-coverage.json | 14 + backend/scripts/acceptance/ix-web-rest.mts | 171 ++++++++++++ backend/src/routes/internet-exchange.ts | 72 ++++- .../src/services/internet-exchange-client.ts | 70 +++++ .../internet-exchange-execution.test.ts | 28 ++ .../services/internet-exchange-execution.ts | 129 ++++++--- .../services/internet-exchange-plan.test.ts | 20 +- .../src/services/internet-exchange-plan.ts | 8 + docs/ix.md | 7 +- packages/contracts/src/internet-exchange.ts | 26 ++ tests/e2e/ix-context.spec.ts | 87 ++++-- 14 files changed, 957 insertions(+), 183 deletions(-) create mode 100644 app/(main)/ix/ix-site-editor.tsx create mode 100644 backend/scripts/acceptance/ix-web-rest.mts diff --git a/app/(main)/ix/ix-site-editor.tsx b/app/(main)/ix/ix-site-editor.tsx new file mode 100644 index 00000000..4454dc70 --- /dev/null +++ b/app/(main)/ix/ix-site-editor.tsx @@ -0,0 +1,228 @@ +"use client" + +import { useId, type ReactNode } from "react" +import Link from "next/link" +import { PlusIcon, XIcon } from "lucide-react" +import type { IxSite } from "@mmapp/contracts/internet-exchange" +import { Button } from "@/components/ui/button" +import { Field, FieldLabel } from "@/components/ui/field" +import { Input } from "@/components/ui/input" +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" +import { Checkbox } from "@/components/ui/checkbox" +import { Textarea } from "@/components/ui/textarea" + +type Binding = IxSite["interfaces"][number] +type Group = IxSite["groups"][number] +type Path = Group["primary"] +type Peer = IxSite["neighbors"][number] +type Choice = { value: string; label: string } + +function TextField({ label, value, edit, numeric, placeholder }: { + label: string; value: string | number; edit: (value: string) => void; numeric?: boolean; placeholder?: string +}) { + const id = useId() + return + {label} + { if (!numeric || /^\d*$/.test(event.target.value)) edit(event.target.value) }} /> + +} + +function Pick({ label, value, options, edit, disabled }: { + label: string; value?: T; options: readonly { value: T; label: string }[]; edit: (value: T) => void; disabled: boolean +}) { + const id = useId() + return + {label} + + +} + +function Flag({ label, checked, edit, disabled }: { + label: string; checked: boolean; edit: (value: boolean) => void; disabled: boolean +}) { + const id = useId() + return + + {label} + +} + +function Lines({ label, value, edit }: { label: string; value: string[]; edit: (value: string[]) => void }) { + const id = useId() + return + {label} +