DatabasePostgresColumnRender.tsx30 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: 'database-postgres-first-column', |
| 11 | key: 'database-postgres-first-column', |
| 12 | renderHeaderCell: () => null, |
| 13 | renderCell: (props) => { |
| 14 | if (!props.row.error_severity) { |
| 15 | return defaultRenderCell(props) |
| 16 | } |
| 17 | return ( |
| 18 | <RowLayout> |
| 19 | <TimestampInfo utcTimestamp={props.row.timestamp!} /> |
| 20 | <SeverityFormatter value={props.row.error_severity as string} /> |
| 21 | <TextFormatter className="w-full" value={props.row.event_message} /> |
| 22 | {props.row.detail ? <TextFormatter value={props.row.detail as string} /> : null} |
| 23 | {props.row.hint ? <TextFormatter value={props.row.hint as string} /> : null} |
| 24 | </RowLayout> |
| 25 | ) |
| 26 | }, |
| 27 | }, |
| 28 | ] |
| 29 | |
| 30 | export default columns |