mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-29 03:52:01 +08:00
fix: export as csv for logs and traces table panel type (#6047)
* fix: export as csv for logs and traces panel type * chore: remove console logs
This commit is contained in:
parent
033b64a62a
commit
f3c01a5155
@ -4,7 +4,7 @@ import { getYAxisFormattedValue } from 'components/Graph/yAxisConfig';
|
|||||||
import { Events } from 'constants/events';
|
import { Events } from 'constants/events';
|
||||||
import { QueryTable } from 'container/QueryTable';
|
import { QueryTable } from 'container/QueryTable';
|
||||||
import { RowData } from 'lib/query/createTableColumnsFromQuery';
|
import { RowData } from 'lib/query/createTableColumnsFromQuery';
|
||||||
import { cloneDeep, get, isEmpty, set } from 'lodash-es';
|
import { cloneDeep, get, isEmpty } from 'lodash-es';
|
||||||
import { memo, ReactNode, useCallback, useEffect, useMemo } from 'react';
|
import { memo, ReactNode, useCallback, useEffect, useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { eventEmitter } from 'utils/getEventEmitter';
|
import { eventEmitter } from 'utils/getEventEmitter';
|
||||||
@ -38,15 +38,13 @@ function GridTableComponent({
|
|||||||
const createDataInCorrectFormat = useCallback(
|
const createDataInCorrectFormat = useCallback(
|
||||||
(dataSource: RowData[]): RowData[] =>
|
(dataSource: RowData[]): RowData[] =>
|
||||||
dataSource.map((d) => {
|
dataSource.map((d) => {
|
||||||
const finalObject = {};
|
const finalObject: Record<string, number | string> = {};
|
||||||
|
|
||||||
// we use the order of the columns here to have similar download as the user view
|
// we use the order of the columns here to have similar download as the user view
|
||||||
|
// the [] access for the object is used because the titles can contain dot(.) as well
|
||||||
columns.forEach((k) => {
|
columns.forEach((k) => {
|
||||||
set(
|
finalObject[`${get(k, 'title', '')}`] =
|
||||||
finalObject,
|
d[`${get(k, 'dataIndex', '')}`] || 'n/a';
|
||||||
get(k, 'title', '') as string,
|
|
||||||
get(d, get(k, 'dataIndex', ''), 'n/a'),
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
return finalObject as RowData;
|
return finalObject as RowData;
|
||||||
}),
|
}),
|
||||||
@ -86,6 +84,7 @@ function GridTableComponent({
|
|||||||
applyColumnUnits,
|
applyColumnUnits,
|
||||||
originalDataSource,
|
originalDataSource,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (tableProcessedDataRef) {
|
if (tableProcessedDataRef) {
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
|
Loading…
x
Reference in New Issue
Block a user