mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 22:46:06 +08:00
* fix: issue #3034, add columns to end of the list * fix: #3033 replace columns
This commit is contained in:
parent
197ccca30f
commit
c1664dde6a
@ -1,11 +1,11 @@
|
||||
import { DEFAULT_PER_PAGE_OPTIONS } from 'hooks/queryPagination';
|
||||
|
||||
export const defaultSelectedColumns: string[] = [
|
||||
'name',
|
||||
'serviceName',
|
||||
'responseStatusCode',
|
||||
'httpMethod',
|
||||
'name',
|
||||
'durationNano',
|
||||
'httpMethod',
|
||||
'responseStatusCode',
|
||||
];
|
||||
|
||||
export const PER_PAGE_OPTIONS: number[] = [10, ...DEFAULT_PER_PAGE_OPTIONS];
|
||||
|
@ -28,21 +28,18 @@ export const modifyColumns = (
|
||||
columns: ColumnsType<RowData>,
|
||||
selectedColumns: BaseAutocompleteData[],
|
||||
): ColumnsType<RowData> => {
|
||||
const initialColumns = columns.filter(({ key }) => {
|
||||
let isValidColumn = true;
|
||||
const initialColumns = selectedColumns.reduce(
|
||||
(acc, { key: selectedColumnKey }) => {
|
||||
const column = columns.find(({ key }) => selectedColumnKey === key);
|
||||
|
||||
const checkIsExistColumnByKey = (attributeKey: string): boolean =>
|
||||
!selectedColumns.find(({ key }) => key === attributeKey) &&
|
||||
attributeKey === key;
|
||||
if (column) {
|
||||
return [...acc, column];
|
||||
}
|
||||
|
||||
const isSelectedSpanId = checkIsExistColumnByKey('spanID');
|
||||
const isSelectedTraceId = checkIsExistColumnByKey('traceID');
|
||||
|
||||
if (isSelectedSpanId || isSelectedTraceId || key === 'date')
|
||||
isValidColumn = false;
|
||||
|
||||
return isValidColumn;
|
||||
});
|
||||
return acc;
|
||||
},
|
||||
[] as ColumnsType<RowData>,
|
||||
);
|
||||
|
||||
const dateColumn = columns.find(({ key }) => key === 'date');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user