overview.tsx 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367
  1. import {Component} from 'react';
  2. import type {RouteComponentProps} from 'react-router';
  3. import styled from '@emotion/styled';
  4. import * as Sentry from '@sentry/react';
  5. import type {Location} from 'history';
  6. import Cookies from 'js-cookie';
  7. import isEqual from 'lodash/isEqual';
  8. import mapValues from 'lodash/mapValues';
  9. import omit from 'lodash/omit';
  10. import pickBy from 'lodash/pickBy';
  11. import moment from 'moment';
  12. import * as qs from 'query-string';
  13. import {addMessage} from 'sentry/actionCreators/indicator';
  14. import {fetchOrgMembers, indexMembersByProject} from 'sentry/actionCreators/members';
  15. import {fetchTagValues, loadOrganizationTags} from 'sentry/actionCreators/tags';
  16. import type {Client} from 'sentry/api';
  17. import HookOrDefault from 'sentry/components/hookOrDefault';
  18. import * as Layout from 'sentry/components/layouts/thirds';
  19. import LoadingIndicator from 'sentry/components/loadingIndicator';
  20. import {extractSelectionParameters} from 'sentry/components/organizations/pageFilters/utils';
  21. import type {CursorHandler} from 'sentry/components/pagination';
  22. import Pagination from 'sentry/components/pagination';
  23. import Panel from 'sentry/components/panels/panel';
  24. import PanelBody from 'sentry/components/panels/panelBody';
  25. import QueryCount from 'sentry/components/queryCount';
  26. import ProcessingIssueList from 'sentry/components/stream/processingIssueList';
  27. import {DEFAULT_QUERY, DEFAULT_STATS_PERIOD, NEW_DEFAULT_QUERY} from 'sentry/constants';
  28. import {t, tct} from 'sentry/locale';
  29. import GroupStore from 'sentry/stores/groupStore';
  30. import IssueListCacheStore from 'sentry/stores/IssueListCacheStore';
  31. import SelectedGroupStore from 'sentry/stores/selectedGroupStore';
  32. import {space} from 'sentry/styles/space';
  33. import type {
  34. BaseGroup,
  35. Group,
  36. Organization,
  37. PageFilters,
  38. PriorityLevel,
  39. SavedSearch,
  40. TagCollection,
  41. } from 'sentry/types';
  42. import {GroupStatus, IssueCategory} from 'sentry/types';
  43. import {defined} from 'sentry/utils';
  44. import {trackAnalytics} from 'sentry/utils/analytics';
  45. import {browserHistory} from 'sentry/utils/browserHistory';
  46. import CursorPoller from 'sentry/utils/cursorPoller';
  47. import {getUtcDateString} from 'sentry/utils/dates';
  48. import getCurrentSentryReactRootSpan from 'sentry/utils/getCurrentSentryReactRootSpan';
  49. import parseApiError from 'sentry/utils/parseApiError';
  50. import parseLinkHeader from 'sentry/utils/parseLinkHeader';
  51. import {
  52. makeIssuesINPObserver,
  53. VisuallyCompleteWithData,
  54. } from 'sentry/utils/performanceForSentry';
  55. import {decodeScalar} from 'sentry/utils/queryString';
  56. import type {WithRouteAnalyticsProps} from 'sentry/utils/routeAnalytics/withRouteAnalytics';
  57. import withRouteAnalytics from 'sentry/utils/routeAnalytics/withRouteAnalytics';
  58. import withApi from 'sentry/utils/withApi';
  59. import {normalizeUrl} from 'sentry/utils/withDomainRequired';
  60. import withIssueTags from 'sentry/utils/withIssueTags';
  61. import withOrganization from 'sentry/utils/withOrganization';
  62. import withPageFilters from 'sentry/utils/withPageFilters';
  63. import withSavedSearches from 'sentry/utils/withSavedSearches';
  64. import SavedIssueSearches from 'sentry/views/issueList/savedIssueSearches';
  65. import type {IssueUpdateData} from 'sentry/views/issueList/types';
  66. import {parseIssuePrioritySearch} from 'sentry/views/issueList/utils/parseIssuePrioritySearch';
  67. import IssueListActions from './actions';
  68. import IssueListFilters from './filters';
  69. import GroupListBody from './groupListBody';
  70. import IssueListHeader from './header';
  71. import type {QueryCounts} from './utils';
  72. import {
  73. DEFAULT_ISSUE_STREAM_SORT,
  74. FOR_REVIEW_QUERIES,
  75. getTabs,
  76. getTabsWithCounts,
  77. isForReviewQuery,
  78. IssueSortOptions,
  79. Query,
  80. TAB_MAX_COUNT,
  81. } from './utils';
  82. const MAX_ITEMS = 25;
  83. // the default period for the graph in each issue row
  84. const DEFAULT_GRAPH_STATS_PERIOD = '24h';
  85. // the allowed period choices for graph in each issue row
  86. const DYNAMIC_COUNTS_STATS_PERIODS = new Set(['14d', '24h', 'auto']);
  87. const MAX_ISSUES_COUNT = 100;
  88. type Params = {
  89. orgId: string;
  90. };
  91. type Props = {
  92. api: Client;
  93. location: Location;
  94. organization: Organization;
  95. params: Params;
  96. savedSearch: SavedSearch;
  97. savedSearchLoading: boolean;
  98. savedSearches: SavedSearch[];
  99. selectedSearchId: string;
  100. selection: PageFilters;
  101. tags: TagCollection;
  102. } & RouteComponentProps<{}, {searchId?: string}> &
  103. WithRouteAnalyticsProps;
  104. type State = {
  105. error: string | null;
  106. groupIds: string[];
  107. issuesLoading: boolean;
  108. memberList: ReturnType<typeof indexMembersByProject>;
  109. pageLinks: string;
  110. /**
  111. * Current query total
  112. */
  113. queryCount: number;
  114. /**
  115. * Counts for each inbox tab
  116. */
  117. queryCounts: QueryCounts;
  118. queryMaxCount: number;
  119. realtimeActive: boolean;
  120. selectAllActive: boolean;
  121. // Will be set to true if there is valid session data from issue-stats api call
  122. query?: string;
  123. };
  124. interface EndpointParams extends Partial<PageFilters['datetime']> {
  125. environment: string[];
  126. project: number[];
  127. cursor?: string;
  128. groupStatsPeriod?: string | null;
  129. page?: number | string;
  130. query?: string;
  131. sort?: string;
  132. statsPeriod?: string | null;
  133. useGroupSnubaDataset?: boolean;
  134. }
  135. type CountsEndpointParams = Omit<EndpointParams, 'cursor' | 'page' | 'query'> & {
  136. query: string[];
  137. };
  138. type StatEndpointParams = Omit<EndpointParams, 'cursor' | 'page'> & {
  139. groups: string[];
  140. expand?: string | string[];
  141. };
  142. const DataConsentBanner = HookOrDefault({
  143. hookName: 'component:data-consent-banner',
  144. defaultComponent: null,
  145. });
  146. class IssueListOverview extends Component<Props, State> {
  147. state: State = this.getInitialState();
  148. getInitialState() {
  149. const realtimeActiveCookie = Cookies.get('realtimeActive');
  150. const realtimeActive =
  151. typeof realtimeActiveCookie === 'undefined'
  152. ? false
  153. : realtimeActiveCookie === 'true';
  154. return {
  155. groupIds: [],
  156. actionTaken: false,
  157. selectAllActive: false,
  158. realtimeActive,
  159. pageLinks: '',
  160. queryCount: 0,
  161. queryCounts: {},
  162. queryMaxCount: 0,
  163. error: null,
  164. issuesLoading: true,
  165. memberList: {},
  166. };
  167. }
  168. componentDidMount() {
  169. this._performanceObserver = makeIssuesINPObserver();
  170. this._poller = new CursorPoller({
  171. linkPreviousHref: parseLinkHeader(this.state.pageLinks)?.previous?.href,
  172. success: this.onRealtimePoll,
  173. });
  174. // Wait for saved searches to load so if the user is on a saved search
  175. // or they have a pinned search we load the correct data the first time.
  176. // But if searches are already there, we can go right to fetching issues
  177. if (
  178. !this.props.savedSearchLoading ||
  179. this.props.organization.features.includes('issue-stream-performance')
  180. ) {
  181. const loadedFromCache = this.loadFromCache();
  182. if (!loadedFromCache) {
  183. // It's possible the projects query parameter is not yet ready and this
  184. // request will be repeated in componentDidUpdate
  185. this.fetchData();
  186. }
  187. }
  188. this.fetchTags();
  189. this.fetchMemberList();
  190. // let custom analytics take control
  191. this.props.setDisableRouteAnalytics?.();
  192. }
  193. componentDidUpdate(prevProps: Props, prevState: State) {
  194. if (prevState.realtimeActive !== this.state.realtimeActive) {
  195. // User toggled realtime button
  196. if (this.state.realtimeActive) {
  197. this.resumePolling();
  198. } else {
  199. this._poller.disable();
  200. }
  201. }
  202. // If the project selection has changed reload the member list and tag keys
  203. // allowing autocomplete and tag sidebar to be more accurate.
  204. if (!isEqual(prevProps.selection.projects, this.props.selection.projects)) {
  205. this.loadFromCache();
  206. this.fetchMemberList();
  207. this.fetchTags();
  208. }
  209. const selectionChanged = !isEqual(prevProps.selection, this.props.selection);
  210. // Wait for saved searches to load before we attempt to fetch stream data
  211. // Selection changing could indicate that the projects query parameter has populated
  212. // and we should refetch data.
  213. if (this.props.savedSearchLoading && !selectionChanged) {
  214. return;
  215. }
  216. if (
  217. prevProps.savedSearchLoading &&
  218. !this.props.savedSearchLoading &&
  219. this.props.organization.features.includes('issue-stream-performance')
  220. ) {
  221. return;
  222. }
  223. if (
  224. prevProps.savedSearchLoading &&
  225. !this.props.organization.features.includes('issue-stream-performance')
  226. ) {
  227. const loadedFromCache = this.loadFromCache();
  228. if (!loadedFromCache) {
  229. this.fetchData();
  230. }
  231. return;
  232. }
  233. const prevUrlQuery = prevProps.location.query;
  234. const newUrlQuery = this.props.location.query;
  235. const prevQuery = this.getQueryFromSavedSearchOrLocation({
  236. savedSearch: prevProps.savedSearch,
  237. location: prevProps.location,
  238. });
  239. const newQuery = this.getQuery();
  240. const prevSort = this.getSortFromSavedSearchOrLocation({
  241. savedSearch: prevProps.savedSearch,
  242. location: prevProps.location,
  243. });
  244. const newSort = this.getSort();
  245. // If any important url parameter changed or saved search changed
  246. // reload data.
  247. if (
  248. selectionChanged ||
  249. prevUrlQuery.cursor !== newUrlQuery.cursor ||
  250. prevUrlQuery.statsPeriod !== newUrlQuery.statsPeriod ||
  251. prevUrlQuery.groupStatsPeriod !== newUrlQuery.groupStatsPeriod ||
  252. prevQuery !== newQuery ||
  253. prevSort !== newSort
  254. ) {
  255. this.fetchData(selectionChanged);
  256. } else if (
  257. !this._lastRequest &&
  258. prevState.issuesLoading === false &&
  259. this.state.issuesLoading
  260. ) {
  261. // Reload if we issues are loading or their loading state changed.
  262. // This can happen when transitionTo is called
  263. this.fetchData();
  264. }
  265. }
  266. componentWillUnmount() {
  267. const groups = GroupStore.getState() as Group[];
  268. if (groups.length > 0 && !this.state.issuesLoading && !this.state.realtimeActive) {
  269. IssueListCacheStore.save(this.getCacheEndpointParams(), {
  270. groups,
  271. queryCount: this.state.queryCount,
  272. queryMaxCount: this.state.queryMaxCount,
  273. pageLinks: this.state.pageLinks,
  274. });
  275. }
  276. if (this._performanceObserver) {
  277. this._performanceObserver.disconnect();
  278. }
  279. this._poller.disable();
  280. SelectedGroupStore.reset();
  281. GroupStore.reset();
  282. this.props.api.clear();
  283. this.listener?.();
  284. }
  285. private _performanceObserver: PerformanceObserver | undefined;
  286. private _poller: any;
  287. private _lastRequest: any;
  288. private _lastStatsRequest: any;
  289. private _lastFetchCountsRequest: any;
  290. private actionTaken = false;
  291. private undo = false;
  292. getQueryFromSavedSearchOrLocation({
  293. savedSearch,
  294. location,
  295. }: Pick<Props, 'savedSearch' | 'location'>): string {
  296. if (savedSearch) {
  297. return savedSearch.query;
  298. }
  299. const {query} = location.query;
  300. if (query !== undefined) {
  301. return decodeScalar(query, '');
  302. }
  303. return this.props.organization.features.includes('issue-priority-ui')
  304. ? NEW_DEFAULT_QUERY
  305. : DEFAULT_QUERY;
  306. }
  307. getSortFromSavedSearchOrLocation({
  308. savedSearch,
  309. location,
  310. }: Pick<Props, 'savedSearch' | 'location'>): string {
  311. if (!location.query.sort && savedSearch?.id) {
  312. return savedSearch.sort;
  313. }
  314. if (location.query.sort) {
  315. return location.query.sort as string;
  316. }
  317. return DEFAULT_ISSUE_STREAM_SORT;
  318. }
  319. /**
  320. * Load the previous
  321. * @returns Returns true if the data was loaded from cache
  322. */
  323. loadFromCache(): boolean {
  324. const cache = IssueListCacheStore.getFromCache(this.getCacheEndpointParams());
  325. if (!cache) {
  326. return false;
  327. }
  328. this.setState(
  329. {
  330. issuesLoading: false,
  331. queryCount: cache.queryCount,
  332. queryMaxCount: cache.queryMaxCount,
  333. pageLinks: cache.pageLinks,
  334. },
  335. () => {
  336. // Handle this in the next tick to avoid being overwritten by GroupStore.reset
  337. // Group details clears the GroupStore at the same time this component mounts
  338. GroupStore.add(cache.groups);
  339. // Clear cache after loading
  340. IssueListCacheStore.reset();
  341. }
  342. );
  343. return true;
  344. }
  345. getQuery(): string {
  346. return this.getQueryFromSavedSearchOrLocation({
  347. savedSearch: this.props.savedSearch,
  348. location: this.props.location,
  349. });
  350. }
  351. getSort(): string {
  352. return this.getSortFromSavedSearchOrLocation({
  353. savedSearch: this.props.savedSearch,
  354. location: this.props.location,
  355. });
  356. }
  357. getGroupStatsPeriod(): string {
  358. let currentPeriod: string;
  359. if (typeof this.props.location.query?.groupStatsPeriod === 'string') {
  360. currentPeriod = this.props.location.query.groupStatsPeriod;
  361. } else {
  362. currentPeriod = DEFAULT_GRAPH_STATS_PERIOD;
  363. }
  364. return DYNAMIC_COUNTS_STATS_PERIODS.has(currentPeriod)
  365. ? currentPeriod
  366. : DEFAULT_GRAPH_STATS_PERIOD;
  367. }
  368. getEndpointParams = (): EndpointParams => {
  369. const {selection} = this.props;
  370. const params: EndpointParams = {
  371. project: selection.projects,
  372. environment: selection.environments,
  373. query: this.getQuery(),
  374. ...selection.datetime,
  375. };
  376. if (selection.datetime.period) {
  377. delete params.period;
  378. params.statsPeriod = selection.datetime.period;
  379. }
  380. if (params.end) {
  381. params.end = getUtcDateString(params.end);
  382. }
  383. if (params.start) {
  384. params.start = getUtcDateString(params.start);
  385. }
  386. const sort = this.getSort();
  387. if (sort !== DEFAULT_ISSUE_STREAM_SORT) {
  388. params.sort = sort;
  389. }
  390. const groupStatsPeriod = this.getGroupStatsPeriod();
  391. if (groupStatsPeriod !== DEFAULT_GRAPH_STATS_PERIOD) {
  392. params.groupStatsPeriod = groupStatsPeriod;
  393. }
  394. if (this.props.location.query.useGroupSnubaDataset) {
  395. params.useGroupSnubaDataset = true;
  396. }
  397. // only include defined values.
  398. return pickBy(params, v => defined(v)) as EndpointParams;
  399. };
  400. getCacheEndpointParams = (): EndpointParams => {
  401. const cursor = this.props.location.query.cursor;
  402. return {
  403. ...this.getEndpointParams(),
  404. cursor,
  405. };
  406. };
  407. getSelectedProjectIds = (): string[] => {
  408. return this.props.selection.projects.map(projectId => String(projectId));
  409. };
  410. fetchMemberList() {
  411. const projectIds = this.getSelectedProjectIds();
  412. fetchOrgMembers(this.props.api, this.props.organization.slug, projectIds).then(
  413. members => {
  414. this.setState({memberList: indexMembersByProject(members)});
  415. }
  416. );
  417. }
  418. fetchTags() {
  419. const {api, organization, selection} = this.props;
  420. loadOrganizationTags(api, organization.slug, selection);
  421. }
  422. fetchStats = (groups: string[]) => {
  423. // If we have no groups to fetch, just skip stats
  424. if (!groups.length) {
  425. return;
  426. }
  427. const requestParams: StatEndpointParams = {
  428. ...this.getEndpointParams(),
  429. groups,
  430. };
  431. // If no stats period values are set, use default
  432. if (!requestParams.statsPeriod && !requestParams.start) {
  433. requestParams.statsPeriod = DEFAULT_STATS_PERIOD;
  434. }
  435. this._lastStatsRequest = this.props.api.request(this.groupStatsEndpoint, {
  436. method: 'GET',
  437. data: qs.stringify(requestParams),
  438. success: data => {
  439. if (!data) {
  440. return;
  441. }
  442. GroupStore.onPopulateStats(groups, data);
  443. this.trackTabViewed(groups, data, this.state.queryCount);
  444. },
  445. error: err => {
  446. this.setState({
  447. error: parseApiError(err),
  448. });
  449. },
  450. complete: () => {
  451. this._lastStatsRequest = null;
  452. // End navigation transaction to prevent additional page requests from impacting page metrics.
  453. // Other transactions include stacktrace preview request
  454. const currentSpan = Sentry.getActiveSpan();
  455. const rootSpan = currentSpan ? Sentry.getRootSpan(currentSpan) : undefined;
  456. if (rootSpan && Sentry.spanToJSON(rootSpan).op === 'navigation') {
  457. rootSpan.end();
  458. }
  459. },
  460. });
  461. };
  462. fetchCounts = (currentQueryCount: number, fetchAllCounts: boolean) => {
  463. const {organization} = this.props;
  464. const {queryCounts: _queryCounts} = this.state;
  465. let queryCounts: QueryCounts = {..._queryCounts};
  466. const endpointParams = this.getEndpointParams();
  467. const tabQueriesWithCounts = getTabsWithCounts(organization);
  468. const currentTabQuery = tabQueriesWithCounts.includes(endpointParams.query as Query)
  469. ? endpointParams.query
  470. : null;
  471. // Update the count based on the exact number of issues, these shown as is
  472. if (currentTabQuery) {
  473. queryCounts[currentTabQuery] = {
  474. count: currentQueryCount,
  475. hasMore: false,
  476. };
  477. }
  478. this.setState({queryCounts});
  479. // If all tabs' counts are fetched, skip and only set
  480. if (
  481. fetchAllCounts ||
  482. !tabQueriesWithCounts.every(tabQuery => queryCounts[tabQuery] !== undefined)
  483. ) {
  484. const requestParams: CountsEndpointParams = {
  485. ...omit(endpointParams, 'query'),
  486. // fetch the counts for the tabs whose counts haven't been fetched yet
  487. query: tabQueriesWithCounts.filter(_query => _query !== currentTabQuery),
  488. };
  489. // If no stats period values are set, use default
  490. if (!requestParams.statsPeriod && !requestParams.start) {
  491. requestParams.statsPeriod = DEFAULT_STATS_PERIOD;
  492. }
  493. this._lastFetchCountsRequest = this.props.api.request(this.groupCountsEndpoint, {
  494. method: 'GET',
  495. data: qs.stringify(requestParams),
  496. success: data => {
  497. if (!data) {
  498. return;
  499. }
  500. // Counts coming from the counts endpoint is limited to 100, for >= 100 we display 99+
  501. queryCounts = {
  502. ...queryCounts,
  503. ...mapValues(data, (count: number) => ({
  504. count,
  505. hasMore: count > TAB_MAX_COUNT,
  506. })),
  507. };
  508. },
  509. error: () => {
  510. this.setState({queryCounts: {}});
  511. },
  512. complete: () => {
  513. this._lastFetchCountsRequest = null;
  514. this.setState({queryCounts});
  515. },
  516. });
  517. }
  518. };
  519. fetchData = (fetchAllCounts = false) => {
  520. const {organization} = this.props;
  521. const query = this.getQuery();
  522. if (this.state.realtimeActive || (!this.actionTaken && !this.undo)) {
  523. GroupStore.loadInitialData([]);
  524. this.setState({
  525. issuesLoading: true,
  526. queryCount: 0,
  527. error: null,
  528. });
  529. }
  530. const span = getCurrentSentryReactRootSpan();
  531. span?.setAttribute('query.sort', this.getSort());
  532. this.setState({
  533. error: null,
  534. });
  535. // Used for Issue Stream Performance project, enabled means we are doing saved search look up in the backend
  536. const savedSearchLookupEnabled = 0;
  537. const savedSearchLookupDisabled = 1;
  538. const requestParams: any = {
  539. ...this.getEndpointParams(),
  540. limit: MAX_ITEMS,
  541. shortIdLookup: 1,
  542. savedSearch: this.props.organization.features.includes('issue-stream-performance')
  543. ? this.props.savedSearchLoading
  544. ? savedSearchLookupEnabled
  545. : savedSearchLookupDisabled
  546. : savedSearchLookupDisabled,
  547. };
  548. if (
  549. this.props.organization.features.includes('issue-stream-performance') &&
  550. this.props.selectedSearchId
  551. ) {
  552. requestParams.searchId = this.props.selectedSearchId;
  553. }
  554. if (
  555. this.props.organization.features.includes('issue-stream-performance') &&
  556. this.props.savedSearchLoading &&
  557. !this.props.location.query.query
  558. ) {
  559. delete requestParams.query;
  560. }
  561. const currentQuery = this.props.location.query || {};
  562. if ('cursor' in currentQuery) {
  563. requestParams.cursor = currentQuery.cursor;
  564. }
  565. // If no stats period values are set, use default
  566. if (!requestParams.statsPeriod && !requestParams.start) {
  567. requestParams.statsPeriod = DEFAULT_STATS_PERIOD;
  568. }
  569. requestParams.expand = ['owners', 'inbox'];
  570. requestParams.collapse = ['stats', 'unhandled'];
  571. if (this._lastRequest) {
  572. this._lastRequest.cancel();
  573. }
  574. if (this._lastStatsRequest) {
  575. this._lastStatsRequest.cancel();
  576. }
  577. if (this._lastFetchCountsRequest) {
  578. this._lastFetchCountsRequest.cancel();
  579. }
  580. this._poller.disable();
  581. this._lastRequest = this.props.api.request(this.groupListEndpoint, {
  582. method: 'GET',
  583. data: qs.stringify(requestParams),
  584. success: (data, _, resp) => {
  585. if (!resp) {
  586. return;
  587. }
  588. // If this is a direct hit, we redirect to the intended result directly.
  589. if (resp.getResponseHeader('X-Sentry-Direct-Hit') === '1') {
  590. let redirect: string;
  591. if (data[0]?.matchingEventId) {
  592. const {id, matchingEventId} = data[0];
  593. redirect = `/organizations/${organization.slug}/issues/${id}/events/${matchingEventId}/`;
  594. } else {
  595. const {id} = data[0];
  596. redirect = `/organizations/${organization.slug}/issues/${id}/`;
  597. }
  598. browserHistory.replace(
  599. normalizeUrl({
  600. pathname: redirect,
  601. query: {
  602. referrer: 'issue-list',
  603. ...extractSelectionParameters(this.props.location.query),
  604. },
  605. })
  606. );
  607. return;
  608. }
  609. if (this.undo) {
  610. GroupStore.loadInitialData(data);
  611. }
  612. GroupStore.add(data);
  613. this.fetchStats(data.map((group: BaseGroup) => group.id));
  614. const hits = resp.getResponseHeader('X-Hits');
  615. const queryCount =
  616. typeof hits !== 'undefined' && hits ? parseInt(hits, 10) || 0 : 0;
  617. const maxHits = resp.getResponseHeader('X-Max-Hits');
  618. const queryMaxCount =
  619. typeof maxHits !== 'undefined' && maxHits ? parseInt(maxHits, 10) || 0 : 0;
  620. const pageLinks = resp.getResponseHeader('Link');
  621. this.fetchCounts(queryCount, fetchAllCounts);
  622. this.setState({
  623. error: null,
  624. issuesLoading: false,
  625. queryCount,
  626. queryMaxCount,
  627. pageLinks: pageLinks !== null ? pageLinks : '',
  628. });
  629. if (data.length === 0) {
  630. trackAnalytics('issue_search.empty', {
  631. organization: this.props.organization,
  632. search_type: 'issues',
  633. search_source: 'main_search',
  634. query,
  635. });
  636. }
  637. },
  638. error: err => {
  639. trackAnalytics('issue_search.failed', {
  640. organization: this.props.organization,
  641. search_type: 'issues',
  642. search_source: 'main_search',
  643. error: parseApiError(err),
  644. });
  645. this.setState({
  646. error: parseApiError(err),
  647. issuesLoading: false,
  648. });
  649. },
  650. complete: () => {
  651. this._lastRequest = null;
  652. this.resumePolling();
  653. if (!this.state.realtimeActive) {
  654. this.actionTaken = false;
  655. this.undo = false;
  656. }
  657. },
  658. });
  659. };
  660. resumePolling = () => {
  661. if (!this.state.pageLinks) {
  662. return;
  663. }
  664. // Only resume polling if we're on the first page of results
  665. const links = parseLinkHeader(this.state.pageLinks);
  666. if (links && !links.previous.results && this.state.realtimeActive) {
  667. this._poller.setEndpoint(links?.previous?.href);
  668. this._poller.enable();
  669. }
  670. };
  671. get groupListEndpoint(): string {
  672. const {organization} = this.props;
  673. return `/organizations/${organization.slug}/issues/`;
  674. }
  675. get groupCountsEndpoint(): string {
  676. const {organization} = this.props;
  677. return `/organizations/${organization.slug}/issues-count/`;
  678. }
  679. get groupStatsEndpoint(): string {
  680. const {organization} = this.props;
  681. return `/organizations/${organization.slug}/issues-stats/`;
  682. }
  683. onRealtimeChange = (realtime: boolean) => {
  684. Cookies.set('realtimeActive', realtime.toString());
  685. this.setState({realtimeActive: realtime});
  686. trackAnalytics('issues_stream.realtime_clicked', {
  687. organization: this.props.organization,
  688. enabled: realtime,
  689. });
  690. };
  691. onSelectStatsPeriod = (period: string) => {
  692. const {location} = this.props;
  693. if (period !== this.getGroupStatsPeriod()) {
  694. const cursor = location.query.cursor;
  695. const queryPageInt = parseInt(location.query.page, 10);
  696. const page = isNaN(queryPageInt) || !location.query.cursor ? 0 : queryPageInt;
  697. this.transitionTo({cursor, page, groupStatsPeriod: period});
  698. }
  699. };
  700. onRealtimePoll = (data: any, {queryCount}: {queryCount: number}) => {
  701. // Note: We do not update state with cursors from polling,
  702. // `CursorPoller` updates itself with new cursors
  703. GroupStore.addToFront(data);
  704. this.setState({queryCount});
  705. };
  706. listener = GroupStore.listen(() => this.onGroupChange(), undefined);
  707. onGroupChange() {
  708. const groupIds = GroupStore.getAllItems()
  709. .map(item => item.id)
  710. .slice(0, MAX_ISSUES_COUNT);
  711. if (!isEqual(groupIds, this.state.groupIds)) {
  712. this.setState({groupIds});
  713. }
  714. }
  715. trackTabViewed(groups: string[], data: Group[], numHits: number | null) {
  716. const {organization, location} = this.props;
  717. const page = location.query.page;
  718. const endpointParams = this.getEndpointParams();
  719. const tabQueriesWithCounts = getTabsWithCounts(organization);
  720. const currentTabQuery = tabQueriesWithCounts.includes(endpointParams.query as Query)
  721. ? endpointParams.query
  722. : null;
  723. const tab = getTabs(organization).find(
  724. ([tabQuery]) => currentTabQuery === tabQuery
  725. )?.[1];
  726. const numPerfIssues = groups.filter(
  727. group => GroupStore.get(group)?.issueCategory === IssueCategory.PERFORMANCE
  728. ).length;
  729. // First and last seen are only available after the group has fetched stats
  730. // Number of issues shown whose first seen is more than 30 days ago
  731. const numOldIssues = data.filter((group: BaseGroup) =>
  732. moment(new Date(group.firstSeen)).isBefore(moment().subtract(30, 'd'))
  733. ).length;
  734. // number of issues shown whose first seen is less than 7 days
  735. const numNewIssues = data.filter((group: BaseGroup) =>
  736. moment(new Date(group.firstSeen)).isAfter(moment().subtract(7, 'd'))
  737. ).length;
  738. trackAnalytics('issues_tab.viewed', {
  739. organization,
  740. tab: tab?.analyticsName,
  741. page: page ? parseInt(page, 10) : 0,
  742. query: this.getQuery(),
  743. num_perf_issues: numPerfIssues,
  744. num_old_issues: numOldIssues,
  745. num_new_issues: numNewIssues,
  746. num_issues: data.length,
  747. total_issues_count: numHits,
  748. sort: this.getSort(),
  749. });
  750. }
  751. onSearch = (query: string) => {
  752. if (query === this.state.query) {
  753. // if query is the same, just re-fetch data
  754. this.fetchData();
  755. } else {
  756. // Clear the saved search as the user wants something else.
  757. this.transitionTo({query}, null);
  758. }
  759. };
  760. onSortChange = (sort: string) => {
  761. trackAnalytics('issues_stream.sort_changed', {
  762. organization: this.props.organization,
  763. sort,
  764. });
  765. this.transitionTo({sort});
  766. };
  767. onCursorChange: CursorHandler = (nextCursor, _path, _query, delta) => {
  768. const queryPageInt = parseInt(this.props.location.query.page, 10);
  769. let nextPage: number | undefined = isNaN(queryPageInt) ? delta : queryPageInt + delta;
  770. let cursor: undefined | string = nextCursor;
  771. // unset cursor and page when we navigate back to the first page
  772. // also reset cursor if somehow the previous button is enabled on
  773. // first page and user attempts to go backwards
  774. if (nextPage <= 0) {
  775. cursor = undefined;
  776. nextPage = undefined;
  777. }
  778. this.transitionTo({cursor, page: nextPage});
  779. };
  780. paginationAnalyticsEvent = (direction: string) => {
  781. trackAnalytics('issues_stream.paginate', {
  782. organization: this.props.organization,
  783. direction,
  784. });
  785. };
  786. /**
  787. * Returns true if all results in the current query are visible/on this page
  788. */
  789. allResultsVisible(): boolean {
  790. if (!this.state.pageLinks) {
  791. return false;
  792. }
  793. const links = parseLinkHeader(this.state.pageLinks);
  794. return links && !links.previous.results && !links.next.results;
  795. }
  796. transitionTo = (
  797. newParams: Partial<EndpointParams> = {},
  798. savedSearch: (SavedSearch & {projectId?: number}) | null = this.props.savedSearch
  799. ) => {
  800. const query = {
  801. ...omit(this.props.location.query, ['page', 'cursor']),
  802. referrer: 'issue-list',
  803. ...this.getEndpointParams(),
  804. ...newParams,
  805. };
  806. const {organization} = this.props;
  807. let path: string;
  808. if (savedSearch?.id) {
  809. path = `/organizations/${organization.slug}/issues/searches/${savedSearch.id}/`;
  810. // Remove the query as saved searches bring their own query string.
  811. delete query.query;
  812. // If we aren't going to another page in the same search
  813. // drop the query and replace the current project, with the saved search search project
  814. // if available.
  815. if (!query.cursor && savedSearch.projectId) {
  816. query.project = [savedSearch.projectId];
  817. }
  818. if (!query.cursor && !newParams.sort && savedSearch.sort) {
  819. query.sort = savedSearch.sort;
  820. }
  821. } else {
  822. path = `/organizations/${organization.slug}/issues/`;
  823. }
  824. if (
  825. query.sort === IssueSortOptions.INBOX &&
  826. !FOR_REVIEW_QUERIES.includes(query.query || '')
  827. ) {
  828. delete query.sort;
  829. }
  830. if (
  831. path !== this.props.location.pathname ||
  832. !isEqual(query, this.props.location.query)
  833. ) {
  834. browserHistory.push({
  835. pathname: normalizeUrl(path),
  836. query,
  837. });
  838. this.setState({issuesLoading: true});
  839. }
  840. };
  841. displayReprocessingTab() {
  842. const {organization} = this.props;
  843. const {queryCounts} = this.state;
  844. return (
  845. organization.features.includes('reprocessing-v2') &&
  846. !!queryCounts?.[Query.REPROCESSING]?.count
  847. );
  848. }
  849. displayReprocessingLayout(showReprocessingTab: boolean, query: string) {
  850. return showReprocessingTab && query === Query.REPROCESSING;
  851. }
  852. renderLoading(): React.ReactNode {
  853. return (
  854. <Layout.Page withPadding>
  855. <LoadingIndicator />
  856. </Layout.Page>
  857. );
  858. }
  859. onSavedSearchSelect = (savedSearch: SavedSearch) => {
  860. trackAnalytics('organization_saved_search.selected', {
  861. organization: this.props.organization,
  862. search_type: 'issues',
  863. id: savedSearch.id ? parseInt(savedSearch.id, 10) : -1,
  864. is_global: savedSearch.isGlobal,
  865. query: savedSearch.query,
  866. visibility: savedSearch.visibility,
  867. });
  868. this.setState({issuesLoading: true}, () => this.transitionTo(undefined, savedSearch));
  869. };
  870. onDelete = () => {
  871. this.actionTaken = true;
  872. this.fetchData(true);
  873. };
  874. undoAction = ({data, groups}: {data: IssueUpdateData; groups: BaseGroup[]}) => {
  875. const {organization, selection} = this.props;
  876. const query = this.getQuery();
  877. const projectIds = selection?.projects?.map(p => p.toString());
  878. const endpoint = `/organizations/${organization.slug}/issues/`;
  879. if (this._lastRequest) {
  880. this._lastRequest.cancel();
  881. }
  882. if (this._lastStatsRequest) {
  883. this._lastStatsRequest.cancel();
  884. }
  885. if (this._lastFetchCountsRequest) {
  886. this._lastFetchCountsRequest.cancel();
  887. }
  888. this.props.api.request(endpoint, {
  889. method: 'PUT',
  890. data,
  891. query: {
  892. project: projectIds,
  893. id: groups.map(group => group.id),
  894. },
  895. success: response => {
  896. if (!response) {
  897. return;
  898. }
  899. // If on the Ignore or For Review tab, adding back to the GroupStore will make the issue show up
  900. // on this page for a second and then be removed (will show up on All Unresolved). This is to
  901. // stop this from happening and avoid confusion.
  902. if (!query.includes('is:ignored') && !isForReviewQuery(query)) {
  903. GroupStore.add(groups);
  904. }
  905. this.undo = true;
  906. },
  907. error: err => {
  908. this.setState({
  909. error: parseApiError(err),
  910. issuesLoading: false,
  911. });
  912. },
  913. complete: () => {
  914. this.fetchData();
  915. },
  916. });
  917. };
  918. onActionTaken = (itemIds: string[], data: IssueUpdateData) => {
  919. if (this.state.realtimeActive) {
  920. return;
  921. }
  922. const query = this.getQuery();
  923. const groups = itemIds.map(id => GroupStore.get(id)).filter(defined);
  924. if ('status' in data) {
  925. if (data.status === 'resolved') {
  926. this.onIssueAction({
  927. itemIds,
  928. actionType: 'Resolved',
  929. shouldRemove:
  930. query.includes('is:unresolved') ||
  931. query.includes('is:ignored') ||
  932. isForReviewQuery(query),
  933. undo: () =>
  934. this.undoAction({
  935. data: {status: GroupStatus.UNRESOLVED, statusDetails: {}},
  936. groups,
  937. }),
  938. });
  939. return;
  940. }
  941. if (data.status === 'ignored') {
  942. this.onIssueAction({
  943. itemIds,
  944. actionType: 'Archived',
  945. shouldRemove: query.includes('is:unresolved') || isForReviewQuery(query),
  946. undo: () =>
  947. this.undoAction({
  948. data: {status: GroupStatus.UNRESOLVED, statusDetails: {}},
  949. groups,
  950. }),
  951. });
  952. return;
  953. }
  954. }
  955. if ('inbox' in data && data.inbox === false) {
  956. this.onIssueAction({
  957. itemIds,
  958. actionType: 'Reviewed',
  959. shouldRemove: isForReviewQuery(query),
  960. });
  961. return;
  962. }
  963. if ('priority' in data && typeof data.priority === 'string') {
  964. const priorityValues = parseIssuePrioritySearch(query);
  965. const priority = data.priority.toLowerCase() as PriorityLevel;
  966. this.onIssueAction({
  967. itemIds,
  968. actionType: 'Reprioritized',
  969. shouldRemove: !priorityValues.has(priority),
  970. });
  971. return;
  972. }
  973. };
  974. onIssueAction = ({
  975. itemIds,
  976. actionType,
  977. shouldRemove,
  978. undo,
  979. }: {
  980. actionType: 'Reviewed' | 'Resolved' | 'Ignored' | 'Archived' | 'Reprioritized';
  981. itemIds: string[];
  982. shouldRemove: boolean;
  983. undo?: () => void;
  984. }) => {
  985. if (itemIds.length > 1) {
  986. addMessage(`${actionType} ${itemIds.length} ${t('Issues')}`, 'success', {
  987. duration: 4000,
  988. undo,
  989. });
  990. } else {
  991. const shortId = itemIds.map(item => GroupStore.get(item)?.shortId).toString();
  992. addMessage(`${actionType} ${shortId}`, 'success', {
  993. duration: 4000,
  994. undo,
  995. });
  996. }
  997. if (!shouldRemove) {
  998. return;
  999. }
  1000. const links = parseLinkHeader(this.state.pageLinks);
  1001. GroupStore.remove(itemIds);
  1002. const queryCount = this.state.queryCount - itemIds.length;
  1003. this.actionTaken = true;
  1004. this.setState({queryCount});
  1005. if (GroupStore.getAllItemIds().length === 0) {
  1006. // If we run out of issues on the last page, navigate back a page to
  1007. // avoid showing an empty state - if not on the last page, just show a spinner
  1008. const shouldGoBackAPage = links?.previous?.results && !links?.next?.results;
  1009. this.transitionTo({cursor: shouldGoBackAPage ? links.previous.cursor : undefined});
  1010. this.fetchCounts(queryCount, true);
  1011. } else {
  1012. this.fetchData(true);
  1013. }
  1014. };
  1015. tagValueLoader = (key: string, search: string) => {
  1016. const {organization} = this.props;
  1017. const projectIds = this.getSelectedProjectIds();
  1018. const endpointParams = this.getEndpointParams();
  1019. return fetchTagValues({
  1020. api: this.props.api,
  1021. orgSlug: organization.slug,
  1022. tagKey: key,
  1023. search,
  1024. projectIds,
  1025. endpointParams: endpointParams as any,
  1026. });
  1027. };
  1028. getPageCounts = () => {
  1029. const {location} = this.props;
  1030. const {pageLinks, queryCount, groupIds} = this.state;
  1031. const links = parseLinkHeader(pageLinks);
  1032. const queryPageInt = parseInt(location.query.page, 10);
  1033. // Cursor must be present for the page number to be used
  1034. const page = isNaN(queryPageInt) || !location.query.cursor ? 0 : queryPageInt;
  1035. let numPreviousIssues = Math.min(page * MAX_ITEMS, queryCount);
  1036. // Because the query param `page` is not tied to the request, we need to
  1037. // validate that it's correct at the first and last page
  1038. if (!links?.next?.results || this.allResultsVisible()) {
  1039. // On last available page
  1040. numPreviousIssues = Math.max(queryCount - groupIds.length, 0);
  1041. } else if (!links?.previous?.results) {
  1042. // On first available page
  1043. numPreviousIssues = 0;
  1044. }
  1045. return {
  1046. numPreviousIssues,
  1047. numIssuesOnPage: groupIds.length,
  1048. };
  1049. };
  1050. render() {
  1051. if (
  1052. this.props.savedSearchLoading &&
  1053. !this.props.organization.features.includes('issue-stream-performance')
  1054. ) {
  1055. return this.renderLoading();
  1056. }
  1057. const {
  1058. pageLinks,
  1059. queryCount,
  1060. queryCounts,
  1061. realtimeActive,
  1062. groupIds,
  1063. queryMaxCount,
  1064. issuesLoading,
  1065. error,
  1066. } = this.state;
  1067. const {organization, selection, router} = this.props;
  1068. const query = this.getQuery();
  1069. const modifiedQueryCount = Math.max(queryCount, 0);
  1070. const projectIds = selection?.projects?.map(p => p.toString());
  1071. const showReprocessingTab = this.displayReprocessingTab();
  1072. const displayReprocessingActions = this.displayReprocessingLayout(
  1073. showReprocessingTab,
  1074. query
  1075. );
  1076. const {numPreviousIssues, numIssuesOnPage} = this.getPageCounts();
  1077. return (
  1078. <Layout.Page>
  1079. <IssueListHeader
  1080. organization={organization}
  1081. query={query}
  1082. sort={this.getSort()}
  1083. queryCount={queryCount}
  1084. queryCounts={queryCounts}
  1085. realtimeActive={realtimeActive}
  1086. onRealtimeChange={this.onRealtimeChange}
  1087. router={router}
  1088. displayReprocessingTab={showReprocessingTab}
  1089. selectedProjectIds={selection.projects}
  1090. />
  1091. <StyledBody>
  1092. <StyledMain>
  1093. <DataConsentBanner source="issues" />
  1094. <IssueListFilters query={query} onSearch={this.onSearch} />
  1095. <Panel>
  1096. {groupIds.length !== 0 && (
  1097. <IssueListActions
  1098. selection={selection}
  1099. query={query}
  1100. queryCount={modifiedQueryCount}
  1101. onSelectStatsPeriod={this.onSelectStatsPeriod}
  1102. onActionTaken={this.onActionTaken}
  1103. onDelete={this.onDelete}
  1104. statsPeriod={this.getGroupStatsPeriod()}
  1105. groupIds={groupIds}
  1106. allResultsVisible={this.allResultsVisible()}
  1107. displayReprocessingActions={displayReprocessingActions}
  1108. sort={this.getSort()}
  1109. onSortChange={this.onSortChange}
  1110. />
  1111. )}
  1112. <PanelBody>
  1113. <ProcessingIssueList
  1114. organization={organization}
  1115. projectIds={projectIds}
  1116. showProject
  1117. />
  1118. <VisuallyCompleteWithData
  1119. hasData={this.state.groupIds.length > 0}
  1120. id="IssueList-Body"
  1121. isLoading={this.state.issuesLoading}
  1122. >
  1123. <GroupListBody
  1124. memberList={this.state.memberList}
  1125. groupStatsPeriod={this.getGroupStatsPeriod()}
  1126. groupIds={groupIds}
  1127. displayReprocessingLayout={displayReprocessingActions}
  1128. query={query}
  1129. selectedProjectIds={selection.projects}
  1130. loading={issuesLoading}
  1131. error={error}
  1132. refetchGroups={this.fetchData}
  1133. onActionTaken={this.onActionTaken}
  1134. />
  1135. </VisuallyCompleteWithData>
  1136. </PanelBody>
  1137. </Panel>
  1138. <StyledPagination
  1139. caption={
  1140. !issuesLoading && modifiedQueryCount > 0
  1141. ? tct('[start]-[end] of [total]', {
  1142. start: numPreviousIssues + 1,
  1143. end: numPreviousIssues + numIssuesOnPage,
  1144. total: (
  1145. <StyledQueryCount
  1146. hideParens
  1147. hideIfEmpty={false}
  1148. count={modifiedQueryCount}
  1149. max={queryMaxCount || 100}
  1150. />
  1151. ),
  1152. })
  1153. : null
  1154. }
  1155. pageLinks={pageLinks}
  1156. onCursor={this.onCursorChange}
  1157. paginationAnalyticsEvent={this.paginationAnalyticsEvent}
  1158. />
  1159. </StyledMain>
  1160. <SavedIssueSearches
  1161. {...{organization, query}}
  1162. onSavedSearchSelect={this.onSavedSearchSelect}
  1163. sort={this.getSort()}
  1164. />
  1165. </StyledBody>
  1166. </Layout.Page>
  1167. );
  1168. }
  1169. }
  1170. export default withRouteAnalytics(
  1171. withApi(
  1172. withPageFilters(
  1173. withSavedSearches(
  1174. withOrganization(withIssueTags(Sentry.withProfiler(IssueListOverview)))
  1175. )
  1176. )
  1177. )
  1178. );
  1179. export {IssueListOverview};
  1180. const StyledBody = styled('div')`
  1181. background-color: ${p => p.theme.background};
  1182. flex: 1;
  1183. display: grid;
  1184. gap: 0;
  1185. padding: 0;
  1186. grid-template-rows: 1fr;
  1187. grid-template-columns: minmax(0, 1fr) auto;
  1188. grid-template-areas: 'content saved-searches';
  1189. `;
  1190. const StyledMain = styled('section')`
  1191. grid-area: content;
  1192. padding: ${space(2)};
  1193. @media (min-width: ${p => p.theme.breakpoints.medium}) {
  1194. padding: ${space(3)} ${space(4)};
  1195. }
  1196. `;
  1197. const StyledPagination = styled(Pagination)`
  1198. margin-top: 0;
  1199. `;
  1200. const StyledQueryCount = styled(QueryCount)`
  1201. margin-left: 0;
  1202. `;