diff --git a/apps/dokploy/components/dashboard/settings/servers/gpu-support.tsx b/apps/dokploy/components/dashboard/settings/servers/gpu-support.tsx
index a0ef8d80f..ae931a3a9 100644
--- a/apps/dokploy/components/dashboard/settings/servers/gpu-support.tsx
+++ b/apps/dokploy/components/dashboard/settings/servers/gpu-support.tsx
@@ -1,219 +1,260 @@
-import { Button } from '@/components/ui/button';
-import { useState } from 'react';
-import { api } from '@/utils/api';
-import { toast } from 'sonner';
-import { TRPCClientError } from '@trpc/client';
-import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
-import { DialogAction } from '@/components/shared/dialog-action';
-import { AlertBlock } from '@/components/shared/alert-block';
-import { Cpu, CheckCircle2, XCircle, Loader2 } from 'lucide-react';
+import { AlertBlock } from "@/components/shared/alert-block";
+import { DialogAction } from "@/components/shared/dialog-action";
+import { Button } from "@/components/ui/button";
+import {
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+} from "@/components/ui/card";
+import { api } from "@/utils/api";
+import { TRPCClientError } from "@trpc/client";
+import { CheckCircle2, Cpu, Loader2, XCircle } from "lucide-react";
+import { useState } from "react";
+import { toast } from "sonner";
interface GPUSupportProps {
- serverId?: string;
+ serverId?: string;
}
export function GPUSupport({ serverId }: GPUSupportProps) {
- const [isLoading, setIsLoading] = useState(false);
- const utils = api.useContext();
+ const [isLoading, setIsLoading] = useState(false);
+ const utils = api.useContext();
- const { data: gpuStatus, isLoading: isChecking } = api.settings.checkGPUStatus.useQuery(
- { serverId },
- {
- enabled: !!serverId,
- refetchInterval: 5000
- }
- );
+ const { data: gpuStatus, isLoading: isChecking } =
+ api.settings.checkGPUStatus.useQuery(
+ { serverId },
+ {
+ enabled: !!serverId,
+ refetchInterval: 5000,
+ },
+ );
-const setupGPU = api.settings.setupGPU.useMutation({
- onMutate: () => {
- setIsLoading(true);
- },
- onSuccess: async () => {
- toast.success('GPU support enabled successfully');
- setIsLoading(false);
-
- await Promise.all([
- utils.settings.checkGPUStatus.invalidate({ serverId }),
- utils.server.invalidate()
- ]);
- },
- onError: (error) => {
- if (error instanceof TRPCClientError) {
- const errorMessage = error.message;
- if (errorMessage.includes('permission denied')) {
- toast.error('Permission denied. Please ensure proper sudo access.');
- } else if (errorMessage.includes('Failed to configure GPU')) {
- toast.error('GPU configuration failed. Please check system requirements.');
- } else {
- toast.error(errorMessage);
- }
- } else {
- toast.error('Failed to enable GPU support. Please check server logs.');
- }
-
- setIsLoading(false);
- }
-});
+ const setupGPU = api.settings.setupGPU.useMutation({
+ onMutate: () => {
+ setIsLoading(true);
+ },
+ onSuccess: async () => {
+ toast.success("GPU support enabled successfully");
+ setIsLoading(false);
- const handleEnableGPU = async () => {
- if (!serverId) {
- toast.error('No server selected');
- return;
- }
+ await Promise.all([
+ utils.settings.checkGPUStatus.invalidate({ serverId }),
+ utils.server.invalidate(),
+ ]);
+ },
+ onError: (error) => {
+ if (error instanceof TRPCClientError) {
+ const errorMessage = error.message;
+ if (errorMessage.includes("permission denied")) {
+ toast.error("Permission denied. Please ensure proper sudo access.");
+ } else if (errorMessage.includes("Failed to configure GPU")) {
+ toast.error(
+ "GPU configuration failed. Please check system requirements.",
+ );
+ } else {
+ toast.error(errorMessage);
+ }
+ } else {
+ toast.error("Failed to enable GPU support. Please check server logs.");
+ }
- try {
- await setupGPU.mutateAsync({ serverId });
- } catch (error) {
- // Error handling is done in mutation's onError
- }
- };
+ setIsLoading(false);
+ },
+ });
- return (
- Shows all software checks and available hardware Shows the configuration state that changes with the Enable GPU
+ Shows all software checks and available hardware
+
+ Shows the configuration state that changes with the Enable
+ GPU
+
-
- Prerequisites
- Docker Swarm GPU Status
-
+
+ Prerequisites
+
+ Docker Swarm GPU Status
+
+