diff --git a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx index c2c629dd..d43a3339 100644 --- a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx +++ b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx @@ -15,7 +15,6 @@ 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 { id: string; @@ -24,6 +23,13 @@ interface Props { serverId?: string; } +export const formatDuration = (seconds: number) => { + if (seconds < 60) return `${seconds}s`; + const minutes = Math.floor(seconds / 60); + const remainingSeconds = seconds % 60; + return `${minutes}m ${remainingSeconds}s`; +}; + export const ShowDeployments = ({ id, type, diff --git a/apps/dokploy/components/dashboard/application/schedules/show-schedules-logs.tsx b/apps/dokploy/components/dashboard/application/schedules/show-schedules-logs.tsx deleted file mode 100644 index 64753601..00000000 --- a/apps/dokploy/components/dashboard/application/schedules/show-schedules-logs.tsx +++ /dev/null @@ -1,131 +0,0 @@ -import { DateTooltip } from "@/components/shared/date-tooltip"; -import { StatusTooltip } from "@/components/shared/status-tooltip"; -import { Button } from "@/components/ui/button"; -import { - Dialog, - DialogContent, - DialogDescription, - DialogHeader, - DialogTitle, - DialogTrigger, -} from "@/components/ui/dialog"; - -import type { RouterOutputs } from "@/utils/api"; -import { useState } from "react"; -import { ShowDeployment } from "../deployments/show-deployment"; -import { ClipboardList, Clock } from "lucide-react"; -import { Badge } from "@/components/ui/badge"; - -interface Props { - deployments: RouterOutputs["deployment"]["all"]; - serverId?: string; - children?: React.ReactNode; -} - -export const formatDuration = (seconds: number) => { - if (seconds < 60) return `${seconds}s`; - const minutes = Math.floor(seconds / 60); - const remainingSeconds = seconds % 60; - return `${minutes}m ${remainingSeconds}s`; -}; - -export const ShowSchedulesLogs = ({ - deployments, - serverId, - children, -}: Props) => { - const [activeLog, setActiveLog] = useState< - RouterOutputs["deployment"]["all"][number] | null - >(null); - const [isOpen, setIsOpen] = useState(false); - return ( - - - {children ? ( - children - ) : ( - - )} - - - - Logs - - See all the logs for this schedule - - - {deployments.length > 0 ? ( -
- {deployments.map((deployment, index) => ( -
-
- - {index + 1} {deployment.status} - - - - {deployment.title} - - {deployment.description && ( - - {deployment.description} - - )} -
-
-
- - {deployment.startedAt && deployment.finishedAt && ( - - - {formatDuration( - Math.floor( - (new Date(deployment.finishedAt).getTime() - - new Date(deployment.startedAt).getTime()) / - 1000, - ), - )} - - )} -
- - -
-
- ))} -
- ) : ( -
- -

No logs found

-

This schedule hasn't been executed yet

-
- )} -
- setActiveLog(null)} - logPath={activeLog?.logPath || ""} - errorMessage={activeLog?.errorMessage || ""} - /> -
- ); -};