overview.tsx 41 KB

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