From 2a032911714f8070ecc126f2e22656b8da7e89ec Mon Sep 17 00:00:00 2001 From: palashgdev Date: Tue, 7 Mar 2023 18:07:23 +0530 Subject: [PATCH] feat: body is added in the log (#2431) --- .../src/components/Logs/TableView/config.ts | 6 +++++ .../src/components/Logs/TableView/index.tsx | 25 ++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/Logs/TableView/config.ts b/frontend/src/components/Logs/TableView/config.ts index f68dcbfebf..0bf91de96b 100644 --- a/frontend/src/components/Logs/TableView/config.ts +++ b/frontend/src/components/Logs/TableView/config.ts @@ -1,4 +1,5 @@ import { TableProps } from 'antd'; +import React from 'react'; export const defaultCellStyle: React.CSSProperties = { paddingTop: 4, @@ -7,6 +8,11 @@ export const defaultCellStyle: React.CSSProperties = { paddingLeft: 8, }; +export const defaultTableStyle: React.CSSProperties = { + minWidth: '40rem', + maxWidth: '40rem', +}; + export const tableScroll: TableProps>['scroll'] = { x: true, }; diff --git a/frontend/src/components/Logs/TableView/index.tsx b/frontend/src/components/Logs/TableView/index.tsx index 4ac289336c..774a2d889c 100644 --- a/frontend/src/components/Logs/TableView/index.tsx +++ b/frontend/src/components/Logs/TableView/index.tsx @@ -12,7 +12,7 @@ import { ILog } from 'types/api/logs/log'; // styles import { ExpandIconWrapper } from '../RawLogView/styles'; // config -import { defaultCellStyle, tableScroll } from './config'; +import { defaultCellStyle, defaultTableStyle, tableScroll } from './config'; type ColumnTypeRender = ReturnType< NonNullable['render']> @@ -73,26 +73,39 @@ function LogsTableView(props: LogsTableViewProps): JSX.Element { }), }, { - title: 'Timestamp', + title: 'timestamp', dataIndex: 'timestamp', key: 'timestamp', // https://github.com/ant-design/ant-design/discussions/36886 render: (field): ColumnTypeRender> => { const date = dayjs(field / 1e6).format(); return { - props: { - style: defaultCellStyle, - }, - children: {date}, + children: {date}, }; }, }, ...fieldColumns, + { + title: 'body', + dataIndex: 'body', + key: 'body', + render: (field): ColumnTypeRender> => ({ + props: { + style: defaultTableStyle, + }, + children: ( + + {field} + + ), + }), + }, ]; }, [fields, linesPerRow, onClickExpand]); return (