mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-18 16:07:10 +00:00
fix: logs explorer - should have atleast 1 column, discard empty key columns (#8740)
This commit is contained in:
parent
20dc561bfe
commit
b5098e00a3
@ -73,6 +73,8 @@ export default function TableRow({
|
|||||||
{tableColumns.map((column) => {
|
{tableColumns.map((column) => {
|
||||||
if (!column.render) return <td>Empty</td>;
|
if (!column.render) return <td>Empty</td>;
|
||||||
|
|
||||||
|
if (!column.key) return null;
|
||||||
|
|
||||||
const element: ColumnTypeRender<Record<string, unknown>> = column.render(
|
const element: ColumnTypeRender<Record<string, unknown>> = column.render(
|
||||||
log[column.key as keyof Record<string, unknown>],
|
log[column.key as keyof Record<string, unknown>],
|
||||||
log,
|
log,
|
||||||
@ -97,6 +99,7 @@ export default function TableRow({
|
|||||||
fontSize={fontSize}
|
fontSize={fontSize}
|
||||||
columnKey={column.key as string}
|
columnKey={column.key as string}
|
||||||
onClick={handleShowLogDetails}
|
onClick={handleShowLogDetails}
|
||||||
|
className={column.key as string}
|
||||||
>
|
>
|
||||||
{cloneElement(children, props)}
|
{cloneElement(children, props)}
|
||||||
</TableCellStyled>
|
</TableCellStyled>
|
||||||
|
|||||||
@ -136,7 +136,7 @@ const InfinityTable = forwardRef<TableVirtuosoHandle, InfinityTableProps>(
|
|||||||
key={column.key}
|
key={column.key}
|
||||||
fontSize={tableViewProps?.fontSize}
|
fontSize={tableViewProps?.fontSize}
|
||||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||||
{...(isDragColumn && { className: 'dragHandler' })}
|
{...(isDragColumn && { className: `dragHandler ${column.key}` })}
|
||||||
columnKey={column.key as string}
|
columnKey={column.key as string}
|
||||||
>
|
>
|
||||||
{(column.title as string).replace(/^\w/, (c) => c.toUpperCase())}
|
{(column.title as string).replace(/^\w/, (c) => c.toUpperCase())}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import { TelemetryFieldKey } from 'api/v5/v5';
|
import { TelemetryFieldKey } from 'api/v5/v5';
|
||||||
|
import { isEmpty } from 'lodash-es';
|
||||||
import { IField } from 'types/api/logs/fields';
|
import { IField } from 'types/api/logs/fields';
|
||||||
import {
|
import {
|
||||||
IBuilderQuery,
|
IBuilderQuery,
|
||||||
@ -8,7 +9,9 @@ import {
|
|||||||
export const convertKeysToColumnFields = (
|
export const convertKeysToColumnFields = (
|
||||||
keys: TelemetryFieldKey[],
|
keys: TelemetryFieldKey[],
|
||||||
): IField[] =>
|
): IField[] =>
|
||||||
keys.map((item) => ({
|
keys
|
||||||
|
.filter((item) => !isEmpty(item.name))
|
||||||
|
.map((item) => ({
|
||||||
dataType: item.fieldDataType ?? '',
|
dataType: item.fieldDataType ?? '',
|
||||||
name: item.name,
|
name: item.name,
|
||||||
type: item.fieldContext ?? '',
|
type: item.fieldContext ?? '',
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import { useGetQueryKeySuggestions } from 'hooks/querySuggestions/useGetQueryKey
|
|||||||
import useDebounce from 'hooks/useDebounce';
|
import useDebounce from 'hooks/useDebounce';
|
||||||
import { useNotifications } from 'hooks/useNotifications';
|
import { useNotifications } from 'hooks/useNotifications';
|
||||||
import useUrlQueryData from 'hooks/useUrlQueryData';
|
import useUrlQueryData from 'hooks/useUrlQueryData';
|
||||||
|
import { has } from 'lodash-es';
|
||||||
import { AllTraceFilterKeyValue } from 'pages/TracesExplorer/Filter/filterUtils';
|
import { AllTraceFilterKeyValue } from 'pages/TracesExplorer/Filter/filterUtils';
|
||||||
import { usePreferenceContext } from 'providers/preferences/context/PreferenceContextProvider';
|
import { usePreferenceContext } from 'providers/preferences/context/PreferenceContextProvider';
|
||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
@ -452,7 +453,9 @@ const useOptionsMenu = ({
|
|||||||
() => ({
|
() => ({
|
||||||
addColumn: {
|
addColumn: {
|
||||||
isFetching: isSearchedAttributesFetchingV5,
|
isFetching: isSearchedAttributesFetchingV5,
|
||||||
value: preferences?.columns || defaultOptionsQuery.selectColumns,
|
value:
|
||||||
|
preferences?.columns.filter((item) => has(item, 'name')) ||
|
||||||
|
defaultOptionsQuery.selectColumns.filter((item) => has(item, 'name')),
|
||||||
options: optionsFromAttributeKeys || [],
|
options: optionsFromAttributeKeys || [],
|
||||||
onFocus: handleFocus,
|
onFocus: handleFocus,
|
||||||
onBlur: handleBlur,
|
onBlur: handleBlur,
|
||||||
|
|||||||
@ -17,9 +17,9 @@ const getChartData = ({
|
|||||||
// eslint-disable-next-line sonarjs/cognitive-complexity
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
||||||
} => {
|
} => {
|
||||||
const uniqueTimeLabels = new Set<number>();
|
const uniqueTimeLabels = new Set<number>();
|
||||||
queryData.forEach((data) => {
|
queryData?.forEach((data) => {
|
||||||
data.queryData.forEach((query) => {
|
data.queryData?.forEach((query) => {
|
||||||
query.values.forEach((value) => {
|
query.values?.forEach((value) => {
|
||||||
uniqueTimeLabels.add(value[0]);
|
uniqueTimeLabels.add(value[0]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -27,8 +27,8 @@ const getChartData = ({
|
|||||||
|
|
||||||
const labels = Array.from(uniqueTimeLabels).sort((a, b) => a - b);
|
const labels = Array.from(uniqueTimeLabels).sort((a, b) => a - b);
|
||||||
|
|
||||||
const response = queryData.map(
|
const response =
|
||||||
({ queryData, query: queryG, legend: legendG }) =>
|
queryData?.map(({ queryData, query: queryG, legend: legendG }) =>
|
||||||
queryData.map((e) => {
|
queryData.map((e) => {
|
||||||
const { values = [], metric, legend, queryName } = e || {};
|
const { values = [], metric, legend, queryName } = e || {};
|
||||||
const labelNames = getLabelName(
|
const labelNames = getLabelName(
|
||||||
@ -61,7 +61,7 @@ const getChartData = ({
|
|||||||
second: filledDataValues.map((e) => e.second || 0),
|
second: filledDataValues.map((e) => e.second || 0),
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
);
|
) || [];
|
||||||
|
|
||||||
const modifiedData = response
|
const modifiedData = response
|
||||||
.flat()
|
.flat()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user