fix: table view logs on expand is updated (#3286)

This commit is contained in:
Palash Gupta 2023-08-08 14:48:59 +05:30 committed by GitHub
parent ae3d4fece8
commit c6ac8df707
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -10,6 +10,7 @@ export type LogsTableViewProps = {
logs: ILog[];
fields: IField[];
linesPerRow: number;
onClickExpand?: (log: ILog) => void;
};
export type UseTableViewResult = {

View File

@ -5,6 +5,7 @@ import RawLogView from 'components/Logs/RawLogView';
import LogsTableView from 'components/Logs/TableView';
import Spinner from 'components/Spinner';
import { contentStyle } from 'container/Trace/Search/config';
import { useActiveLog } from 'hooks/logs/useActiveLog';
import useFontFaceObserver from 'hooks/useFontObserver';
import { memo, useCallback, useMemo } from 'react';
import { useSelector } from 'react-redux';
@ -26,6 +27,8 @@ type LogsTableProps = {
function LogsTable(props: LogsTableProps): JSX.Element {
const { viewMode, linesPerRow } = props;
const { onSetActiveLog } = useActiveLog();
useFontFaceObserver(
[
{
@ -72,7 +75,12 @@ function LogsTable(props: LogsTableProps): JSX.Element {
const renderContent = useMemo(() => {
if (viewMode === 'table') {
return (
<LogsTableView logs={logs} fields={selected} linesPerRow={linesPerRow} />
<LogsTableView
onClickExpand={onSetActiveLog}
logs={logs}
fields={selected}
linesPerRow={linesPerRow}
/>
);
}
@ -85,7 +93,7 @@ function LogsTable(props: LogsTableProps): JSX.Element {
/>
</Card>
);
}, [getItemContent, linesPerRow, logs, selected, viewMode]);
}, [getItemContent, linesPerRow, logs, onSetActiveLog, selected, viewMode]);
if (isLoading) {
return <Spinner height={20} tip="Getting Logs" />;