mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
revert: add missing installation buttons
This commit is contained in:
parent
dd3fccea02
commit
b0b22224c3
@ -4,7 +4,7 @@ import {
|
|||||||
GitlabIcon,
|
GitlabIcon,
|
||||||
} from "@/components/icons/data-tools-icons";
|
} from "@/components/icons/data-tools-icons";
|
||||||
import { DialogAction } from "@/components/shared/dialog-action";
|
import { DialogAction } from "@/components/shared/dialog-action";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button, buttonVariants } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
CardContent,
|
CardContent,
|
||||||
@ -14,7 +14,14 @@ import {
|
|||||||
} from "@/components/ui/card";
|
} from "@/components/ui/card";
|
||||||
import { api } from "@/utils/api";
|
import { api } from "@/utils/api";
|
||||||
import { formatDate } from "date-fns";
|
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 { toast } from "sonner";
|
||||||
import { AddBitbucketProvider } from "./bitbucket/add-bitbucket-provider";
|
import { AddBitbucketProvider } from "./bitbucket/add-bitbucket-provider";
|
||||||
import { EditBitbucketProvider } from "./bitbucket/edit-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 { EditGithubProvider } from "./github/edit-github-provider";
|
||||||
import { AddGitlabProvider } from "./gitlab/add-gitlab-provider";
|
import { AddGitlabProvider } from "./gitlab/add-gitlab-provider";
|
||||||
import { EditGitlabProvider } from "./gitlab/edit-gitlab-provider";
|
import { EditGitlabProvider } from "./gitlab/edit-gitlab-provider";
|
||||||
|
import Link from "next/link";
|
||||||
|
import { useUrl } from "@/utils/hooks/use-url";
|
||||||
|
|
||||||
export const ShowGitProviders = () => {
|
export const ShowGitProviders = () => {
|
||||||
const { data, isLoading, refetch } = api.gitProvider.getAll.useQuery();
|
const { data, isLoading, refetch } = api.gitProvider.getAll.useQuery();
|
||||||
const { mutateAsync, isLoading: isRemoving } =
|
const { mutateAsync, isLoading: isRemoving } =
|
||||||
api.gitProvider.remove.useMutation();
|
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 (
|
return (
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<Card className="h-full bg-sidebar p-2.5 rounded-xl max-w-5xl mx-auto">
|
<Card className="h-full bg-sidebar p-2.5 rounded-xl max-w-5xl mx-auto">
|
||||||
@ -128,6 +150,51 @@ export const ShowGitProviders = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-row gap-1">
|
<div className="flex flex-row gap-1">
|
||||||
|
{!haveGithubRequirements && isGithub && (
|
||||||
|
<div className="flex flex-col gap-1">
|
||||||
|
<Link
|
||||||
|
href={`${gitProvider?.github?.githubAppName}/installations/new?state=gh_setup:${gitProvider?.github.githubId}`}
|
||||||
|
className={buttonVariants({
|
||||||
|
size: "icon",
|
||||||
|
variant: "ghost",
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<ImportIcon className="size-4 text-primary" />
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{haveGithubRequirements && isGithub && (
|
||||||
|
<div className="flex flex-col gap-1">
|
||||||
|
<Link
|
||||||
|
href={`${gitProvider?.github?.githubAppName}`}
|
||||||
|
target="_blank"
|
||||||
|
className={buttonVariants({
|
||||||
|
size: "icon",
|
||||||
|
variant: "ghost",
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<ExternalLinkIcon className="size-4 text-primary" />
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{!haveGitlabRequirements && isGitlab && (
|
||||||
|
<div className="flex flex-col gap-1">
|
||||||
|
<Link
|
||||||
|
href={getGitlabUrl(
|
||||||
|
gitProvider.gitlab?.applicationId || "",
|
||||||
|
gitProvider.gitlab?.gitlabId || "",
|
||||||
|
gitProvider.gitlab?.gitlabUrl,
|
||||||
|
)}
|
||||||
|
target="_blank"
|
||||||
|
className={buttonVariants({
|
||||||
|
size: "icon",
|
||||||
|
variant: "ghost",
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<ImportIcon className="size-4 text-primary" />
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{isGithub && haveGithubRequirements && (
|
{isGithub && haveGithubRequirements && (
|
||||||
<EditGithubProvider
|
<EditGithubProvider
|
||||||
githubId={gitProvider.github.githubId}
|
githubId={gitProvider.github.githubId}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dokploy",
|
"name": "dokploy",
|
||||||
"version": "v0.17.1",
|
"version": "v0.17.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
@ -98,11 +98,6 @@ export default function Home({ IS_CLOUD }: Props) {
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isError && (
|
|
||||||
<AlertBlock type="error" className="mx-4 my-2">
|
|
||||||
<span>{error?.message}</span>
|
|
||||||
</AlertBlock>
|
|
||||||
)}
|
|
||||||
<div className="flex flex-col space-y-2 text-center">
|
<div className="flex flex-col space-y-2 text-center">
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">
|
<h1 className="text-2xl font-semibold tracking-tight">
|
||||||
<div className="flex flex-row items-center justify-center gap-2">
|
<div className="flex flex-row items-center justify-center gap-2">
|
||||||
@ -114,6 +109,11 @@ export default function Home({ IS_CLOUD }: Props) {
|
|||||||
Enter your email and password to sign in
|
Enter your email and password to sign in
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
{isError && (
|
||||||
|
<AlertBlock type="error" className="my-2">
|
||||||
|
<span>{error?.message}</span>
|
||||||
|
</AlertBlock>
|
||||||
|
)}
|
||||||
<CardContent className="p-0">
|
<CardContent className="p-0">
|
||||||
{!temp.is2FAEnabled ? (
|
{!temp.is2FAEnabled ? (
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
|
Loading…
Reference in New Issue
Block a user