-
-
Notifications
You must be signed in to change notification settings - Fork 581
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #847 from Dokploy/feat/improve-server-setup
Feat/improve server setup
- Loading branch information
Showing
6 changed files
with
340 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
apps/dokploy/components/dashboard/settings/servers/validate-server.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
import { AlertBlock } from "@/components/shared/alert-block"; | ||
import { | ||
Card, | ||
CardContent, | ||
CardDescription, | ||
CardHeader, | ||
CardTitle, | ||
} from "@/components/ui/card"; | ||
import { api } from "@/utils/api"; | ||
import { Loader2, PcCase, RefreshCw } from "lucide-react"; | ||
import { StatusRow } from "./gpu-support"; | ||
import { Button } from "@/components/ui/button"; | ||
import { useState } from "react"; | ||
|
||
interface Props { | ||
serverId: string; | ||
} | ||
|
||
export const ValidateServer = ({ serverId }: Props) => { | ||
const [isRefreshing, setIsRefreshing] = useState(false); | ||
const { data, refetch, error, isLoading, isError } = | ||
api.server.validate.useQuery( | ||
{ serverId }, | ||
{ | ||
enabled: !!serverId, | ||
}, | ||
); | ||
const utils = api.useUtils(); | ||
return ( | ||
<CardContent className="p-0"> | ||
<div className="flex flex-col gap-4"> | ||
<Card className="bg-background"> | ||
<CardHeader className="flex flex-row items-center justify-between flex-wrap gap-2"> | ||
<div className="flex flex-row gap-2 justify-between w-full max-sm:flex-col"> | ||
<div className="flex flex-col gap-1"> | ||
<div className="flex items-center gap-2"> | ||
<PcCase className="size-5" /> | ||
<CardTitle className="text-xl">Setup Validation</CardTitle> | ||
</div> | ||
<CardDescription> | ||
Check if your server is ready for deployment | ||
</CardDescription> | ||
</div> | ||
<Button | ||
isLoading={isRefreshing} | ||
onClick={async () => { | ||
setIsRefreshing(true); | ||
await refetch(); | ||
setIsRefreshing(false); | ||
}} | ||
> | ||
<RefreshCw className="size-4" /> | ||
Refresh | ||
</Button> | ||
</div> | ||
<div className="flex items-center gap-2 w-full"> | ||
{isError && ( | ||
<AlertBlock type="error" className="w-full"> | ||
{error.message} | ||
</AlertBlock> | ||
)} | ||
</div> | ||
</CardHeader> | ||
|
||
<CardContent className="flex flex-col gap-4"> | ||
{isLoading ? ( | ||
<div className="flex items-center justify-center text-muted-foreground py-4"> | ||
<Loader2 className="mr-2 h-4 w-4 animate-spin" /> | ||
<span>Checking Server Configuration</span> | ||
</div> | ||
) : ( | ||
<div className="grid w-full gap-4"> | ||
<div className="border rounded-lg p-4"> | ||
<h3 className="text-lg font-semibold mb-1">Status</h3> | ||
<p className="text-sm text-muted-foreground mb-4"> | ||
Shows the server configuration status | ||
</p> | ||
<div className="grid gap-2.5"> | ||
<StatusRow | ||
label="Docker Installed" | ||
isEnabled={data?.docker?.enabled} | ||
description={ | ||
data?.docker?.enabled | ||
? `Installed: ${data?.docker?.version}` | ||
: undefined | ||
} | ||
/> | ||
<StatusRow | ||
label="RClone Installed" | ||
isEnabled={data?.rclone?.enabled} | ||
description={ | ||
data?.rclone?.enabled | ||
? `Installed: ${data?.rclone?.version}` | ||
: undefined | ||
} | ||
/> | ||
<StatusRow | ||
label="Nixpacks Installed" | ||
isEnabled={data?.nixpacks?.enabled} | ||
description={ | ||
data?.nixpacks?.enabled | ||
? `Installed: ${data?.nixpacks?.version}` | ||
: undefined | ||
} | ||
/> | ||
<StatusRow | ||
label="Buildpacks Installed" | ||
isEnabled={data?.buildpacks?.enabled} | ||
description={ | ||
data?.buildpacks?.enabled | ||
? `Installed: ${data?.buildpacks?.version}` | ||
: undefined | ||
} | ||
/> | ||
<StatusRow | ||
label="Dokploy Network Installed" | ||
isEnabled={data?.isDokployNetworkInstalled} | ||
/> | ||
<StatusRow | ||
label="Swarm Installed" | ||
isEnabled={data?.isSwarmInstalled} | ||
/> | ||
<StatusRow | ||
label="Main Directory Created" | ||
isEnabled={data?.isMainDirectoryInstalled} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
)} | ||
</CardContent> | ||
</Card> | ||
</div> | ||
</CardContent> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.