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 9d1e4bc4..88bcc8fe 100644 --- a/apps/dokploy/components/dashboard/settings/git/show-git-providers.tsx +++ b/apps/dokploy/components/dashboard/settings/git/show-git-providers.tsx @@ -4,7 +4,7 @@ import { GitlabIcon, } from "@/components/icons/data-tools-icons"; import { DialogAction } from "@/components/shared/dialog-action"; -import { Button } from "@/components/ui/button"; +import { Button, buttonVariants } from "@/components/ui/button"; import { Card, CardContent, @@ -14,7 +14,14 @@ import { } from "@/components/ui/card"; import { api } from "@/utils/api"; import { formatDate } from "date-fns"; -import { GitBranch, Loader2, Trash2 } from "lucide-react"; +import { + ExternalLink, + ExternalLinkIcon, + GitBranch, + ImportIcon, + Loader2, + Trash2, +} from "lucide-react"; import { toast } from "sonner"; import { AddBitbucketProvider } from "./bitbucket/add-bitbucket-provider"; import { EditBitbucketProvider } from "./bitbucket/edit-bitbucket-provider"; @@ -22,12 +29,27 @@ 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 Link from "next/link"; +import { useUrl } from "@/utils/hooks/use-url"; export const ShowGitProviders = () => { const { data, isLoading, refetch } = api.gitProvider.getAll.useQuery(); const { mutateAsync, isLoading: isRemoving } = api.gitProvider.remove.useMutation(); + const url = useUrl(); + const getGitlabUrl = ( + clientId: string, + gitlabId: string, + gitlabUrl: string, + ) => { + const redirectUri = `${url}/api/providers/gitlab/callback?gitlabId=${gitlabId}`; + const scope = "api read_user read_repository"; + + const authUrl = `${gitlabUrl}/oauth/authorize?client_id=${clientId}&redirect_uri=${encodeURIComponent(redirectUri)}&response_type=code&scope=${encodeURIComponent(scope)}`; + + return authUrl; + }; return (
@@ -128,6 +150,51 @@ export const ShowGitProviders = () => {
+ {!haveGithubRequirements && isGithub && ( +
+ + + +
+ )} + {haveGithubRequirements && isGithub && ( +
+ + + +
+ )} + {!haveGitlabRequirements && isGitlab && ( +
+ + + +
+ )} {isGithub && haveGithubRequirements && ( - {isError && ( - - {error?.message} - - )}

@@ -114,6 +109,11 @@ export default function Home({ IS_CLOUD }: Props) { Enter your email and password to sign in

+ {isError && ( + + {error?.message} + + )} {!temp.is2FAEnabled ? (