diff --git a/client-dashboard/src/components/LogsViewer.tsx b/client-dashboard/src/components/LogsViewer.tsx index 0c06b67..0505148 100644 --- a/client-dashboard/src/components/LogsViewer.tsx +++ b/client-dashboard/src/components/LogsViewer.tsx @@ -17,6 +17,7 @@ import { Tooltip, Collapse, Divider, + useTheme, } from '@mui/material'; import { Search, @@ -26,6 +27,12 @@ import { Info, BugReport, ExpandMore, + AccessTime, + Computer, + Label, + Storage, + Code, + ContentCopy, } from '@mui/icons-material'; import { format, parseISO } from 'date-fns'; import { apiService, LogEntry, LogsResponse, wsService } from '../services/api'; @@ -57,12 +64,13 @@ const LogLevelChip = ({ level }: { level: string }) => { const LogEntryItem = ({ log }: { log: LogEntry }) => { const [expanded, setExpanded] = useState(false); + const theme = useTheme(); return ( setExpanded(!expanded)} sx={{cursor: 'pointer'}}> - {format(parseISO(log.timestamp), 'MMM dd, HH:mm:ss.SSS')} + {format(new Date(log.timestamp), 'MMM dd, h:mm:ss a')} @@ -100,10 +108,190 @@ const LogEntryItem = ({ log }: { log: LogEntry }) => { - Full Log Details -
-                    {JSON.stringify(log, null, 2)}
-                
+ Log Details + + {/* Key Information Grid */} + + + + Timestamp: + + {format(new Date(log.timestamp), 'MMM dd, yyyy at h:mm:ss a')} + + + + + + Host: + + {log.metadata?.host || 'N/A'} + + + + + + + + + Topic: + + {log.kafkaMetadata?.topic || 'N/A'} + + + + + {/* Message Section */} + + + + Message + + + + {log.message} + + navigator.clipboard.writeText(log.message)} + > + + + + + + {/* Kafka Metadata */} + {log.kafkaMetadata && ( + + + Kafka Metadata + + + + Partition: + + {log.kafkaMetadata.partition ?? 'N/A'} + + + + Offset: + + {log.kafkaMetadata.offset} + + + + Received: + + {format(parseISO(log.kafkaMetadata.receivedAt), 'HH:mm:ss.SSS')} + + + + + )} + + {/* Additional Metadata */} + {log.metadata && Object.keys(log.metadata).length > 1 && ( + + + Additional Metadata + + + {Object.entries(log.metadata).map(([key, value]) => { + if (key === 'host') return null; // Already shown above + return ( + + + {key}: + + + {typeof value === 'object' ? JSON.stringify(value) : String(value)} + + + ); + })} + + + )} + + {/* Raw Data Section (Collapsible) */} + + + Raw JSON Data + + +
+                            {JSON.stringify(log, null, 2)}
+                        
+ navigator.clipboard.writeText(JSON.stringify(log, null, 2))} + > + + +
+