diff --git a/frontend/src/container/Trace/TraceTable/index.tsx b/frontend/src/container/Trace/TraceTable/index.tsx index 6efe341e59..b68a180ad7 100644 --- a/frontend/src/container/Trace/TraceTable/index.tsx +++ b/frontend/src/container/Trace/TraceTable/index.tsx @@ -3,9 +3,9 @@ import Table, { ColumnsType } from 'antd/lib/table'; import ROUTES from 'constants/routes'; import dayjs from 'dayjs'; import duration from 'dayjs/plugin/duration'; +import history from 'lib/history'; import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { Link } from 'react-router-dom'; import { Dispatch } from 'redux'; import { updateURL } from 'store/actions/trace/util'; import { AppState } from 'store/reducers'; @@ -40,30 +40,17 @@ function TraceTable(): JSX.Element { return `${ROUTES.TRACE}/${record.traceID}?spanId=${record.spanID}`; }; - const getValue = (value: string, record: TableType): JSX.Element => { - return ( - - {value} - - ); + const getValue = (value: string): JSX.Element => { + return {value}; }; const getHttpMethodOrStatus = ( value: TableType['httpMethod'], - record: TableType, ): JSX.Element => { if (value.length === 0) { - return ( - - - - - ); + return -; } - return ( - - {value} - - ); + return {value}; }; const columns: ColumnsType = [ @@ -72,13 +59,9 @@ function TraceTable(): JSX.Element { dataIndex: 'timestamp', key: 'timestamp', sorter: true, - render: (value: TableType['timestamp'], record): JSX.Element => { + render: (value: TableType['timestamp']): JSX.Element => { const day = dayjs(value); - return ( - - {day.format('YYYY/MM/DD HH:mm:ss')} - - ); + return {day.format('YYYY/MM/DD HH:mm:ss')}; }, }, { @@ -97,15 +80,13 @@ function TraceTable(): JSX.Element { title: 'Duration', dataIndex: 'durationNano', key: 'durationNano', - render: (value: TableType['durationNano'], record): JSX.Element => ( - - - {`${dayjs - .duration({ milliseconds: value / 1000000 }) - .asMilliseconds() - .toFixed(2)} ms`} - - + render: (value: TableType['durationNano']): JSX.Element => ( + + {`${dayjs + .duration({ milliseconds: value / 1000000 }) + .asMilliseconds() + .toFixed(2)} ms`} + ), }, { @@ -169,6 +150,13 @@ function TraceTable(): JSX.Element { style={{ cursor: 'pointer', }} + onRow={(record): React.HTMLAttributes => ({ + onClick: (event): void => { + event.preventDefault(); + event.stopPropagation(); + history.push(getLink(record)); + }, + })} pagination={{ current: spansAggregate.currentPage, pageSize: spansAggregate.pageSize,