|
@@ -1,4 +1,5 @@
|
|
|
import {Fragment} from 'react';
|
|
|
+import {browserHistory} from 'react-router';
|
|
|
import styled from '@emotion/styled';
|
|
|
import {urlEncode} from '@sentry/utils';
|
|
|
|
|
@@ -8,7 +9,8 @@ import GridEditable, {
|
|
|
} from 'sentry/components/gridEditable';
|
|
|
import SortLink from 'sentry/components/gridEditable/sortLink';
|
|
|
import Link from 'sentry/components/links/link';
|
|
|
-import Pagination from 'sentry/components/pagination';
|
|
|
+import Pagination, {CursorHandler} from 'sentry/components/pagination';
|
|
|
+import {decodeScalar} from 'sentry/utils/queryString';
|
|
|
import {useLocation} from 'sentry/utils/useLocation';
|
|
|
import {TableColumnSort} from 'sentry/views/discover/table/types';
|
|
|
import DurationCell from 'sentry/views/starfish/components/tableCells/durationCell';
|
|
@@ -18,6 +20,8 @@ import {useSpanList} from 'sentry/views/starfish/queries/useSpanList';
|
|
|
import {ModuleName} from 'sentry/views/starfish/types';
|
|
|
import {DataTitles} from 'sentry/views/starfish/views/spans/types';
|
|
|
|
|
|
+const SPANS_CURSOR_NAME = 'spansCursor';
|
|
|
+
|
|
|
type Props = {
|
|
|
moduleName: ModuleName;
|
|
|
onSetOrderBy: (orderBy: string) => void;
|
|
@@ -61,14 +65,24 @@ export default function SpansTable({
|
|
|
limit = 25,
|
|
|
}: Props) {
|
|
|
const location = useLocation();
|
|
|
+ const spansCursor = decodeScalar(location.query?.[SPANS_CURSOR_NAME]);
|
|
|
const {isLoading, data, pageLinks} = useSpanList(
|
|
|
moduleName ?? ModuleName.ALL,
|
|
|
undefined,
|
|
|
spanCategory,
|
|
|
orderBy,
|
|
|
- limit
|
|
|
+ limit,
|
|
|
+ 'use-span-list',
|
|
|
+ spansCursor
|
|
|
);
|
|
|
|
|
|
+ const handleCursor: CursorHandler = (cursor, pathname, query) => {
|
|
|
+ browserHistory.push({
|
|
|
+ pathname,
|
|
|
+ query: {...query, [SPANS_CURSOR_NAME]: cursor},
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
return (
|
|
|
<Fragment>
|
|
|
<GridEditable
|
|
@@ -84,7 +98,7 @@ export default function SpansTable({
|
|
|
}}
|
|
|
location={location}
|
|
|
/>
|
|
|
- <Pagination pageLinks={pageLinks} />
|
|
|
+ <Pagination pageLinks={pageLinks} onCursor={handleCursor} />
|
|
|
</Fragment>
|
|
|
);
|
|
|
}
|