Skip to content

Commit 30d20bd

Browse files
authored
Merge pull request #1101 from Dokploy/canary
v0.17.2
2 parents f2f3986 + f9b1c25 commit 30d20bd

File tree

3 files changed

+74
-8
lines changed

3 files changed

+74
-8
lines changed

apps/dokploy/components/dashboard/settings/git/show-git-providers.tsx

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
GitlabIcon,
55
} from "@/components/icons/data-tools-icons";
66
import { DialogAction } from "@/components/shared/dialog-action";
7-
import { Button } from "@/components/ui/button";
7+
import { Button, buttonVariants } from "@/components/ui/button";
88
import {
99
Card,
1010
CardContent,
@@ -13,8 +13,16 @@ import {
1313
CardTitle,
1414
} from "@/components/ui/card";
1515
import { api } from "@/utils/api";
16+
import { useUrl } from "@/utils/hooks/use-url";
1617
import { formatDate } from "date-fns";
17-
import { GitBranch, Loader2, Trash2 } from "lucide-react";
18+
import {
19+
ExternalLinkIcon,
20+
GitBranch,
21+
ImportIcon,
22+
Loader2,
23+
Trash2,
24+
} from "lucide-react";
25+
import Link from "next/link";
1826
import { toast } from "sonner";
1927
import { AddBitbucketProvider } from "./bitbucket/add-bitbucket-provider";
2028
import { EditBitbucketProvider } from "./bitbucket/edit-bitbucket-provider";
@@ -27,7 +35,20 @@ export const ShowGitProviders = () => {
2735
const { data, isLoading, refetch } = api.gitProvider.getAll.useQuery();
2836
const { mutateAsync, isLoading: isRemoving } =
2937
api.gitProvider.remove.useMutation();
38+
const url = useUrl();
39+
const getGitlabUrl = (
40+
clientId: string,
41+
gitlabId: string,
42+
gitlabUrl: string,
43+
) => {
44+
const redirectUri = `${url}/api/providers/gitlab/callback?gitlabId=${gitlabId}`;
45+
46+
const scope = "api read_user read_repository";
47+
48+
const authUrl = `${gitlabUrl}/oauth/authorize?client_id=${clientId}&redirect_uri=${encodeURIComponent(redirectUri)}&response_type=code&scope=${encodeURIComponent(scope)}`;
3049

50+
return authUrl;
51+
};
3152
return (
3253
<div className="w-full">
3354
<Card className="h-full bg-sidebar p-2.5 rounded-xl max-w-5xl mx-auto">
@@ -128,6 +149,51 @@ export const ShowGitProviders = () => {
128149
</div>
129150

130151
<div className="flex flex-row gap-1">
152+
{!haveGithubRequirements && isGithub && (
153+
<div className="flex flex-col gap-1">
154+
<Link
155+
href={`${gitProvider?.github?.githubAppName}/installations/new?state=gh_setup:${gitProvider?.github.githubId}`}
156+
className={buttonVariants({
157+
size: "icon",
158+
variant: "ghost",
159+
})}
160+
>
161+
<ImportIcon className="size-4 text-primary" />
162+
</Link>
163+
</div>
164+
)}
165+
{haveGithubRequirements && isGithub && (
166+
<div className="flex flex-col gap-1">
167+
<Link
168+
href={`${gitProvider?.github?.githubAppName}`}
169+
target="_blank"
170+
className={buttonVariants({
171+
size: "icon",
172+
variant: "ghost",
173+
})}
174+
>
175+
<ExternalLinkIcon className="size-4 text-primary" />
176+
</Link>
177+
</div>
178+
)}
179+
{!haveGitlabRequirements && isGitlab && (
180+
<div className="flex flex-col gap-1">
181+
<Link
182+
href={getGitlabUrl(
183+
gitProvider.gitlab?.applicationId || "",
184+
gitProvider.gitlab?.gitlabId || "",
185+
gitProvider.gitlab?.gitlabUrl,
186+
)}
187+
target="_blank"
188+
className={buttonVariants({
189+
size: "icon",
190+
variant: "ghost",
191+
})}
192+
>
193+
<ImportIcon className="size-4 text-primary" />
194+
</Link>
195+
</div>
196+
)}
131197
{isGithub && haveGithubRequirements && (
132198
<EditGithubProvider
133199
githubId={gitProvider.github.githubId}

apps/dokploy/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dokploy",
3-
"version": "v0.17.1",
3+
"version": "v0.17.2",
44
"private": true,
55
"license": "Apache-2.0",
66
"type": "module",

apps/dokploy/pages/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,6 @@ export default function Home({ IS_CLOUD }: Props) {
9898
};
9999
return (
100100
<>
101-
{isError && (
102-
<AlertBlock type="error" className="mx-4 my-2">
103-
<span>{error?.message}</span>
104-
</AlertBlock>
105-
)}
106101
<div className="flex flex-col space-y-2 text-center">
107102
<h1 className="text-2xl font-semibold tracking-tight">
108103
<div className="flex flex-row items-center justify-center gap-2">
@@ -114,6 +109,11 @@ export default function Home({ IS_CLOUD }: Props) {
114109
Enter your email and password to sign in
115110
</p>
116111
</div>
112+
{isError && (
113+
<AlertBlock type="error" className="my-2">
114+
<span>{error?.message}</span>
115+
</AlertBlock>
116+
)}
117117
<CardContent className="p-0">
118118
{!temp.is2FAEnabled ? (
119119
<Form {...form}>

0 commit comments

Comments
 (0)