Add controller node selector and accordion wizards

This commit is contained in:
mmckeen
2026-04-28 15:40:25 +00:00
parent 38b651d460
commit 225b3c32bf
7 changed files with 429 additions and 23 deletions
+10 -1
View File
@@ -1,10 +1,19 @@
import { NextResponse } from "next/server"
import { buildControllerNodePlan, type ControllerPlanRequest } from "@/app/lib/controllerNodePlan"
import { upsertControllerNode } from "@/app/lib/controllerNodeRegistry"
export async function POST(request: Request) {
try {
const body = (await request.json().catch(() => ({}))) as ControllerPlanRequest
return NextResponse.json({ ok: true, ...buildControllerNodePlan(body) })
const plan = buildControllerNodePlan(body)
await upsertControllerNode({
id: plan.controller.name,
name: plan.controller.name,
host: plan.controller.host,
url: plan.controller.url,
role: "controller-node",
})
return NextResponse.json({ ok: true, ...plan })
} catch (error) {
const message = error instanceof Error ? error.message : "Failed to build controller node plan"
return NextResponse.json({ ok: false, error: message }, { status: 400 })