From 6f7e8e003f24e0c4f239e96d90770f85bfc08e33 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Mon, 13 Oct 2025 03:17:28 +0530 Subject: [PATCH 1/4] fix: improve table layout and prevent content overflow in LogsTable. --- .../[search_space_id]/logs/(manage)/page.tsx | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/surfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsx b/surfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsx index f8a0a593e..6773d2aad 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsx @@ -839,7 +839,7 @@ function LogsTable({ animate={{ opacity: 1, y: 0 }} transition={{ delay: 0.3 }} > - +
{table.getHeaderGroups().map((headerGroup: any) => ( @@ -847,7 +847,11 @@ function LogsTable({ {header.isPlaceholder ? null : header.column.getCanSort() ? ( + + ); + } + + // Default rendering for other columns + return ( + + {flexRender(cell.column.columnDef.cell, cell.getContext())} + + ); + })} + + )) + ) : ( + + + No logs found. + + + )} +
From 19c748bf9756a2c9efc4748670bff5598edac37a Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Mon, 13 Oct 2025 21:11:16 +0530 Subject: [PATCH 3/4] feat: implement MessageDetails component for displaying log details in a dialog --- .../[search_space_id]/logs/(manage)/page.tsx | 228 +++++++++--------- 1 file changed, 110 insertions(+), 118 deletions(-) diff --git a/surfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsx b/surfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsx index fc2105274..1d7cae855 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsx @@ -122,6 +122,55 @@ const logStatusConfig = { FAILED: { icon: X, color: "text-red-600", bgColor: "bg-red-50" }, } as const; +function MessageDetails({ + message, + taskName, + metadata, + createdAt, + children, +}: { + message: string; + taskName?: string; + metadata?: any; + createdAt?: string; + children: React.ReactNode; +}) { + return ( + + {children} + +
+
+ Log details + {createdAt && ( +

+ {new Date(createdAt).toLocaleString()} +

+ )} +
+
+ Close +
+
+ +
+ {taskName && ( +
+ {taskName} +
+ )} + +
+ {message} +
+
+ + +
+
+ ); +} + const columns: ColumnDef[] = [ { id: "select", @@ -219,19 +268,22 @@ const columns: ColumnDef[] = [ cell: ({ row }) => { const message = row.getValue("message") as string; const taskName = row.original.log_metadata?.task_name; + const createdAt = row.getValue("created_at") as string; return ( -
- {taskName && ( -
- {taskName} -
- )} -
- {message.length > 100 ? `${message.substring(0, 100)}...` : message} -
-
- ); + +
+ {taskName && ( +
+ {taskName} +
+ )} +
+ {message.length > 100 ? `${message.substring(0, 100)}...` : message} +
+
+
+ ); }, size: 400, }, @@ -777,12 +829,6 @@ function LogsTable({ onRefresh: () => void; id: string; }) { - const [expandedRows, setExpandedRows] = useState>({}); - - const toggleRowExpanded = (rowId: string) => { - setExpandedRows((prev) => ({ ...prev, [rowId]: !prev[rowId] })); - }; - if (loading) { return ( - {table.getRowModel().rows?.length ? ( - table.getRowModel().rows.map((row: any, index: number) => ( - - {row.getVisibleCells().map((cell: any) => { - const isCreatedAt = cell.column.id === "created_at"; - const isMessage = cell.column.id === "message"; - const isExpanded = Boolean(expandedRows[row.id]); - - // If this is the Message column, render custom inline expandable content - if (isMessage) { - const message = row.getValue("message") as string; - const taskName = row.original.log_metadata?.task_name; - const createdAt = row.getValue("created_at") as string; - - return ( - - {/* Click the preview to toggle expand/collapse */} - - - ); - } - - // Default rendering for other columns - return ( - - {flexRender(cell.column.columnDef.cell, cell.getContext())} - - ); - })} - - )) - ) : ( - - - No logs found. - - - )} - + {table.getRowModel().rows?.length ? ( + table.getRowModel().rows.map((row: any, index: number) => ( + + {row.getVisibleCells().map((cell: any) => { + const isCreatedAt = cell.column.id === "created_at"; + const isMessage = cell.column.id === "message"; + return ( + + {flexRender(cell.column.columnDef.cell, cell.getContext())} + + ); + })} + + )) + ) : ( + + + No logs found. + + + )} + From ea509b7d57be89397339d0f46fae1dbc90093222 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Mon, 13 Oct 2025 21:20:33 +0530 Subject: [PATCH 4/4] refactor: clean up formatting and indentation in MessageDetails component --- .../[search_space_id]/logs/(manage)/page.tsx | 124 ++++++++++-------- 1 file changed, 67 insertions(+), 57 deletions(-) diff --git a/surfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsx b/surfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsx index 1d7cae855..f89e4153f 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/logs/(manage)/page.tsx @@ -123,52 +123,52 @@ const logStatusConfig = { } as const; function MessageDetails({ - message, - taskName, - metadata, - createdAt, - children, + message, + taskName, + metadata, + createdAt, + children, }: { - message: string; - taskName?: string; - metadata?: any; - createdAt?: string; - children: React.ReactNode; + message: string; + taskName?: string; + metadata?: any; + createdAt?: string; + children: React.ReactNode; }) { - return ( - - {children} - -
-
- Log details - {createdAt && ( -

- {new Date(createdAt).toLocaleString()} -

- )} -
-
- Close -
-
+ return ( + + {children} + +
+
+ Log details + {createdAt && ( +

+ {new Date(createdAt).toLocaleString()} +

+ )} +
+
+ Close +
+
-
- {taskName && ( -
- {taskName} -
- )} +
+ {taskName && ( +
+ {taskName} +
+ )} -
- {message} -
-
+
+ {message} +
+
- -
-
- ); + +
+
+ ); } const columns: ColumnDef[] = [ @@ -271,19 +271,27 @@ const columns: ColumnDef[] = [ const createdAt = row.getValue("created_at") as string; return ( - -
- {taskName && ( -
- {taskName} -
- )} -
- {message.length > 100 ? `${message.substring(0, 100)}...` : message} -
-
-
- ); + +
+ {taskName && ( +
+ {taskName} +
+ )} +
+ {message.length > 100 ? `${message.substring(0, 100)}...` : message} +
+
+
+ ); }, size: 400, }, @@ -954,19 +962,21 @@ function LogsTable({ {row.getVisibleCells().map((cell: any) => { const isCreatedAt = cell.column.id === "created_at"; const isMessage = cell.column.id === "message"; - return ( + return ( {flexRender(cell.column.columnDef.cell, cell.getContext())} ); - })} + })} )) ) : (