diff --git a/apps/dokploy/components/dashboard/project/add-application.tsx b/apps/dokploy/components/dashboard/project/add-application.tsx index 9ed31464a..a6946df7d 100644 --- a/apps/dokploy/components/dashboard/project/add-application.tsx +++ b/apps/dokploy/components/dashboard/project/add-application.tsx @@ -1,3 +1,9 @@ +import { zodResolver } from "@hookform/resolvers/zod"; +import { Folder, HelpCircle } from "lucide-react"; +import { useState } from "react"; +import { useForm } from "react-hook-form"; +import { toast } from "sonner"; +import { z } from "zod"; import { AlertBlock } from "@/components/shared/alert-block"; import { Button } from "@/components/ui/button"; import { @@ -37,12 +43,6 @@ import { } from "@/components/ui/tooltip"; import { slugify } from "@/lib/slug"; import { api } from "@/utils/api"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { Folder, HelpCircle } from "lucide-react"; -import { useState } from "react"; -import { useForm } from "react-hook-form"; -import { toast } from "sonner"; -import { z } from "zod"; const AddTemplateSchema = z.object({ name: z.string().min(1, { @@ -75,6 +75,8 @@ export const AddApplication = ({ projectId, projectName }: Props) => { const slug = slugify(projectName); const { data: servers } = api.server.withSSHKey.useQuery(); + const hasServers = servers && servers.length > 0; + const { mutateAsync, isLoading, error, isError } = api.application.create.useMutation(); @@ -155,62 +157,64 @@ export const AddApplication = ({ projectId, projectName }: Props) => { )} /> - ( - - - - - - Select a Server {!isCloud ? "(Optional)" : ""} - - - - - - If no server is selected, the application will be - deployed on the server where the user is logged in. - - - - + {hasServers && ( + ( + + + + + + Select a Server {!isCloud ? "(Optional)" : ""} + + + + + + If no server is selected, the application will be + deployed on the server where the user is logged in. + + + + - + + + + + + {servers?.map((server) => ( + + + {server.name} + + {server.ipAddress} + - - - ))} - Servers ({servers?.length}) - - - - - - )} - /> + + ))} + Servers ({servers?.length}) + + + + + + )} + /> + )} { const { mutateAsync, isLoading, error, isError } = api.compose.create.useMutation(); + const hasServers = servers && servers.length > 0; + const form = useForm({ defaultValues: { name: "", @@ -163,62 +165,64 @@ export const AddCompose = ({ projectId, projectName }: Props) => { )} /> - ( - - - - - - Select a Server {!isCloud ? "(Optional)" : ""} - - - - - - If no server is selected, the application will be - deployed on the server where the user is logged in. - - - - + {hasServers && ( + ( + + + + + + Select a Server {!isCloud ? "(Optional)" : ""} + + + + + + If no server is selected, the application will be + deployed on the server where the user is logged in. + + + + - + + + + + + {servers?.map((server) => ( + + + {server.name} + + {server.ipAddress} + - - - ))} - Servers ({servers?.length}) - - - - - - )} - /> + + ))} + Servers ({servers?.length}) + + + + + + )} + /> + )} { const mariadbMutation = api.mariadb.create.useMutation(); const mysqlMutation = api.mysql.create.useMutation(); + const hasServers = servers && servers.length > 0; + const form = useForm({ defaultValues: { type: "postgres", @@ -374,39 +376,41 @@ export const AddDatabase = ({ projectId, projectName }: Props) => { )} /> - ( - - Select a Server - - - - )} - /> + {hasServers && ( + ( + + Select a Server + + + + )} + /> + )} { return matchesTags && matchesQuery; }) || []; + const hasServers = servers && servers.length > 0; + return ( @@ -425,60 +427,62 @@ export const AddTemplate = ({ projectId, baseUrl }: Props) => { project. -
- - - - - - - - If no server is selected, the application - will be deployed on the server where the - user is logged in. - - - - + {hasServers && ( +
+ + + + + + + + If no server is selected, the + application will be deployed on the + server where the user is logged in. + + + + - { + setServerId(e); + }} + > + + + + + + {servers?.map((server) => ( + + + {server.name} + + {server.ipAddress} + - - - ))} - - Servers ({servers?.length}) - - - - -
+ + ))} + + Servers ({servers?.length}) + + + + +
+ )} Cancel diff --git a/apps/dokploy/components/dashboard/project/ai/step-one.tsx b/apps/dokploy/components/dashboard/project/ai/step-one.tsx index e2a6795fe..29cf90305 100644 --- a/apps/dokploy/components/dashboard/project/ai/step-one.tsx +++ b/apps/dokploy/components/dashboard/project/ai/step-one.tsx @@ -25,6 +25,7 @@ const examples = [ export const StepOne = ({ setTemplateInfo, templateInfo }: any) => { // Get servers from the API const { data: servers } = api.server.withSSHKey.useQuery(); + const hasServers = servers && servers.length > 0; const handleExampleClick = (example: string) => { setTemplateInfo({ ...templateInfo, userInput: example }); @@ -47,37 +48,39 @@ export const StepOne = ({ setTemplateInfo, templateInfo }: any) => { /> -
- - -
+ {hasServers && ( +
+ + +
+ )}
diff --git a/apps/dokploy/components/dashboard/settings/git/show-git-providers.tsx b/apps/dokploy/components/dashboard/settings/git/show-git-providers.tsx index 05273ca2a..eda9d8afb 100644 --- a/apps/dokploy/components/dashboard/settings/git/show-git-providers.tsx +++ b/apps/dokploy/components/dashboard/settings/git/show-git-providers.tsx @@ -33,6 +33,7 @@ import { AddGithubProvider } from "./github/add-github-provider"; import { EditGithubProvider } from "./github/edit-github-provider"; import { AddGitlabProvider } from "./gitlab/add-gitlab-provider"; import { EditGitlabProvider } from "./gitlab/edit-gitlab-provider"; +import { Badge } from "@/components/ui/badge"; export const ShowGitProviders = () => { const { data, isLoading, refetch } = api.gitProvider.getAll.useQuery(); @@ -158,7 +159,13 @@ export const ShowGitProviders = () => {
{!haveGithubRequirements && isGithub && ( -
+
+ + Action Required + {
)} {!haveGitlabRequirements && isGitlab && ( -
+
+ + Action Required +