From 2daa159e29984b73abbdc5b0f75427ed1de77e17 Mon Sep 17 00:00:00 2001 From: 190km Date: Sun, 1 Dec 2024 19:29:16 +0100 Subject: [PATCH] style: add RequestAddr in the requests table --- .../components/dashboard/requests/columns.tsx | 167 +++++++++--------- 1 file changed, 85 insertions(+), 82 deletions(-) diff --git a/apps/dokploy/components/dashboard/requests/columns.tsx b/apps/dokploy/components/dashboard/requests/columns.tsx index ebcfb453..0bd4507b 100644 --- a/apps/dokploy/components/dashboard/requests/columns.tsx +++ b/apps/dokploy/components/dashboard/requests/columns.tsx @@ -7,89 +7,92 @@ import * as React from "react"; import type { LogEntry } from "./show-requests"; export const getStatusColor = (status: number) => { - if (status >= 100 && status < 200) { - return "outline"; - } - if (status >= 200 && status < 300) { - return "default"; - } - if (status >= 300 && status < 400) { - return "outline"; - } - if (status >= 400 && status < 500) { - return "destructive"; - } - return "destructive"; + if (status >= 100 && status < 200) { + return "outline"; + } + if (status >= 200 && status < 300) { + return "default"; + } + if (status >= 300 && status < 400) { + return "outline"; + } + if (status >= 400 && status < 500) { + return "destructive"; + } + return "destructive"; }; export const columns: ColumnDef[] = [ - { - accessorKey: "level", - header: ({ column }) => { - return ; - }, - cell: ({ row }) => { - return
{row.original.level}
; - }, - }, - { - accessorKey: "RequestPath", - header: ({ column }) => { - return ( - - ); - }, - cell: ({ row }) => { - const log = row.original; - return ( -
-
- {log.RequestMethod}{" "} - {log.RequestPath.length > 100 - ? `${log.RequestPath.slice(0, 82)}...` - : log.RequestPath} -
-
- - Status: {log.OriginStatus} - - - Exec Time: {`${log.Duration / 1000000000}s`} - - IP: {log.ClientAddr} -
-
- ); - }, - }, - { - accessorKey: "time", - header: ({ column }) => { - return ( - - ); - }, - cell: ({ row }) => { - const log = row.original; - return ( -
-
- {format(new Date(log.StartUTC), "yyyy-MM-dd HH:mm:ss")} -
-
- ); - }, - }, + { + accessorKey: "level", + header: ({ column }) => { + return ; + }, + cell: ({ row }) => { + return
{row.original.level}
; + }, + }, + { + accessorKey: "RequestPath", + header: ({ column }) => { + return ( + + ); + }, + cell: ({ row }) => { + const log = row.original; + return ( +
+
+ {log.RequestMethod}{" "} +
+ {log.RequestAddr} +
+ {log.RequestPath.length > 100 + ? `${log.RequestPath.slice(0, 82)}...` + : log.RequestPath} +
+
+ + Status: {log.OriginStatus} + + + Exec Time: {`${log.Duration / 1000000000}s`} + + IP: {log.ClientAddr} +
+
+ ); + }, + }, + { + accessorKey: "time", + header: ({ column }) => { + return ( + + ); + }, + cell: ({ row }) => { + const log = row.original; + return ( +
+
+ {format(new Date(log.StartUTC), "yyyy-MM-dd HH:mm:ss")} +
+
+ ); + }, + }, ];