import { useState } from "react" import { Link } from "react-router-dom" import { Plus, ChevronRight } from "lucide-react" import type { ProgramDetail } from "@/types" import { useServices, useJobs } from "@/services/api/hooks" import { KindBadge } from "@/components/KindBadge" import { detailPath } from "@/lib/labels" import { CreateDeploymentForm, type CreatePrefill } from "./CreateDeploymentForm" /** How a program is deployed. A program → 0-N deployments; each row links to its * detail page (where its config + lifecycle live). tool → /tools, static/service * → /services, job → /jobs. */ export function DeploymentsSection({ program }: { program: ProgramDetail }) { const { deployments } = program const [creating, setCreating] = useState(false) const { data: allServices } = useServices() const { data: allJobs } = useJobs() const existing = [ ...(allServices ?? []).map((s) => s.id), ...(allJobs ?? []).map((j) => j.id), ] const prefill: CreatePrefill = { name: program.id, program: program.id, runTarget: program.id, launcher: program.stack?.startsWith("python") || !program.stack ? "python" : "command", } return (
How this program is materialized into the runtime.
{creating && (No deployment yet.
) : (