import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; import { api } from "@/utils/api"; import { AlertBlock } from "@/components/shared/alert-block"; import { Dices } from "lucide-react"; import { useState } from "react"; import { toast } from "sonner"; import { Input } from "@/components/ui/input"; interface Props { composeId: string; } export const RandomizeCompose = ({ composeId }: Props) => { const utils = api.useUtils(); const [prefix, setPrefix] = useState(""); const [compose, setCompose] = useState(""); const [isOpen, setIsOpen] = useState(false); const { mutateAsync, error, isError } = api.compose.randomizeCompose.useMutation(); const onSubmit = async () => { await mutateAsync({ composeId, prefix, }) .then(async (data) => { await utils.project.all.invalidate(); setCompose(data); toast.success("Compose randomized"); }) .catch(() => { toast.error("Error to randomize the compose"); }); }; return ( onSubmit()}> Randomize Compose (Experimental) Use this in case you want to deploy the same compose file and you have conflicts with some property like volumes, networks, etc.
This will randomize the compose file and will add a prefix to the property to avoid conflicts
  • volumes
  • networks
  • services
  • configs
  • secrets
setPrefix(e.target.value)} />
{isError && {error?.message}}
						{compose}
					
); };