FunctionsLogsColumnRender.tsx32 lines · main
| 1 | import { Column } from 'react-data-grid' |
| 2 | import { TimestampInfo } from 'ui-patterns/TimestampInfo' |
| 3 | |
| 4 | import type { LogData } from '../Logs.types' |
| 5 | import { RowLayout, SeverityFormatter, TextFormatter } from '../LogsFormatters' |
| 6 | import { defaultRenderCell } from './DefaultPreviewColumnRenderer' |
| 7 | |
| 8 | const columns: Column<LogData>[] = [ |
| 9 | { |
| 10 | name: 'functions-logs-first-column', |
| 11 | key: 'functions-logs-first-column', |
| 12 | renderHeaderCell: () => null, |
| 13 | renderCell: (props) => { |
| 14 | if (!props.row.event_type && !props.row.level) { |
| 15 | return defaultRenderCell(props) |
| 16 | } |
| 17 | return ( |
| 18 | <RowLayout> |
| 19 | <TimestampInfo utcTimestamp={props.row.timestamp!} /> |
| 20 | {props.row.event_type === 'uncaughtException' ? ( |
| 21 | <SeverityFormatter value={props.row.event_type} uppercase={false} /> |
| 22 | ) : ( |
| 23 | <SeverityFormatter value={props.row.level as string} /> |
| 24 | )} |
| 25 | <TextFormatter className="w-full" value={props.row.event_message} /> |
| 26 | </RowLayout> |
| 27 | ) |
| 28 | }, |
| 29 | }, |
| 30 | ] |
| 31 | |
| 32 | export default columns |