mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-19 04:45:23 +02:00
* feat: update dependencies and enhance UI components in Dokploy - Updated various package versions in pnpm-lock.yaml to improve compatibility and performance, including React and Tailwind CSS. - Modified components.json to change the styling to "radix-nova" and added new properties for icon library and menu color. - Refactored multiple components to use updated class names for better styling consistency and responsiveness. - Removed unused Radix UI components from package.json to streamline dependencies. - Adjusted layout and styling in several dashboard components for improved user experience and visual appeal. - Enhanced tooltip and form item components for better accessibility and usability. * refactor: enhance UI components in HandleCertificate and SidebarLogo - Updated the HandleCertificate component to improve dialog content height and textarea styling for better usability. - Adjusted the SidebarLogo component layout to enhance alignment and spacing, ensuring a more consistent appearance across the sidebar. - Implemented responsive design adjustments to textarea elements, preventing overflow and improving user experience. * refactor: improve UI consistency and styling across dashboard components - Updated Card components in ShowDeployments, ShowSchedules, and ShowVolumeBackups to remove unnecessary border styles for a cleaner look. - Enhanced TabsList components in ShowProviderForm and ShowProviderFormCompose by adding a variant for improved visual distinction. - Adjusted spacing in AdvancedEnvironmentSelector for better layout and readability. - Removed redundant border classes in Service component for a more streamlined design. * [autofix.ci] apply automated fixes * chore: update package dependencies and refactor email rendering - Upgraded React and React DOM to version 19.2.7 across multiple packages for improved performance and compatibility. - Updated TSX to version 4.22.4 in various package.json files. - Refactored email rendering from `renderAsync` to `render` in notification utilities and email templates for consistency. - Adjusted Tailwind configuration usage in email templates to utilize a centralized configuration file. These changes enhance the overall stability and maintainability of the codebase. * refactor: update badge variants across dashboard components - Changed badge variant from "outline-solid" to "outline" in multiple components including columns, show-domains, and various deployment tables for consistency in styling. - Updated button variants in billing and project templates to align with the new badge styling. - Enhanced input components to support password generation and error messaging, improving user experience. These changes streamline the UI and ensure a cohesive design across the application. * refactor: clean up calendar component imports and structure - Removed redundant imports of icons from lucide-react and streamlined the import statements for better readability. - Adjusted the placement of type imports to enhance code organization. These changes improve the maintainability and clarity of the calendar component. * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
286 lines
10 KiB
TypeScript
286 lines
10 KiB
TypeScript
import { CodeIcon, GitBranch, Loader2 } from "lucide-react";
|
|
import Link from "next/link";
|
|
import { useState } from "react";
|
|
import { toast } from "sonner";
|
|
import { UnauthorizedGitProvider } from "@/components/dashboard/application/general/generic/unauthorized-git-provider";
|
|
import {
|
|
BitbucketIcon,
|
|
GiteaIcon,
|
|
GithubIcon,
|
|
GitIcon,
|
|
GitlabIcon,
|
|
} from "@/components/icons/data-tools-icons";
|
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
import { api } from "@/utils/api";
|
|
import { ComposeFileEditor } from "../compose-file-editor";
|
|
import { ShowConvertedCompose } from "../show-converted-compose";
|
|
import { SaveBitbucketProviderCompose } from "./save-bitbucket-provider-compose";
|
|
import { SaveGitProviderCompose } from "./save-git-provider-compose";
|
|
import { SaveGiteaProviderCompose } from "./save-gitea-provider-compose";
|
|
import { SaveGithubProviderCompose } from "./save-github-provider-compose";
|
|
import { SaveGitlabProviderCompose } from "./save-gitlab-provider-compose";
|
|
|
|
type TabState = "github" | "git" | "raw" | "gitlab" | "bitbucket" | "gitea";
|
|
interface Props {
|
|
composeId: string;
|
|
}
|
|
|
|
export const ShowProviderFormCompose = ({ composeId }: Props) => {
|
|
const { data: githubProviders, isPending: isLoadingGithub } =
|
|
api.github.githubProviders.useQuery();
|
|
const { data: gitlabProviders, isPending: isLoadingGitlab } =
|
|
api.gitlab.gitlabProviders.useQuery();
|
|
const { data: bitbucketProviders, isPending: isLoadingBitbucket } =
|
|
api.bitbucket.bitbucketProviders.useQuery();
|
|
const { data: giteaProviders, isPending: isLoadingGitea } =
|
|
api.gitea.giteaProviders.useQuery();
|
|
|
|
const { mutateAsync: disconnectGitProvider } =
|
|
api.compose.disconnectGitProvider.useMutation();
|
|
|
|
const { data: compose, refetch } = api.compose.one.useQuery({ composeId });
|
|
const [tab, setSab] = useState<TabState>(compose?.sourceType || "github");
|
|
|
|
const isLoading =
|
|
isLoadingGithub || isLoadingGitlab || isLoadingBitbucket || isLoadingGitea;
|
|
|
|
const handleDisconnect = async () => {
|
|
try {
|
|
await disconnectGitProvider({ composeId });
|
|
toast.success("Repository disconnected successfully");
|
|
await refetch();
|
|
} catch (error) {
|
|
toast.error(
|
|
`Failed to disconnect repository: ${
|
|
error instanceof Error ? error.message : "Unknown error"
|
|
}`,
|
|
);
|
|
}
|
|
};
|
|
|
|
if (isLoading) {
|
|
return (
|
|
<Card className="group relative w-full bg-transparent">
|
|
<CardHeader>
|
|
<CardTitle className="flex items-start justify-between">
|
|
<div className="flex flex-col gap-2">
|
|
<span className="flex flex-col space-y-0.5">Provider</span>
|
|
<p className="flex items-center text-sm font-normal text-muted-foreground">
|
|
Select the source of your code
|
|
</p>
|
|
</div>
|
|
<div className="hidden space-y-1 text-sm font-normal md:block">
|
|
<GitBranch className="size-6 text-muted-foreground" />
|
|
</div>
|
|
</CardTitle>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<div className="flex min-h-[25vh] items-center justify-center">
|
|
<div className="flex items-center gap-2 text-muted-foreground">
|
|
<Loader2 className="size-4 animate-spin" />
|
|
<span>Loading providers...</span>
|
|
</div>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
}
|
|
|
|
// Check if user doesn't have access to the current git provider
|
|
if (
|
|
compose &&
|
|
!compose.hasGitProviderAccess &&
|
|
compose.sourceType !== "raw"
|
|
) {
|
|
return (
|
|
<Card className="group relative w-full bg-transparent">
|
|
<CardHeader>
|
|
<CardTitle className="flex items-start justify-between">
|
|
<div className="flex flex-col gap-2">
|
|
<span className="flex flex-col space-y-0.5">Provider</span>
|
|
<p className="flex items-center text-sm font-normal text-muted-foreground">
|
|
Repository connection through unauthorized provider
|
|
</p>
|
|
</div>
|
|
<div className="hidden space-y-1 text-sm font-normal md:block">
|
|
<GitBranch className="size-6 text-muted-foreground" />
|
|
</div>
|
|
</CardTitle>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<UnauthorizedGitProvider
|
|
service={compose}
|
|
onDisconnect={handleDisconnect}
|
|
/>
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Card className="group relative w-full bg-transparent">
|
|
<CardHeader>
|
|
<CardTitle className="flex items-start justify-between">
|
|
<div className="flex flex-col gap-2">
|
|
<span className="flex flex-col space-y-0.5">Provider</span>
|
|
<p className="flex items-center text-sm font-normal text-muted-foreground">
|
|
Select the source of your code
|
|
</p>
|
|
</div>
|
|
<div className="hidden space-y-1 text-sm font-normal md:flex flex-row items-center gap-2">
|
|
<ShowConvertedCompose composeId={composeId} />
|
|
<GitBranch className="size-6 text-muted-foreground" />
|
|
</div>
|
|
</CardTitle>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<Tabs
|
|
value={tab}
|
|
className="w-full"
|
|
onValueChange={(e) => {
|
|
setSab(e as TabState);
|
|
}}
|
|
>
|
|
<div className="flex flex-row items-center justify-between w-full overflow-auto">
|
|
<TabsList
|
|
variant="line"
|
|
className="flex gap-4 justify-start bg-transparent"
|
|
>
|
|
<TabsTrigger
|
|
value="github"
|
|
className="rounded-none border-b-2 gap-2 border-b-transparent data-[state=active]:border-b-2 data-[state=active]:border-b-border"
|
|
>
|
|
<GithubIcon className="size-4 text-current fill-current" />
|
|
GitHub
|
|
</TabsTrigger>
|
|
<TabsTrigger
|
|
value="gitlab"
|
|
className="rounded-none border-b-2 gap-2 border-b-transparent data-[state=active]:border-b-2 data-[state=active]:border-b-border"
|
|
>
|
|
<GitlabIcon className="size-4 text-current fill-current" />
|
|
GitLab
|
|
</TabsTrigger>
|
|
<TabsTrigger
|
|
value="bitbucket"
|
|
className="rounded-none border-b-2 gap-2 border-b-transparent data-[state=active]:border-b-2 data-[state=active]:border-b-border"
|
|
>
|
|
<BitbucketIcon className="size-4 text-current fill-current" />
|
|
Bitbucket
|
|
</TabsTrigger>
|
|
<TabsTrigger
|
|
value="gitea"
|
|
className="rounded-none border-b-2 gap-2 border-b-transparent data-[state=active]:border-b-2 data-[state=active]:border-b-border"
|
|
>
|
|
<GiteaIcon className="size-4 text-current fill-current" /> Gitea
|
|
</TabsTrigger>
|
|
<TabsTrigger
|
|
value="git"
|
|
className="rounded-none border-b-2 gap-2 border-b-transparent data-[state=active]:border-b-2 data-[state=active]:border-b-border"
|
|
>
|
|
<GitIcon />
|
|
Git
|
|
</TabsTrigger>
|
|
<TabsTrigger
|
|
value="raw"
|
|
className="rounded-none border-b-2 gap-2 border-b-transparent data-[state=active]:border-b-2 data-[state=active]:border-b-border"
|
|
>
|
|
<CodeIcon className="size-4" />
|
|
Raw
|
|
</TabsTrigger>
|
|
</TabsList>
|
|
</div>
|
|
|
|
<TabsContent value="github" className="w-full p-2">
|
|
{githubProviders && githubProviders?.length > 0 ? (
|
|
<SaveGithubProviderCompose composeId={composeId} />
|
|
) : (
|
|
<div className="flex flex-col items-center gap-3 min-h-[25vh] justify-center">
|
|
<GithubIcon className="size-8 text-muted-foreground" />
|
|
<span className="text-base text-muted-foreground">
|
|
To deploy using GitHub, you need to configure your account
|
|
first. Please, go to{" "}
|
|
<Link
|
|
href="/dashboard/settings/git-providers"
|
|
className="text-foreground"
|
|
>
|
|
Settings
|
|
</Link>{" "}
|
|
to do so.
|
|
</span>
|
|
</div>
|
|
)}
|
|
</TabsContent>
|
|
<TabsContent value="gitlab" className="w-full p-2">
|
|
{gitlabProviders && gitlabProviders?.length > 0 ? (
|
|
<SaveGitlabProviderCompose composeId={composeId} />
|
|
) : (
|
|
<div className="flex flex-col items-center gap-3 min-h-[25vh] justify-center">
|
|
<GitlabIcon className="size-8 text-muted-foreground" />
|
|
<span className="text-base text-muted-foreground">
|
|
To deploy using GitLab, you need to configure your account
|
|
first. Please, go to{" "}
|
|
<Link
|
|
href="/dashboard/settings/git-providers"
|
|
className="text-foreground"
|
|
>
|
|
Settings
|
|
</Link>{" "}
|
|
to do so.
|
|
</span>
|
|
</div>
|
|
)}
|
|
</TabsContent>
|
|
<TabsContent value="bitbucket" className="w-full p-2">
|
|
{bitbucketProviders && bitbucketProviders?.length > 0 ? (
|
|
<SaveBitbucketProviderCompose composeId={composeId} />
|
|
) : (
|
|
<div className="flex flex-col items-center gap-3 min-h-[25vh] justify-center">
|
|
<BitbucketIcon className="size-8 text-muted-foreground" />
|
|
<span className="text-base text-muted-foreground">
|
|
To deploy using Bitbucket, you need to configure your account
|
|
first. Please, go to{" "}
|
|
<Link
|
|
href="/dashboard/settings/git-providers"
|
|
className="text-foreground"
|
|
>
|
|
Settings
|
|
</Link>{" "}
|
|
to do so.
|
|
</span>
|
|
</div>
|
|
)}
|
|
</TabsContent>
|
|
<TabsContent value="gitea" className="w-full p-2">
|
|
{giteaProviders && giteaProviders?.length > 0 ? (
|
|
<SaveGiteaProviderCompose composeId={composeId} />
|
|
) : (
|
|
<div className="flex flex-col items-center gap-3 min-h-[25vh] justify-center">
|
|
<GiteaIcon className="size-8 text-muted-foreground" />
|
|
<span className="text-base text-muted-foreground">
|
|
To deploy using Gitea, you need to configure your account
|
|
first. Please, go to{" "}
|
|
<Link
|
|
href="/dashboard/settings/git-providers"
|
|
className="text-foreground"
|
|
>
|
|
Settings
|
|
</Link>{" "}
|
|
to do so.
|
|
</span>
|
|
</div>
|
|
)}
|
|
</TabsContent>
|
|
<TabsContent value="git" className="w-full p-2">
|
|
<SaveGitProviderCompose composeId={composeId} />
|
|
</TabsContent>
|
|
|
|
<TabsContent value="raw" className="w-full p-2 flex flex-col gap-4">
|
|
<ComposeFileEditor composeId={composeId} />
|
|
</TabsContent>
|
|
</Tabs>
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
};
|