From a5fb5532fdb7a47c4e5ed008b336aac53af35bca Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sat, 3 May 2025 00:12:49 -0600 Subject: [PATCH] Update drizzle-zod dependency and enhance deployment tracking features - Downgraded the drizzle-zod package from version 0.7.1 to 0.5.1 for compatibility. - Added new fields `startedAt` and `finishedAt` to the deployment schema to track deployment timing. - Enhanced deployment creation logic to set `startedAt` and `finishedAt` timestamps during deployment processes. - Improved the ShowDeployments and ShowSchedulesLogs components to display deployment duration using a new Badge component. - Refactored deployment removal logic to streamline the process of cleaning up old deployments. --- .../deployments/show-deployments.tsx | 22 +- .../schedules/show-schedules-logs.tsx | 27 +- .../deployments/show-deployments-compose.tsx | 22 +- .../drizzle/0096_special_may_parker.sql | 2 + apps/dokploy/drizzle/meta/0096_snapshot.json | 5617 +++++++++++++++++ apps/dokploy/drizzle/meta/_journal.json | 7 + apps/dokploy/package.json | 2 +- packages/server/package.json | 2 +- packages/server/src/db/schema/deployment.ts | 2 + packages/server/src/db/schema/schedule.ts | 4 +- packages/server/src/services/deployment.ts | 197 +- pnpm-lock.yaml | 18 +- 12 files changed, 5763 insertions(+), 159 deletions(-) create mode 100644 apps/dokploy/drizzle/0096_special_may_parker.sql create mode 100644 apps/dokploy/drizzle/meta/0096_snapshot.json diff --git a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx index 76e5bb266..3a46835d7 100644 --- a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx +++ b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx @@ -9,12 +9,13 @@ import { CardTitle, } from "@/components/ui/card"; import { type RouterOutputs, api } from "@/utils/api"; -import { RocketIcon } from "lucide-react"; +import { RocketIcon, Clock } from "lucide-react"; import React, { useEffect, useState } from "react"; import { CancelQueues } from "./cancel-queues"; import { RefreshToken } from "./refresh-token"; import { ShowDeployment } from "./show-deployment"; - +import { Badge } from "@/components/ui/badge"; +import { formatDuration } from "../schedules/show-schedules-logs"; interface Props { applicationId: string; } @@ -96,8 +97,23 @@ export const ShowDeployments = ({ applicationId }: Props) => { )}
-
+
+ {deployment.startedAt && deployment.finishedAt && ( + + + {formatDuration( + Math.floor( + (new Date(deployment.finishedAt).getTime() - + new Date(deployment.startedAt).getTime()) / + 1000, + ), + )} + + )}
-
+
+ {deployment.startedAt && deployment.finishedAt && ( + + + {formatDuration( + Math.floor( + (new Date(deployment.finishedAt).getTime() - + new Date(deployment.startedAt).getTime()) / + 1000, + ), + )} + + )}
-
+
+ {deployment.startedAt && deployment.finishedAt && ( + + + {formatDuration( + Math.floor( + (new Date(deployment.finishedAt).getTime() - + new Date(deployment.startedAt).getTime()) / + 1000, + ), + )} + + )}