mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 15:45:57 +08:00
fix: [SIG-575]: no data in new trace explorer page specific scenario (#4748)
Co-authored-by: Vishal Sharma <makeavish786@gmail.com>
This commit is contained in:
parent
31b1d58a70
commit
5959963b9d
@ -1,3 +1,5 @@
|
|||||||
|
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
|
|
||||||
import { OptionsQuery } from './types';
|
import { OptionsQuery } from './types';
|
||||||
|
|
||||||
export const URL_OPTIONS = 'options';
|
export const URL_OPTIONS = 'options';
|
||||||
@ -7,3 +9,46 @@ export const defaultOptionsQuery: OptionsQuery = {
|
|||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
format: 'list',
|
format: 'list',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const defaultTraceSelectedColumns = [
|
||||||
|
{
|
||||||
|
key: 'serviceName',
|
||||||
|
dataType: DataTypes.String,
|
||||||
|
type: 'tag',
|
||||||
|
isColumn: true,
|
||||||
|
isJSON: false,
|
||||||
|
id: 'serviceName--string--tag--true',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'name',
|
||||||
|
dataType: DataTypes.String,
|
||||||
|
type: 'tag',
|
||||||
|
isColumn: true,
|
||||||
|
isJSON: false,
|
||||||
|
id: 'name--string--tag--true',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'durationNano',
|
||||||
|
dataType: DataTypes.Float64,
|
||||||
|
type: 'tag',
|
||||||
|
isColumn: true,
|
||||||
|
isJSON: false,
|
||||||
|
id: 'durationNano--float64--tag--true',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'httpMethod',
|
||||||
|
dataType: DataTypes.String,
|
||||||
|
type: 'tag',
|
||||||
|
isColumn: true,
|
||||||
|
isJSON: false,
|
||||||
|
id: 'httpMethod--string--tag--true',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'responseStatusCode',
|
||||||
|
dataType: DataTypes.String,
|
||||||
|
type: 'tag',
|
||||||
|
isColumn: true,
|
||||||
|
isJSON: false,
|
||||||
|
id: 'responseStatusCode--string--tag--true',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
@ -16,7 +16,11 @@ import {
|
|||||||
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import { DataSource } from 'types/common/queryBuilder';
|
import { DataSource } from 'types/common/queryBuilder';
|
||||||
|
|
||||||
import { defaultOptionsQuery, URL_OPTIONS } from './constants';
|
import {
|
||||||
|
defaultOptionsQuery,
|
||||||
|
defaultTraceSelectedColumns,
|
||||||
|
URL_OPTIONS,
|
||||||
|
} from './constants';
|
||||||
import { InitialOptions, OptionsMenuConfig, OptionsQuery } from './types';
|
import { InitialOptions, OptionsMenuConfig, OptionsQuery } from './types';
|
||||||
import { getOptionsFromKeys } from './utils';
|
import { getOptionsFromKeys } from './utils';
|
||||||
|
|
||||||
@ -124,20 +128,29 @@ const useOptionsMenu = ({
|
|||||||
{ queryKey: [debouncedSearchText, isFocused], enabled: isFocused },
|
{ queryKey: [debouncedSearchText, isFocused], enabled: isFocused },
|
||||||
);
|
);
|
||||||
|
|
||||||
const searchedAttributeKeys = useMemo(
|
const searchedAttributeKeys = useMemo(() => {
|
||||||
() => searchedAttributesData?.payload?.attributeKeys || [],
|
if (searchedAttributesData?.payload?.attributeKeys?.length) {
|
||||||
[searchedAttributesData?.payload?.attributeKeys],
|
return searchedAttributesData.payload.attributeKeys;
|
||||||
);
|
}
|
||||||
|
if (dataSource === DataSource.TRACES) {
|
||||||
|
return defaultTraceSelectedColumns;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}, [dataSource, searchedAttributesData?.payload?.attributeKeys]);
|
||||||
|
|
||||||
const initialOptionsQuery: OptionsQuery = useMemo(
|
const initialOptionsQuery: OptionsQuery = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
...defaultOptionsQuery,
|
...defaultOptionsQuery,
|
||||||
...initialOptions,
|
...initialOptions,
|
||||||
|
// eslint-disable-next-line no-nested-ternary
|
||||||
selectColumns: initialOptions?.selectColumns
|
selectColumns: initialOptions?.selectColumns
|
||||||
? initialSelectedColumns
|
? initialSelectedColumns
|
||||||
|
: dataSource === DataSource.TRACES
|
||||||
|
? defaultTraceSelectedColumns
|
||||||
: defaultOptionsQuery.selectColumns,
|
: defaultOptionsQuery.selectColumns,
|
||||||
}),
|
}),
|
||||||
[initialOptions, initialSelectedColumns],
|
[dataSource, initialOptions, initialSelectedColumns],
|
||||||
);
|
);
|
||||||
|
|
||||||
const selectedColumnKeys = useMemo(
|
const selectedColumnKeys = useMemo(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user