"use client"; import { Suspense, useEffect, useState } from "react"; import { useRouter, useSearchParams } from "next/navigation"; import Link from "next/link"; import { ArrowLeft, Layers } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { EnvironmentForm } from "@/components/environments/environment-form"; import { api, type Environment } from "@/lib/api"; export default function EditEnvironmentPage() { return ( Loading…}> ); } function EditEnvironment() { const router = useRouter(); const params = useSearchParams(); const name = params.get("name") ?? ""; const [env, setEnv] = useState(null); const [error, setError] = useState(null); useEffect(() => { if (!name) return; api .getEnvironment(name) .then(setEnv) .catch((err) => setError(err instanceof Error ? err.message : "load failed")); }, [name]); if (!name) { return (
Missing name query param.
); } return (
Edit environment

{name}

Update the description. Pipelines and their order are managed on the environments list. Name is immutable.

{error && (

{error}

)} Configuration Name + description. {env === null ? (

Loading…

) : ( router.push("/environments")} onSubmit={async (body) => { await api.updateEnvironment(name, body); router.push("/environments"); }} onError={setError} /> )}
); }