FunctionsEdgeColumnRender.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 { extractEdgeFunctionName } from '../Logs.utils' |
| 6 | import { ResponseCodeFormatter, RowLayout, TextFormatter } from '../LogsFormatters' |
| 7 | import { defaultRenderCell } from './DefaultPreviewColumnRenderer' |
| 8 | |
| 9 | const columns: Column<LogData>[] = [ |
| 10 | { |
| 11 | name: 'functions-edge-first-column', |
| 12 | key: 'functions-edge-first-column', |
| 13 | renderHeaderCell: () => null, |
| 14 | renderCell: (props) => { |
| 15 | if (!props.row.status_code && !props.row.method) { |
| 16 | return defaultRenderCell(props) |
| 17 | } |
| 18 | const functionName = extractEdgeFunctionName(props.row.pathname) |
| 19 | return ( |
| 20 | <RowLayout> |
| 21 | <TimestampInfo utcTimestamp={props.row.timestamp!} /> |
| 22 | <ResponseCodeFormatter value={String(props.row.status_code)} /> |
| 23 | <TextFormatter value={String(props.row.method)} /> |
| 24 | {functionName && <TextFormatter value={functionName} />} |
| 25 | <TextFormatter value={String(props.row.id)} /> |
| 26 | </RowLayout> |
| 27 | ) |
| 28 | }, |
| 29 | }, |
| 30 | ] |
| 31 | |
| 32 | export default columns |