diff --git a/apps/dokploy/components/dashboard/application/general/generic/show.tsx b/apps/dokploy/components/dashboard/application/general/generic/show.tsx index 9b9a0ba05..905fe7113 100644 --- a/apps/dokploy/components/dashboard/application/general/generic/show.tsx +++ b/apps/dokploy/components/dashboard/application/general/generic/show.tsx @@ -13,7 +13,7 @@ import { import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { api } from "@/utils/api"; -import { GitBranch, UploadCloud } from "lucide-react"; +import { GitBranch, Loader2, UploadCloud } from "lucide-react"; import Link from "next/link"; import { useState } from "react"; import { SaveBitbucketProvider } from "./save-bitbucket-provider"; @@ -34,14 +34,49 @@ interface Props { } export const ShowProviderForm = ({ applicationId }: Props) => { - const { data: githubProviders } = api.github.githubProviders.useQuery(); - const { data: gitlabProviders } = api.gitlab.gitlabProviders.useQuery(); - const { data: bitbucketProviders } = + const { data: githubProviders, isLoading: isLoadingGithub } = + api.github.githubProviders.useQuery(); + const { data: gitlabProviders, isLoading: isLoadingGitlab } = + api.gitlab.gitlabProviders.useQuery(); + const { data: bitbucketProviders, isLoading: isLoadingBitbucket } = api.bitbucket.bitbucketProviders.useQuery(); - const { data: giteaProviders } = api.gitea.giteaProviders.useQuery(); + const { data: giteaProviders, isLoading: isLoadingGitea } = + api.gitea.giteaProviders.useQuery(); const { data: application } = api.application.one.useQuery({ applicationId }); const [tab, setSab] = useState(application?.sourceType || "github"); + + const isLoading = + isLoadingGithub || isLoadingGitlab || isLoadingBitbucket || isLoadingGitea; + + if (isLoading) { + return ( + + + +
+ Provider +

+ Select the source of your code +

+
+
+ +
+
+
+ +
+
+ + Loading providers... +
+
+
+
+ ); + } + return ( @@ -123,7 +158,7 @@ export const ShowProviderForm = ({ applicationId }: Props) => { {githubProviders && githubProviders?.length > 0 ? ( ) : ( -
+
To deploy using GitHub, you need to configure your account @@ -143,7 +178,7 @@ export const ShowProviderForm = ({ applicationId }: Props) => { {gitlabProviders && gitlabProviders?.length > 0 ? ( ) : ( -
+
To deploy using GitLab, you need to configure your account @@ -163,7 +198,7 @@ export const ShowProviderForm = ({ applicationId }: Props) => { {bitbucketProviders && bitbucketProviders?.length > 0 ? ( ) : ( -
+
To deploy using Bitbucket, you need to configure your account @@ -183,7 +218,7 @@ export const ShowProviderForm = ({ applicationId }: Props) => { {giteaProviders && giteaProviders?.length > 0 ? ( ) : ( -
+
To deploy using Gitea, you need to configure your account diff --git a/apps/dokploy/components/dashboard/compose/general/generic/show.tsx b/apps/dokploy/components/dashboard/compose/general/generic/show.tsx index 2ac879e87..afdfbfba4 100644 --- a/apps/dokploy/components/dashboard/compose/general/generic/show.tsx +++ b/apps/dokploy/components/dashboard/compose/general/generic/show.tsx @@ -8,7 +8,7 @@ import { import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { api } from "@/utils/api"; -import { CodeIcon, GitBranch } from "lucide-react"; +import { CodeIcon, GitBranch, Loader2 } from "lucide-react"; import Link from "next/link"; import { useState } from "react"; import { ComposeFileEditor } from "../compose-file-editor"; @@ -25,15 +25,49 @@ interface Props { } export const ShowProviderFormCompose = ({ composeId }: Props) => { - const { data: githubProviders } = api.github.githubProviders.useQuery(); - const { data: gitlabProviders } = api.gitlab.gitlabProviders.useQuery(); - const { data: bitbucketProviders } = + const { data: githubProviders, isLoading: isLoadingGithub } = + api.github.githubProviders.useQuery(); + const { data: gitlabProviders, isLoading: isLoadingGitlab } = + api.gitlab.gitlabProviders.useQuery(); + const { data: bitbucketProviders, isLoading: isLoadingBitbucket } = api.bitbucket.bitbucketProviders.useQuery(); - const { data: giteaProviders } = api.gitea.giteaProviders.useQuery(); + const { data: giteaProviders, isLoading: isLoadingGitea } = + api.gitea.giteaProviders.useQuery(); const { data: compose } = api.compose.one.useQuery({ composeId }); const [tab, setSab] = useState(compose?.sourceType || "github"); + const isLoading = + isLoadingGithub || isLoadingGitlab || isLoadingBitbucket || isLoadingGitea; + + if (isLoading) { + return ( + + + +
+ Provider +

+ Select the source of your code +

+
+
+ +
+
+
+ +
+
+ + Loading providers... +
+
+
+
+ ); + } + return ( @@ -108,7 +142,7 @@ export const ShowProviderFormCompose = ({ composeId }: Props) => { {githubProviders && githubProviders?.length > 0 ? ( ) : ( -
+
To deploy using GitHub, you need to configure your account @@ -128,7 +162,7 @@ export const ShowProviderFormCompose = ({ composeId }: Props) => { {gitlabProviders && gitlabProviders?.length > 0 ? ( ) : ( -
+
To deploy using GitLab, you need to configure your account @@ -148,7 +182,7 @@ export const ShowProviderFormCompose = ({ composeId }: Props) => { {bitbucketProviders && bitbucketProviders?.length > 0 ? ( ) : ( -
+
To deploy using Bitbucket, you need to configure your account @@ -168,7 +202,7 @@ export const ShowProviderFormCompose = ({ composeId }: Props) => { {giteaProviders && giteaProviders?.length > 0 ? ( ) : ( -
+
To deploy using Gitea, you need to configure your account