mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-31 10:22:00 +08:00
fix: trace table pagination (#1749)
* fix: trace table pagination * chore: refactor * chore: refactor Co-authored-by: Palash Gupta <palashgdev@gmail.com>
This commit is contained in:
parent
220f848b04
commit
b0ec619881
@ -1,6 +1,10 @@
|
|||||||
import { TableProps, Tag, Typography } from 'antd';
|
import { TableProps, Tag, Typography } from 'antd';
|
||||||
import Table, { ColumnsType } from 'antd/lib/table';
|
import Table, { ColumnsType } from 'antd/lib/table';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
|
import {
|
||||||
|
getSpanOrder,
|
||||||
|
getSpanOrderParam,
|
||||||
|
} from 'container/Trace/TraceTable/util';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import duration from 'dayjs/plugin/duration';
|
import duration from 'dayjs/plugin/duration';
|
||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
@ -111,16 +115,6 @@ function TraceTable(): JSX.Element {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const getSortKey = (key: string): string => {
|
|
||||||
if (key === 'durationNano') {
|
|
||||||
return 'duration';
|
|
||||||
}
|
|
||||||
if (key === 'timestamp') {
|
|
||||||
return 'timestamp';
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
};
|
|
||||||
|
|
||||||
const onChangeHandler: TableProps<TableType>['onChange'] = (
|
const onChangeHandler: TableProps<TableType>['onChange'] = (
|
||||||
props,
|
props,
|
||||||
_,
|
_,
|
||||||
@ -129,8 +123,8 @@ function TraceTable(): JSX.Element {
|
|||||||
if (!Array.isArray(sort)) {
|
if (!Array.isArray(sort)) {
|
||||||
const { order = spansAggregateOrder } = sort;
|
const { order = spansAggregateOrder } = sort;
|
||||||
if (props.current && props.pageSize) {
|
if (props.current && props.pageSize) {
|
||||||
const spanOrder = order === 'ascend' ? 'ascending' : 'descending';
|
const spanOrder = getSpanOrder(order || '');
|
||||||
const orderParam = getSortKey(sort.field as string);
|
const orderParam = getSpanOrderParam(sort.field as string);
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: UPDATE_SPAN_ORDER,
|
type: UPDATE_SPAN_ORDER,
|
||||||
|
19
frontend/src/container/Trace/TraceTable/util.ts
Normal file
19
frontend/src/container/Trace/TraceTable/util.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
export const getSpanOrderParam = (key: string): string => {
|
||||||
|
if (key === 'durationNano') {
|
||||||
|
return 'duration';
|
||||||
|
}
|
||||||
|
if (key === 'timestamp') {
|
||||||
|
return 'timestamp';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getSpanOrder = (order: string): string => {
|
||||||
|
if (order === 'ascend') {
|
||||||
|
return 'ascending';
|
||||||
|
}
|
||||||
|
if (order === 'descend') {
|
||||||
|
return 'descending';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user