import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Label } from "@/components/ui/label"; import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { api } from "@/utils/api"; import { Loader2 } from "lucide-react"; import { useEffect, useState } from "react"; import { toast } from "sonner"; import { DockerMonitoring } from "../../monitoring/docker/show"; interface Props { appName: string; serverId?: string; appType: "stack" | "docker-compose"; } export const ShowMonitoringCompose = ({ appName, appType = "stack", serverId, }: Props) => { const { data, isLoading } = api.docker.getContainersByAppNameMatch.useQuery( { appName: appName, appType, serverId, }, { enabled: !!appName, }, ); const [containerAppName, setContainerAppName] = useState< string | undefined >(); const [containerId, setContainerId] = useState(); const { mutateAsync: restart, isLoading: isRestarting } = api.docker.restartContainer.useMutation(); useEffect(() => { if (data && data?.length > 0) { setContainerAppName(data[0]?.name); setContainerId(data[0]?.containerId); } }, [data]); return (
Monitoring Watch the usage of your compose
); };