"use client"; import { useState, useEffect } from "react"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@kandev/ui/dialog"; import { Input } from "@kandev/ui/input"; import { Label } from "@kandev/ui/label"; import { Button } from "@kandev/ui/button"; import { createExecutorProfile } from "@/lib/api/domains/settings-api"; import type { ExecutorProfile } from "@/lib/types/http"; type ExecutorProfileDialogProps = { open: boolean; onOpenChange: (open: boolean) => void; executorId: string; onSaved?: (profile: ExecutorProfile) => void; }; export function ExecutorProfileDialog({ open, onOpenChange, executorId, onSaved, }: ExecutorProfileDialogProps) { const [name, setName] = useState(""); const [saving, setSaving] = useState(false); const [error, setError] = useState(null); useEffect(() => { if (open) { setName(""); setError(null); } }, [open]); const handleSave = async () => { if (!name.trim()) return; setSaving(true); setError(null); try { const created = await createExecutorProfile(executorId, { name: name.trim(), }); onOpenChange(false); onSaved?.(created); } catch (err) { setError(err instanceof Error ? err.message : "Failed to create profile"); } finally { setSaving(false); } }; return ( New Profile Create a new profile for this executor. You can configure scripts and environment variables on the profile page.
setName(e.target.value)} placeholder="e.g. Production, Development" autoFocus />
{error &&

{error}

}
); }