From 7b9abef68726a611870f7156c007bfac27aab28f Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Thu, 22 Aug 2024 00:02:02 -0600 Subject: [PATCH] refactor: add localhos traefik domains --- .../components/dashboard/requests/columns.tsx | 25 ++++ apps/dokploy/pages/dashboard/requests.tsx | 125 +----------------- apps/dokploy/templates/utils/index.ts | 2 +- 3 files changed, 27 insertions(+), 125 deletions(-) diff --git a/apps/dokploy/components/dashboard/requests/columns.tsx b/apps/dokploy/components/dashboard/requests/columns.tsx index 7e5765d5..0d8de250 100644 --- a/apps/dokploy/components/dashboard/requests/columns.tsx +++ b/apps/dokploy/components/dashboard/requests/columns.tsx @@ -11,6 +11,7 @@ import { import { Badge } from "@/components/ui/badge"; import type { LogEntry } from "./show-requests"; +import { format } from "date-fns"; export const columns: ColumnDef[] = [ { @@ -65,6 +66,30 @@ export const columns: ColumnDef[] = [ ); }, }, + { + accessorKey: "time", + header: ({ column }) => { + return ( + + ); + }, + cell: ({ row }) => { + const log = row.original; + return ( +
+
+ {format(new Date(log.time), "yyyy-MM-dd HH:mm:ss")} +
+
+ ); + }, + }, { id: "actions", enableHiding: false, diff --git a/apps/dokploy/pages/dashboard/requests.tsx b/apps/dokploy/pages/dashboard/requests.tsx index 5b48d71a..3ea739f5 100644 --- a/apps/dokploy/pages/dashboard/requests.tsx +++ b/apps/dokploy/pages/dashboard/requests.tsx @@ -6,130 +6,7 @@ import * as React from "react"; import { ShowRequests } from "@/components/dashboard/requests/show-requests"; export default function Requests() { - return ( - <> - {/* - - Request Distribution - - Showing web and API requests over time - - - - - - - - - new Date(value).toLocaleTimeString([], { - hour: "2-digit", - minute: "2-digit", - }) - } - /> - - } - labelFormatter={(value) => - new Date(value).toLocaleString([], { - month: "short", - day: "numeric", - hour: "2-digit", - minute: "2-digit", - }) - } - /> - - - - - - */} - - {/*
- - See all users - - - Level - Message - Created - Actions - - - - {data?.data?.map((log, index) => { - return ( - console.log(log)} - > - - {log.level} - - -
- {log.RequestMethod} {log.RequestPath} -
-
- - Status: {log.OriginStatus} - - - Exec Time: {log.Duration} ms - - {log.ClientAddr} -
-
- - {new Date(log.time).toLocaleString([], { - month: "short", - day: "numeric", - hour: "2-digit", - minute: "2-digit", - })} - - - - - - - - Actions - - - -
- ); - })} -
-
-
*/} - - - ); + return ; } Requests.getLayout = (page: ReactElement) => { return {page}; diff --git a/apps/dokploy/templates/utils/index.ts b/apps/dokploy/templates/utils/index.ts index 9040e83a..7be92dad 100644 --- a/apps/dokploy/templates/utils/index.ts +++ b/apps/dokploy/templates/utils/index.ts @@ -28,7 +28,7 @@ export const generateRandomDomain = ({ }: Schema): string => { const hash = randomBytes(3).toString("hex"); const slugIp = serverIp.replaceAll(".", "-"); - return `${projectName}-${hash}-${slugIp}.traefik.me`; + return `${projectName}-${hash}${process.env.NODE_ENV === "production" ? `-${slugIp}` : ""}.traefik.me`; }; export const generateHash = (projectName: string, quantity = 3): string => {