Skip to content

Commit 77427ef

Browse files
authored
feat(ui): Relocate paginator on release details (#25305)
1 parent bacf53d commit 77427ef

File tree

2 files changed

+34
-11
lines changed

2 files changed

+34
-11
lines changed

src/sentry/static/sentry/app/components/issues/groupList.tsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ type Props = {
4040
renderEmptyMessage?: () => React.ReactNode;
4141
queryParams?: Record<string, number | string | string[] | undefined | null>;
4242
customStatsPeriod?: TimePeriodType;
43+
onFetchSuccess?: (
44+
groupListState: State,
45+
onCursor: (
46+
cursor: string,
47+
path: string,
48+
query: Record<string, any>,
49+
pageDiff: number
50+
) => void
51+
) => void;
4352
} & Partial<typeof defaultProps>;
4453

4554
type State = {
@@ -111,11 +120,16 @@ class GroupList extends React.Component<Props, State> {
111120
api.request(endpoint, {
112121
success: (data, _, jqXHR) => {
113122
this._streamManager.push(data);
114-
this.setState({
115-
error: false,
116-
loading: false,
117-
pageLinks: jqXHR?.getResponseHeader('Link') ?? null,
118-
});
123+
this.setState(
124+
{
125+
error: false,
126+
loading: false,
127+
pageLinks: jqXHR?.getResponseHeader('Link') ?? null,
128+
},
129+
() => {
130+
this.props.onFetchSuccess?.(this.state, this.handleCursorChange);
131+
}
132+
);
119133
},
120134
error: err => {
121135
Sentry.captureException(err);

src/sentry/static/sentry/app/views/releases/detail/overview/issues.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import DropdownButton from 'app/components/dropdownButton';
1212
import DropdownControl, {DropdownItem} from 'app/components/dropdownControl';
1313
import GroupList from 'app/components/issues/groupList';
1414
import {getParams} from 'app/components/organizations/globalSelectionHeader/getParams';
15-
import {Panel} from 'app/components/panels';
15+
import Pagination from 'app/components/pagination';
1616
import {DEFAULT_RELATIVE_PERIODS} from 'app/constants';
1717
import {URL_PARAM} from 'app/constants/globalSelectionHeader';
1818
import {t, tct} from 'app/locale';
@@ -47,6 +47,8 @@ type Props = {
4747

4848
type State = {
4949
issuesType: IssuesType;
50+
pageLinks?: string;
51+
onCursor?: () => void;
5052
};
5153

5254
class Issues extends React.Component<Props, State> {
@@ -143,6 +145,10 @@ class Issues extends React.Component<Props, State> {
143145
this.setState({issuesType});
144146
};
145147

148+
handleFetchSuccess = (groupListState, onCursor) => {
149+
this.setState({pageLinks: groupListState.pageLinks, onCursor});
150+
};
151+
146152
renderEmptyMessage = () => {
147153
const {selection} = this.props;
148154
const {issuesType} = this.state;
@@ -174,7 +180,7 @@ class Issues extends React.Component<Props, State> {
174180
};
175181

176182
render() {
177-
const {issuesType} = this.state;
183+
const {issuesType, pageLinks, onCursor} = this.state;
178184
const {orgId} = this.props;
179185
const {path, queryParams} = this.getIssuesEndpoint();
180186
const issuesTypes = [
@@ -228,6 +234,7 @@ class Issues extends React.Component<Props, State> {
228234
</DiscoverButton>
229235
</GuideAnchor>
230236
</Feature>
237+
<StyledPagination pageLinks={pageLinks} onCursor={onCursor} />
231238
</OpenInButtonBar>
232239
</ControlsWrapper>
233240
<TableWrapper data-test-id="release-wrapper">
@@ -239,6 +246,8 @@ class Issues extends React.Component<Props, State> {
239246
canSelectGroups={false}
240247
withChart={false}
241248
renderEmptyMessage={this.renderEmptyMessage}
249+
withPagination={false}
250+
onFetchSuccess={this.handleFetchSuccess}
242251
/>
243252
</TableWrapper>
244253
</React.Fragment>
@@ -272,10 +281,10 @@ const StyledDropdownItem = styled(DropdownItem)`
272281

273282
const TableWrapper = styled('div')`
274283
margin-bottom: ${space(4)};
275-
${Panel} {
276-
/* smaller space between table and pagination */
277-
margin-bottom: -${space(1)};
278-
}
284+
`;
285+
286+
const StyledPagination = styled(Pagination)`
287+
margin: 0;
279288
`;
280289

281290
export default Issues;

0 commit comments

Comments
 (0)