mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 06:29:02 +08:00
feat: body is added in the log (#2431)
This commit is contained in:
parent
53bfc33075
commit
2a03291171
@ -1,4 +1,5 @@
|
|||||||
import { TableProps } from 'antd';
|
import { TableProps } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
export const defaultCellStyle: React.CSSProperties = {
|
export const defaultCellStyle: React.CSSProperties = {
|
||||||
paddingTop: 4,
|
paddingTop: 4,
|
||||||
@ -7,6 +8,11 @@ export const defaultCellStyle: React.CSSProperties = {
|
|||||||
paddingLeft: 8,
|
paddingLeft: 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const defaultTableStyle: React.CSSProperties = {
|
||||||
|
minWidth: '40rem',
|
||||||
|
maxWidth: '40rem',
|
||||||
|
};
|
||||||
|
|
||||||
export const tableScroll: TableProps<Record<string, unknown>>['scroll'] = {
|
export const tableScroll: TableProps<Record<string, unknown>>['scroll'] = {
|
||||||
x: true,
|
x: true,
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,7 @@ import { ILog } from 'types/api/logs/log';
|
|||||||
// styles
|
// styles
|
||||||
import { ExpandIconWrapper } from '../RawLogView/styles';
|
import { ExpandIconWrapper } from '../RawLogView/styles';
|
||||||
// config
|
// config
|
||||||
import { defaultCellStyle, tableScroll } from './config';
|
import { defaultCellStyle, defaultTableStyle, tableScroll } from './config';
|
||||||
|
|
||||||
type ColumnTypeRender<T = unknown> = ReturnType<
|
type ColumnTypeRender<T = unknown> = ReturnType<
|
||||||
NonNullable<ColumnType<T>['render']>
|
NonNullable<ColumnType<T>['render']>
|
||||||
@ -73,26 +73,39 @@ function LogsTableView(props: LogsTableViewProps): JSX.Element {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Timestamp',
|
title: 'timestamp',
|
||||||
dataIndex: 'timestamp',
|
dataIndex: 'timestamp',
|
||||||
key: 'timestamp',
|
key: 'timestamp',
|
||||||
// https://github.com/ant-design/ant-design/discussions/36886
|
// https://github.com/ant-design/ant-design/discussions/36886
|
||||||
render: (field): ColumnTypeRender<Record<string, unknown>> => {
|
render: (field): ColumnTypeRender<Record<string, unknown>> => {
|
||||||
const date = dayjs(field / 1e6).format();
|
const date = dayjs(field / 1e6).format();
|
||||||
return {
|
return {
|
||||||
props: {
|
children: <Typography.Paragraph ellipsis>{date}</Typography.Paragraph>,
|
||||||
style: defaultCellStyle,
|
|
||||||
},
|
|
||||||
children: <span>{date}</span>,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
...fieldColumns,
|
...fieldColumns,
|
||||||
|
{
|
||||||
|
title: 'body',
|
||||||
|
dataIndex: 'body',
|
||||||
|
key: 'body',
|
||||||
|
render: (field): ColumnTypeRender<Record<string, unknown>> => ({
|
||||||
|
props: {
|
||||||
|
style: defaultTableStyle,
|
||||||
|
},
|
||||||
|
children: (
|
||||||
|
<Typography.Paragraph ellipsis={{ rows: linesPerRow }}>
|
||||||
|
{field}
|
||||||
|
</Typography.Paragraph>
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
},
|
||||||
];
|
];
|
||||||
}, [fields, linesPerRow, onClickExpand]);
|
}, [fields, linesPerRow, onClickExpand]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Table
|
<Table
|
||||||
|
size="small"
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={flattenLogData}
|
dataSource={flattenLogData}
|
||||||
pagination={false}
|
pagination={false}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user