mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 16:25:56 +08:00
fix: table view on click is now taking raw logs (#3153)
This commit is contained in:
parent
6efa1011aa
commit
0beffb50ca
@ -1,6 +1,7 @@
|
|||||||
import { Drawer, Tabs } from 'antd';
|
import { Drawer, Tabs } from 'antd';
|
||||||
import JSONView from 'container/LogDetailedView/JsonView';
|
import JSONView from 'container/LogDetailedView/JsonView';
|
||||||
import TableView from 'container/LogDetailedView/TableView';
|
import TableView from 'container/LogDetailedView/TableView';
|
||||||
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
import { LogDetailProps } from './LogDetail.interfaces';
|
import { LogDetailProps } from './LogDetail.interfaces';
|
||||||
|
|
||||||
@ -14,7 +15,8 @@ function LogDetail({
|
|||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
const items = [
|
const items = useMemo(
|
||||||
|
() => [
|
||||||
{
|
{
|
||||||
label: 'Table',
|
label: 'Table',
|
||||||
key: '1',
|
key: '1',
|
||||||
@ -31,7 +33,9 @@ function LogDetail({
|
|||||||
key: '2',
|
key: '2',
|
||||||
children: log && <JSONView logData={log} />,
|
children: log && <JSONView logData={log} />,
|
||||||
},
|
},
|
||||||
];
|
],
|
||||||
|
[log, onAddToQuery, onClickActionItem],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Drawer
|
<Drawer
|
||||||
|
@ -6,7 +6,6 @@ import dayjs from 'dayjs';
|
|||||||
import dompurify from 'dompurify';
|
import dompurify from 'dompurify';
|
||||||
import { FlatLogData } from 'lib/logs/flatLogData';
|
import { FlatLogData } from 'lib/logs/flatLogData';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { ILog } from 'types/api/logs/log';
|
|
||||||
|
|
||||||
import { ExpandIconWrapper } from '../RawLogView/styles';
|
import { ExpandIconWrapper } from '../RawLogView/styles';
|
||||||
import { defaultCellStyle, defaultTableStyle } from './config';
|
import { defaultCellStyle, defaultTableStyle } from './config';
|
||||||
@ -57,14 +56,14 @@ export const useTableView = (props: UseTableViewProps): UseTableViewResult => {
|
|||||||
dataIndex: 'id',
|
dataIndex: 'id',
|
||||||
key: 'expand',
|
key: 'expand',
|
||||||
// https://github.com/ant-design/ant-design/discussions/36886
|
// https://github.com/ant-design/ant-design/discussions/36886
|
||||||
render: (_, item): ColumnTypeRender<Record<string, unknown>> => ({
|
render: (_, item, index): ColumnTypeRender<Record<string, unknown>> => ({
|
||||||
props: {
|
props: {
|
||||||
style: defaultCellStyle,
|
style: defaultCellStyle,
|
||||||
},
|
},
|
||||||
children: (
|
children: (
|
||||||
<ExpandIconWrapper
|
<ExpandIconWrapper
|
||||||
onClick={(): void => {
|
onClick={(): void => {
|
||||||
onClickExpand((item as unknown) as ILog);
|
onClickExpand(logs[index]);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ExpandAltOutlined />
|
<ExpandAltOutlined />
|
||||||
@ -108,7 +107,7 @@ export const useTableView = (props: UseTableViewProps): UseTableViewResult => {
|
|||||||
},
|
},
|
||||||
...(appendTo === 'end' ? fieldColumns : []),
|
...(appendTo === 'end' ? fieldColumns : []),
|
||||||
];
|
];
|
||||||
}, [fields, linesPerRow, appendTo, onClickExpand]);
|
}, [fields, appendTo, linesPerRow, onClickExpand, logs]);
|
||||||
|
|
||||||
return { columns, dataSource: flattenLogData };
|
return { columns, dataSource: flattenLogData };
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user