Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: table columns adding (#3058)

Yevhen Shevchenkoeb2a955323e5
diff --git a/frontend/src/components/Logs/TableView/types.ts b/frontend/src/components/Logs/TableView/types.ts
index 0c814ae51f..f9059b462d 100644
--- a/frontend/src/components/Logs/TableView/types.ts
+++ b/frontend/src/components/Logs/TableView/types.ts
@@ -1,4 +1,4 @@
-import { ColumnType } from 'antd/es/table';
+import { ColumnsType, ColumnType } from 'antd/es/table';
import { IField } from 'types/api/logs/fields';
import { ILog } from 'types/api/logs/log';
@@ -12,3 +12,12 @@ export type LogsTableViewProps = {
linesPerRow: number;
onClickExpand: (log: ILog) => void;
};
+
+export type UseTableViewResult = {
+ columns: ColumnsType<Record<string, unknown>>;
+ dataSource: Record<string, string>[];
+};
+
+export type UseTableViewProps = {
+ appendTo?: 'center' | 'end';
+} & LogsTableViewProps;
diff --git a/frontend/src/components/Logs/TableView/useTableView.tsx b/frontend/src/components/Logs/TableView/useTableView.tsx
index fb66235cef..7967aa15f9 100644
--- a/frontend/src/components/Logs/TableView/useTableView.tsx
+++ b/frontend/src/components/Logs/TableView/useTableView.tsx
@@ -11,17 +11,22 @@ import { ILog } from 'types/api/logs/log';
import { ExpandIconWrapper } from '../RawLogView/styles';
import { defaultCellStyle, defaultTableStyle } from './config';
import { TableBodyContent } from './styles';
-import { ColumnTypeRender, LogsTableViewProps } from './types';
-
-export type UseTableViewResult = {
- columns: ColumnsType<Record<string, unknown>>;
- dataSource: Record<string, string>[];
-};
+import {
+ ColumnTypeRender,
+ UseTableViewProps,
+ UseTableViewResult,
+} from './types';
const convert = new Convert();
-export const useTableView = (props: LogsTableViewProps): UseTableViewResult => {
- const { logs, fields, linesPerRow, onClickExpand } = props;
+export const useTableView = (props: UseTableViewProps): UseTableViewResult => {
+ const {
+ logs,
+ fields,
+ linesPerRow,
+ onClickExpand,
+ appendTo = 'center',
+ } = props;
const flattenLogData = useMemo(() => logs.map((log) => FlatLogData(log)), [
logs,
@@ -82,7 +87,7 @@ export const useTableView = (props: LogsTableViewProps): UseTableViewResult => {
};
},
},
- ...fieldColumns,
+ ...(appendTo === 'center' ? fieldColumns : []),
{
title: 'body',
dataIndex: 'body',
@@ -101,8 +106,9 @@ export const useTableView = (props: LogsTableViewProps): UseTableViewResult => {
),
}),
},
+ ...(appendTo === 'end' ? fieldColumns : []),
];
- }, [fields, linesPerRow, onClickExpand]);
+ }, [fields, linesPerRow, appendTo, onClickExpand]);
return { columns, dataSource: flattenLogData };
};
diff --git a/frontend/src/container/LogsExplorerList/InfinityTableView/types.ts b/frontend/src/container/LogsExplorerList/InfinityTableView/types.ts
index abd32a8c23..bf0e5a654c 100644
--- a/frontend/src/container/LogsExplorerList/InfinityTableView/types.ts
+++ b/frontend/src/container/LogsExplorerList/InfinityTableView/types.ts
@@ -1,7 +1,7 @@
-import { LogsTableViewProps } from 'components/Logs/TableView/types';
+import { UseTableViewProps } from 'components/Logs/TableView/types';
export type InfinityTableProps = {
- tableViewProps: LogsTableViewProps;
+ tableViewProps: UseTableViewProps;
infitiyTableProps: {
onEndReached: (index: number) => void;
};
diff --git a/frontend/src/container/LogsExplorerList/index.tsx b/frontend/src/container/LogsExplorerList/index.tsx
index de537036f8..b21e17437f 100644
--- a/frontend/src/container/LogsExplorerList/index.tsx
+++ b/frontend/src/container/LogsExplorerList/index.tsx
@@ -104,6 +104,7 @@ function LogsExplorerList({
fields: selectedFields,
linesPerRow: options.maxLines,
onClickExpand: onExpand,
+ appendTo: 'end',
}}
infitiyTableProps={{ onEndReached }}
/>