From 8410d94283e7310545ddd5c7ce8aab6c0915421d Mon Sep 17 00:00:00 2001 From: Nicholas Penree Date: Mon, 23 Dec 2024 16:40:36 -0500 Subject: [PATCH] feat(preview-deployments): new UI --- .../show-preview-builds.tsx | 17 +- .../show-preview-deployments.tsx | 253 +++++++++--------- .../show-preview-settings.tsx | 6 +- 3 files changed, 144 insertions(+), 132 deletions(-) diff --git a/apps/dokploy/components/dashboard/application/preview-deployments/show-preview-builds.tsx b/apps/dokploy/components/dashboard/application/preview-deployments/show-preview-builds.tsx index 154510c3..527d76cc 100644 --- a/apps/dokploy/components/dashboard/application/preview-deployments/show-preview-builds.tsx +++ b/apps/dokploy/components/dashboard/application/preview-deployments/show-preview-builds.tsx @@ -18,17 +18,26 @@ import { ShowDeployment } from "../deployments/show-deployment"; interface Props { deployments: RouterOutputs["deployment"]["all"]; serverId?: string; + trigger?: React.ReactNode; } -export const ShowPreviewBuilds = ({ deployments, serverId }: Props) => { +export const ShowPreviewBuilds = ({ + deployments, + serverId, + trigger, +}: Props) => { const [activeLog, setActiveLog] = useState(null); const [isOpen, setIsOpen] = useState(false); return ( - + {trigger ? ( + trigger + ) : ( + + )} diff --git a/apps/dokploy/components/dashboard/application/preview-deployments/show-preview-deployments.tsx b/apps/dokploy/components/dashboard/application/preview-deployments/show-preview-deployments.tsx index c2d712c3..2cff2845 100644 --- a/apps/dokploy/components/dashboard/application/preview-deployments/show-preview-deployments.tsx +++ b/apps/dokploy/components/dashboard/application/preview-deployments/show-preview-deployments.tsx @@ -1,3 +1,4 @@ +import { GithubIcon } from "@/components/icons/data-tools-icons"; import { DateTooltip } from "@/components/shared/date-tooltip"; import { DialogAction } from "@/components/shared/dialog-action"; import { StatusTooltip } from "@/components/shared/status-tooltip"; @@ -10,16 +11,17 @@ import { CardHeader, CardTitle, } from "@/components/ui/card"; -import { Separator } from "@/components/ui/separator"; +import { Input } from "@/components/ui/input"; import { api } from "@/utils/api"; import { - Clock, - GitBranch, + ExternalLink, + FileText, GitPullRequest, - Pencil, + Layers, + PenSquare, RocketIcon, + Trash2, } from "lucide-react"; -import Link from "next/link"; import React from "react"; import { toast } from "sonner"; import { ShowModalLogs } from "../../settings/web-server/show-modal-logs"; @@ -88,136 +90,133 @@ export const ShowPreviewDeployments = ({ applicationId }: Props) => { ) : (
- {previewDeployments.map((previewDeployment) => ( -
-
- - {previewDeployment.pullRequestTitle} - - - - {previewDeployment.previewStatus - ?.replace("running", "Running") - .replace("done", "Done") - .replace("error", "Error") - .replace("idle", "Idle") || "Idle"} - -
+ {previewDeployments?.map((deployment) => { + const deploymentUrl = `${deployment.domain?.https ? "https" : "http"}://${deployment.domain?.host}${deployment.domain?.path || "/"}`; + return ( +
+
-
-
- - {previewDeployment.domain?.host} - - - - - -
- -
-
- - Branch: - - {previewDeployment.branch} +
+
+
+ +
+
+ {deployment.pullRequestTitle} +
+
+ {deployment.branch} +
+
+
+ + +
-
- - Deployed: - - - -
-
- +
+
+ + window.open(deploymentUrl, "_blank") + } + /> + +
-
-

- Pull Request -

-
- - - {previewDeployment.pullRequestTitle} - +
+ + + + + + + + Builds + + } + /> + + + + + + handleDeletePreviewDeployment( + deployment.previewDeploymentId, + ) + } + > + + +
- -
-
- - - - - - - - handleDeletePreviewDeployment( - previewDeployment.previewDeploymentId, - ) - } - > - - -
-
-
- ))} + ); + })}
)} diff --git a/apps/dokploy/components/dashboard/application/preview-deployments/show-preview-settings.tsx b/apps/dokploy/components/dashboard/application/preview-deployments/show-preview-settings.tsx index 0e4231eb..04691a6a 100644 --- a/apps/dokploy/components/dashboard/application/preview-deployments/show-preview-settings.tsx +++ b/apps/dokploy/components/dashboard/application/preview-deployments/show-preview-settings.tsx @@ -29,6 +29,7 @@ import { import { Switch } from "@/components/ui/switch"; import { api } from "@/utils/api"; import { zodResolver } from "@hookform/resolvers/zod"; +import { Settings2 } from "lucide-react"; import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; @@ -116,7 +117,10 @@ export const ShowPreviewSettings = ({ applicationId }: Props) => {
- +