overview.tsx 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366
  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-timezone';
  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 {DEFAULT_QUERY, DEFAULT_STATS_PERIOD} from 'sentry/constants';
  27. import {t, tct} from 'sentry/locale';
  28. import GroupStore from 'sentry/stores/groupStore';
  29. import IssueListCacheStore from 'sentry/stores/IssueListCacheStore';
  30. import SelectedGroupStore from 'sentry/stores/selectedGroupStore';
  31. import {space} from 'sentry/styles/space';
  32. import type {PageFilters} from 'sentry/types/core';
  33. import type {
  34. BaseGroup,
  35. Group,
  36. PriorityLevel,
  37. SavedSearch,
  38. TagCollection,
  39. } from 'sentry/types/group';
  40. import {GroupStatus, IssueCategory} from 'sentry/types/group';
  41. import type {Organization} from 'sentry/types/organization';
  42. import {defined} from 'sentry/utils';
  43. import {trackAnalytics} from 'sentry/utils/analytics';
  44. import {browserHistory} from 'sentry/utils/browserHistory';
  45. import CursorPoller from 'sentry/utils/cursorPoller';
  46. import {getUtcDateString} from 'sentry/utils/dates';
  47. import getCurrentSentryReactRootSpan from 'sentry/utils/getCurrentSentryReactRootSpan';
  48. import parseApiError from 'sentry/utils/parseApiError';
  49. import parseLinkHeader from 'sentry/utils/parseLinkHeader';
  50. import {
  51. makeIssuesINPObserver,
  52. VisuallyCompleteWithData,
  53. } from 'sentry/utils/performanceForSentry';
  54. import {decodeScalar} from 'sentry/utils/queryString';
  55. import type {WithRouteAnalyticsProps} from 'sentry/utils/routeAnalytics/withRouteAnalytics';
  56. import withRouteAnalytics from 'sentry/utils/routeAnalytics/withRouteAnalytics';
  57. import normalizeUrl from 'sentry/utils/url/normalizeUrl';
  58. import withApi from 'sentry/utils/withApi';
  59. import withIssueTags from 'sentry/utils/withIssueTags';
  60. import withOrganization from 'sentry/utils/withOrganization';
  61. import withPageFilters from 'sentry/utils/withPageFilters';
  62. import withSavedSearches from 'sentry/utils/withSavedSearches';
  63. import CustomViewsIssueListHeader from 'sentry/views/issueList/customViewsHeader';
  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 (
  297. !this.props.organization.features.includes('issue-stream-custom-views') &&
  298. savedSearch
  299. ) {
  300. return savedSearch.query;
  301. }
  302. const {query} = location.query;
  303. if (query !== undefined) {
  304. return decodeScalar(query, '');
  305. }
  306. return 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. if (!this.props.organization.features.includes('issue-stream-search-query-builder')) {
  421. const {api, organization, selection} = this.props;
  422. loadOrganizationTags(api, organization.slug, selection);
  423. }
  424. }
  425. fetchStats = (groups: string[]) => {
  426. // If we have no groups to fetch, just skip stats
  427. if (!groups.length) {
  428. return;
  429. }
  430. const requestParams: StatEndpointParams = {
  431. ...this.getEndpointParams(),
  432. groups,
  433. };
  434. // If no stats period values are set, use default
  435. if (!requestParams.statsPeriod && !requestParams.start) {
  436. requestParams.statsPeriod = DEFAULT_STATS_PERIOD;
  437. }
  438. this._lastStatsRequest = this.props.api.request(this.groupStatsEndpoint, {
  439. method: 'GET',
  440. data: qs.stringify(requestParams),
  441. success: data => {
  442. if (!data) {
  443. return;
  444. }
  445. GroupStore.onPopulateStats(groups, data);
  446. this.trackTabViewed(groups, data, this.state.queryCount);
  447. },
  448. error: err => {
  449. this.setState({
  450. error: parseApiError(err),
  451. });
  452. },
  453. complete: () => {
  454. this._lastStatsRequest = null;
  455. // End navigation transaction to prevent additional page requests from impacting page metrics.
  456. // Other transactions include stacktrace preview request
  457. const currentSpan = Sentry.getActiveSpan();
  458. const rootSpan = currentSpan ? Sentry.getRootSpan(currentSpan) : undefined;
  459. if (rootSpan && Sentry.spanToJSON(rootSpan).op === 'navigation') {
  460. rootSpan.end();
  461. }
  462. },
  463. });
  464. };
  465. fetchCounts = (currentQueryCount: number, fetchAllCounts: boolean) => {
  466. const {queryCounts: _queryCounts} = this.state;
  467. let queryCounts: QueryCounts = {..._queryCounts};
  468. const endpointParams = this.getEndpointParams();
  469. const tabQueriesWithCounts = getTabsWithCounts();
  470. const currentTabQuery = tabQueriesWithCounts.includes(endpointParams.query as Query)
  471. ? endpointParams.query
  472. : null;
  473. // Update the count based on the exact number of issues, these shown as is
  474. if (currentTabQuery) {
  475. queryCounts[currentTabQuery] = {
  476. count: currentQueryCount,
  477. hasMore: false,
  478. };
  479. }
  480. this.setState({queryCounts});
  481. // If all tabs' counts are fetched, skip and only set
  482. if (
  483. fetchAllCounts ||
  484. !tabQueriesWithCounts.every(tabQuery => queryCounts[tabQuery] !== undefined)
  485. ) {
  486. const requestParams: CountsEndpointParams = {
  487. ...omit(endpointParams, 'query'),
  488. // fetch the counts for the tabs whose counts haven't been fetched yet
  489. query: tabQueriesWithCounts.filter(_query => _query !== currentTabQuery),
  490. };
  491. // If no stats period values are set, use default
  492. if (!requestParams.statsPeriod && !requestParams.start) {
  493. requestParams.statsPeriod = DEFAULT_STATS_PERIOD;
  494. }
  495. this._lastFetchCountsRequest = this.props.api.request(this.groupCountsEndpoint, {
  496. method: 'GET',
  497. data: qs.stringify(requestParams),
  498. success: data => {
  499. if (!data) {
  500. return;
  501. }
  502. // Counts coming from the counts endpoint is limited to 100, for >= 100 we display 99+
  503. queryCounts = {
  504. ...queryCounts,
  505. ...mapValues(data, (count: number) => ({
  506. count,
  507. hasMore: count > TAB_MAX_COUNT,
  508. })),
  509. };
  510. },
  511. error: () => {
  512. this.setState({queryCounts: {}});
  513. },
  514. complete: () => {
  515. this._lastFetchCountsRequest = null;
  516. this.setState({queryCounts});
  517. },
  518. });
  519. }
  520. };
  521. fetchData = (fetchAllCounts = false) => {
  522. const {organization} = this.props;
  523. const query = this.getQuery();
  524. if (this.state.realtimeActive || (!this.actionTaken && !this.undo)) {
  525. GroupStore.loadInitialData([]);
  526. this.setState({
  527. issuesLoading: true,
  528. queryCount: 0,
  529. error: null,
  530. });
  531. }
  532. const span = getCurrentSentryReactRootSpan();
  533. span?.setAttribute('query.sort', this.getSort());
  534. this.setState({
  535. error: null,
  536. });
  537. // Used for Issue Stream Performance project, enabled means we are doing saved search look up in the backend
  538. const savedSearchLookupEnabled = 0;
  539. const savedSearchLookupDisabled = 1;
  540. const requestParams: any = {
  541. ...this.getEndpointParams(),
  542. limit: MAX_ITEMS,
  543. shortIdLookup: 1,
  544. savedSearch: this.props.organization.features.includes('issue-stream-performance')
  545. ? this.props.savedSearchLoading
  546. ? savedSearchLookupEnabled
  547. : savedSearchLookupDisabled
  548. : savedSearchLookupDisabled,
  549. };
  550. if (
  551. this.props.organization.features.includes('issue-stream-performance') &&
  552. this.props.selectedSearchId
  553. ) {
  554. requestParams.searchId = this.props.selectedSearchId;
  555. }
  556. if (
  557. this.props.organization.features.includes('issue-stream-performance') &&
  558. this.props.savedSearchLoading &&
  559. !defined(this.props.location.query.query)
  560. ) {
  561. delete requestParams.query;
  562. }
  563. const currentQuery = this.props.location.query || {};
  564. if ('cursor' in currentQuery) {
  565. requestParams.cursor = currentQuery.cursor;
  566. }
  567. // If no stats period values are set, use default
  568. if (!requestParams.statsPeriod && !requestParams.start) {
  569. requestParams.statsPeriod = DEFAULT_STATS_PERIOD;
  570. }
  571. requestParams.expand = ['owners', 'inbox'];
  572. requestParams.collapse = ['stats', 'unhandled'];
  573. if (this._lastRequest) {
  574. this._lastRequest.cancel();
  575. }
  576. if (this._lastStatsRequest) {
  577. this._lastStatsRequest.cancel();
  578. }
  579. if (this._lastFetchCountsRequest) {
  580. this._lastFetchCountsRequest.cancel();
  581. }
  582. this._poller.disable();
  583. this._lastRequest = this.props.api.request(this.groupListEndpoint, {
  584. method: 'GET',
  585. data: qs.stringify(requestParams),
  586. success: (data, _, resp) => {
  587. if (!resp) {
  588. return;
  589. }
  590. // If this is a direct hit, we redirect to the intended result directly.
  591. if (resp.getResponseHeader('X-Sentry-Direct-Hit') === '1') {
  592. let redirect: string;
  593. if (data[0]?.matchingEventId) {
  594. const {id, matchingEventId} = data[0];
  595. redirect = `/organizations/${organization.slug}/issues/${id}/events/${matchingEventId}/`;
  596. } else {
  597. const {id} = data[0];
  598. redirect = `/organizations/${organization.slug}/issues/${id}/`;
  599. }
  600. browserHistory.replace(
  601. normalizeUrl({
  602. pathname: redirect,
  603. query: {
  604. referrer: 'issue-list',
  605. ...extractSelectionParameters(this.props.location.query),
  606. },
  607. })
  608. );
  609. return;
  610. }
  611. if (this.undo) {
  612. GroupStore.loadInitialData(data);
  613. }
  614. GroupStore.add(data);
  615. this.fetchStats(data.map((group: BaseGroup) => group.id));
  616. const hits = resp.getResponseHeader('X-Hits');
  617. const queryCount =
  618. typeof hits !== 'undefined' && hits ? parseInt(hits, 10) || 0 : 0;
  619. const maxHits = resp.getResponseHeader('X-Max-Hits');
  620. const queryMaxCount =
  621. typeof maxHits !== 'undefined' && maxHits ? parseInt(maxHits, 10) || 0 : 0;
  622. const pageLinks = resp.getResponseHeader('Link');
  623. this.fetchCounts(queryCount, fetchAllCounts);
  624. this.setState({
  625. error: null,
  626. issuesLoading: false,
  627. queryCount,
  628. queryMaxCount,
  629. pageLinks: pageLinks !== null ? pageLinks : '',
  630. });
  631. if (data.length === 0) {
  632. trackAnalytics('issue_search.empty', {
  633. organization: this.props.organization,
  634. search_type: 'issues',
  635. search_source: 'main_search',
  636. query,
  637. });
  638. }
  639. },
  640. error: err => {
  641. trackAnalytics('issue_search.failed', {
  642. organization: this.props.organization,
  643. search_type: 'issues',
  644. search_source: 'main_search',
  645. error: parseApiError(err),
  646. });
  647. this.setState({
  648. error: parseApiError(err),
  649. issuesLoading: false,
  650. });
  651. },
  652. complete: () => {
  653. this._lastRequest = null;
  654. this.resumePolling();
  655. if (!this.state.realtimeActive) {
  656. this.actionTaken = false;
  657. this.undo = false;
  658. }
  659. },
  660. });
  661. };
  662. resumePolling = () => {
  663. if (!this.state.pageLinks) {
  664. return;
  665. }
  666. // Only resume polling if we're on the first page of results
  667. const links = parseLinkHeader(this.state.pageLinks);
  668. if (links && !links.previous.results && this.state.realtimeActive) {
  669. this._poller.setEndpoint(links?.previous?.href);
  670. this._poller.enable();
  671. }
  672. };
  673. get groupListEndpoint(): string {
  674. const {organization} = this.props;
  675. return `/organizations/${organization.slug}/issues/`;
  676. }
  677. get groupCountsEndpoint(): string {
  678. const {organization} = this.props;
  679. return `/organizations/${organization.slug}/issues-count/`;
  680. }
  681. get groupStatsEndpoint(): string {
  682. const {organization} = this.props;
  683. return `/organizations/${organization.slug}/issues-stats/`;
  684. }
  685. onRealtimeChange = (realtime: boolean) => {
  686. Cookies.set('realtimeActive', realtime.toString());
  687. this.setState({realtimeActive: realtime});
  688. trackAnalytics('issues_stream.realtime_clicked', {
  689. organization: this.props.organization,
  690. enabled: realtime,
  691. });
  692. };
  693. onSelectStatsPeriod = (period: string) => {
  694. const {location} = this.props;
  695. if (period !== this.getGroupStatsPeriod()) {
  696. const cursor = location.query.cursor;
  697. const queryPageInt = parseInt(location.query.page, 10);
  698. const page = isNaN(queryPageInt) || !location.query.cursor ? 0 : queryPageInt;
  699. this.transitionTo({cursor, page, groupStatsPeriod: period});
  700. }
  701. };
  702. onRealtimePoll = (data: any, {queryCount}: {queryCount: number}) => {
  703. // Note: We do not update state with cursors from polling,
  704. // `CursorPoller` updates itself with new cursors
  705. GroupStore.addToFront(data);
  706. this.setState({queryCount});
  707. };
  708. listener = GroupStore.listen(() => this.onGroupChange(), undefined);
  709. onGroupChange() {
  710. const groupIds = GroupStore.getAllItems()
  711. .map(item => item.id)
  712. .slice(0, MAX_ISSUES_COUNT);
  713. if (!isEqual(groupIds, this.state.groupIds)) {
  714. this.setState({groupIds});
  715. }
  716. }
  717. trackTabViewed(groups: string[], data: Group[], numHits: number | null) {
  718. const {organization, location} = this.props;
  719. const page = location.query.page;
  720. const endpointParams = this.getEndpointParams();
  721. const tabQueriesWithCounts = getTabsWithCounts();
  722. const currentTabQuery = tabQueriesWithCounts.includes(endpointParams.query as Query)
  723. ? endpointParams.query
  724. : null;
  725. const tab = getTabs().find(([tabQuery]) => currentTabQuery === tabQuery)?.[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. return !!this.state.queryCounts?.[Query.REPROCESSING]?.count;
  843. }
  844. displayReprocessingLayout(showReprocessingTab: boolean, query: string) {
  845. return showReprocessingTab && query === Query.REPROCESSING;
  846. }
  847. renderLoading(): React.ReactNode {
  848. return (
  849. <Layout.Page withPadding>
  850. <LoadingIndicator />
  851. </Layout.Page>
  852. );
  853. }
  854. onSavedSearchSelect = (savedSearch: SavedSearch) => {
  855. trackAnalytics('organization_saved_search.selected', {
  856. organization: this.props.organization,
  857. search_type: 'issues',
  858. id: savedSearch.id ? parseInt(savedSearch.id, 10) : -1,
  859. is_global: savedSearch.isGlobal,
  860. query: savedSearch.query,
  861. visibility: savedSearch.visibility,
  862. });
  863. this.setState({issuesLoading: true}, () => this.transitionTo(undefined, savedSearch));
  864. };
  865. onDelete = () => {
  866. this.actionTaken = true;
  867. this.fetchData(true);
  868. };
  869. undoAction = ({data, groups}: {data: IssueUpdateData; groups: BaseGroup[]}) => {
  870. const {organization, selection} = this.props;
  871. const query = this.getQuery();
  872. const projectIds = selection?.projects?.map(p => p.toString());
  873. const endpoint = `/organizations/${organization.slug}/issues/`;
  874. if (this._lastRequest) {
  875. this._lastRequest.cancel();
  876. }
  877. if (this._lastStatsRequest) {
  878. this._lastStatsRequest.cancel();
  879. }
  880. if (this._lastFetchCountsRequest) {
  881. this._lastFetchCountsRequest.cancel();
  882. }
  883. this.props.api.request(endpoint, {
  884. method: 'PUT',
  885. data,
  886. query: {
  887. project: projectIds,
  888. id: groups.map(group => group.id),
  889. },
  890. success: response => {
  891. if (!response) {
  892. return;
  893. }
  894. // If on the Ignore or For Review tab, adding back to the GroupStore will make the issue show up
  895. // on this page for a second and then be removed (will show up on All Unresolved). This is to
  896. // stop this from happening and avoid confusion.
  897. if (!query.includes('is:ignored') && !isForReviewQuery(query)) {
  898. GroupStore.add(groups);
  899. }
  900. this.undo = true;
  901. },
  902. error: err => {
  903. this.setState({
  904. error: parseApiError(err),
  905. issuesLoading: false,
  906. });
  907. },
  908. complete: () => {
  909. this.fetchData();
  910. },
  911. });
  912. };
  913. onActionTaken = (itemIds: string[], data: IssueUpdateData) => {
  914. if (this.state.realtimeActive) {
  915. return;
  916. }
  917. const query = this.getQuery();
  918. const groups = itemIds.map(id => GroupStore.get(id)).filter(defined);
  919. if ('status' in data) {
  920. if (data.status === 'resolved') {
  921. this.onIssueAction({
  922. itemIds,
  923. actionType: 'Resolved',
  924. shouldRemove:
  925. query.includes('is:unresolved') ||
  926. query.includes('is:ignored') ||
  927. isForReviewQuery(query),
  928. undo: () =>
  929. this.undoAction({
  930. data: {status: GroupStatus.UNRESOLVED, statusDetails: {}},
  931. groups,
  932. }),
  933. });
  934. return;
  935. }
  936. if (data.status === 'ignored') {
  937. this.onIssueAction({
  938. itemIds,
  939. actionType: 'Archived',
  940. shouldRemove: query.includes('is:unresolved') || isForReviewQuery(query),
  941. undo: () =>
  942. this.undoAction({
  943. data: {status: GroupStatus.UNRESOLVED, statusDetails: {}},
  944. groups,
  945. }),
  946. });
  947. return;
  948. }
  949. }
  950. if ('inbox' in data && data.inbox === false) {
  951. this.onIssueAction({
  952. itemIds,
  953. actionType: 'Reviewed',
  954. shouldRemove: isForReviewQuery(query),
  955. });
  956. return;
  957. }
  958. if ('priority' in data && typeof data.priority === 'string') {
  959. const priorityValues = parseIssuePrioritySearch(query);
  960. const priority = data.priority.toLowerCase() as PriorityLevel;
  961. this.onIssueAction({
  962. itemIds,
  963. actionType: 'Reprioritized',
  964. shouldRemove: !priorityValues.has(priority),
  965. });
  966. return;
  967. }
  968. };
  969. onIssueAction = ({
  970. itemIds,
  971. actionType,
  972. shouldRemove,
  973. undo,
  974. }: {
  975. actionType: 'Reviewed' | 'Resolved' | 'Ignored' | 'Archived' | 'Reprioritized';
  976. itemIds: string[];
  977. shouldRemove: boolean;
  978. undo?: () => void;
  979. }) => {
  980. if (itemIds.length > 1) {
  981. addMessage(`${actionType} ${itemIds.length} ${t('Issues')}`, 'success', {
  982. duration: 4000,
  983. undo,
  984. });
  985. } else {
  986. const shortId = itemIds.map(item => GroupStore.get(item)?.shortId).toString();
  987. addMessage(`${actionType} ${shortId}`, 'success', {
  988. duration: 4000,
  989. undo,
  990. });
  991. }
  992. if (!shouldRemove) {
  993. return;
  994. }
  995. const links = parseLinkHeader(this.state.pageLinks);
  996. GroupStore.remove(itemIds);
  997. const queryCount = this.state.queryCount - itemIds.length;
  998. this.actionTaken = true;
  999. this.setState({queryCount});
  1000. if (GroupStore.getAllItemIds().length === 0) {
  1001. // If we run out of issues on the last page, navigate back a page to
  1002. // avoid showing an empty state - if not on the last page, just show a spinner
  1003. const shouldGoBackAPage = links?.previous?.results && !links?.next?.results;
  1004. this.transitionTo({cursor: shouldGoBackAPage ? links.previous.cursor : undefined});
  1005. this.fetchCounts(queryCount, true);
  1006. } else {
  1007. this.fetchData(true);
  1008. }
  1009. };
  1010. tagValueLoader = (key: string, search: string) => {
  1011. const {organization} = this.props;
  1012. const projectIds = this.getSelectedProjectIds();
  1013. const endpointParams = this.getEndpointParams();
  1014. return fetchTagValues({
  1015. api: this.props.api,
  1016. orgSlug: organization.slug,
  1017. tagKey: key,
  1018. search,
  1019. projectIds,
  1020. endpointParams: endpointParams as any,
  1021. });
  1022. };
  1023. getPageCounts = () => {
  1024. const {location} = this.props;
  1025. const {pageLinks, queryCount, groupIds} = this.state;
  1026. const links = parseLinkHeader(pageLinks);
  1027. const queryPageInt = parseInt(location.query.page, 10);
  1028. // Cursor must be present for the page number to be used
  1029. const page = isNaN(queryPageInt) || !location.query.cursor ? 0 : queryPageInt;
  1030. let numPreviousIssues = Math.min(page * MAX_ITEMS, queryCount);
  1031. // Because the query param `page` is not tied to the request, we need to
  1032. // validate that it's correct at the first and last page
  1033. if (!links?.next?.results || this.allResultsVisible()) {
  1034. // On last available page
  1035. numPreviousIssues = Math.max(queryCount - groupIds.length, 0);
  1036. } else if (!links?.previous?.results) {
  1037. // On first available page
  1038. numPreviousIssues = 0;
  1039. }
  1040. return {
  1041. numPreviousIssues,
  1042. numIssuesOnPage: groupIds.length,
  1043. };
  1044. };
  1045. render() {
  1046. if (
  1047. this.props.savedSearchLoading &&
  1048. !this.props.organization.features.includes('issue-stream-performance')
  1049. ) {
  1050. return this.renderLoading();
  1051. }
  1052. const {
  1053. pageLinks,
  1054. queryCount,
  1055. queryCounts,
  1056. realtimeActive,
  1057. groupIds,
  1058. queryMaxCount,
  1059. issuesLoading,
  1060. error,
  1061. } = this.state;
  1062. const {organization, selection, router} = this.props;
  1063. const query = this.getQuery();
  1064. const modifiedQueryCount = Math.max(queryCount, 0);
  1065. // TODO: these two might still be in use for reprocessing2
  1066. const showReprocessingTab = this.displayReprocessingTab();
  1067. const displayReprocessingActions = this.displayReprocessingLayout(
  1068. showReprocessingTab,
  1069. query
  1070. );
  1071. const {numPreviousIssues, numIssuesOnPage} = this.getPageCounts();
  1072. return (
  1073. <Layout.Page>
  1074. {organization.features.includes('issue-stream-custom-views') ? (
  1075. <CustomViewsIssueListHeader
  1076. organization={organization}
  1077. queryCounts={queryCounts}
  1078. router={router}
  1079. selectedProjectIds={selection.projects}
  1080. />
  1081. ) : (
  1082. <IssueListHeader
  1083. organization={organization}
  1084. query={query}
  1085. sort={this.getSort()}
  1086. queryCount={queryCount}
  1087. queryCounts={queryCounts}
  1088. realtimeActive={realtimeActive}
  1089. onRealtimeChange={this.onRealtimeChange}
  1090. router={router}
  1091. displayReprocessingTab={showReprocessingTab}
  1092. selectedProjectIds={selection.projects}
  1093. />
  1094. )}
  1095. <StyledBody>
  1096. <StyledMain>
  1097. <DataConsentBanner source="issues" />
  1098. <IssueListFilters query={query} onSearch={this.onSearch} />
  1099. <Panel>
  1100. {groupIds.length !== 0 && (
  1101. <IssueListActions
  1102. selection={selection}
  1103. query={query}
  1104. queryCount={modifiedQueryCount}
  1105. onSelectStatsPeriod={this.onSelectStatsPeriod}
  1106. onActionTaken={this.onActionTaken}
  1107. onDelete={this.onDelete}
  1108. statsPeriod={this.getGroupStatsPeriod()}
  1109. groupIds={groupIds}
  1110. allResultsVisible={this.allResultsVisible()}
  1111. displayReprocessingActions={displayReprocessingActions}
  1112. sort={this.getSort()}
  1113. onSortChange={this.onSortChange}
  1114. />
  1115. )}
  1116. <PanelBody>
  1117. <VisuallyCompleteWithData
  1118. hasData={this.state.groupIds.length > 0}
  1119. id="IssueList-Body"
  1120. isLoading={this.state.issuesLoading}
  1121. >
  1122. <GroupListBody
  1123. memberList={this.state.memberList}
  1124. groupStatsPeriod={this.getGroupStatsPeriod()}
  1125. groupIds={groupIds}
  1126. displayReprocessingLayout={displayReprocessingActions}
  1127. query={query}
  1128. selectedProjectIds={selection.projects}
  1129. loading={issuesLoading}
  1130. error={error}
  1131. refetchGroups={this.fetchData}
  1132. onActionTaken={this.onActionTaken}
  1133. />
  1134. </VisuallyCompleteWithData>
  1135. </PanelBody>
  1136. </Panel>
  1137. <StyledPagination
  1138. caption={
  1139. !issuesLoading && modifiedQueryCount > 0
  1140. ? tct('[start]-[end] of [total]', {
  1141. start: numPreviousIssues + 1,
  1142. end: numPreviousIssues + numIssuesOnPage,
  1143. total: (
  1144. <StyledQueryCount
  1145. hideParens
  1146. hideIfEmpty={false}
  1147. count={modifiedQueryCount}
  1148. max={queryMaxCount || 100}
  1149. />
  1150. ),
  1151. })
  1152. : null
  1153. }
  1154. pageLinks={pageLinks}
  1155. onCursor={this.onCursorChange}
  1156. paginationAnalyticsEvent={this.paginationAnalyticsEvent}
  1157. />
  1158. </StyledMain>
  1159. <SavedIssueSearches
  1160. {...{organization, query}}
  1161. onSavedSearchSelect={this.onSavedSearchSelect}
  1162. sort={this.getSort()}
  1163. />
  1164. </StyledBody>
  1165. </Layout.Page>
  1166. );
  1167. }
  1168. }
  1169. export default withRouteAnalytics(
  1170. withApi(
  1171. withPageFilters(
  1172. withSavedSearches(
  1173. withOrganization(withIssueTags(Sentry.withProfiler(IssueListOverview)))
  1174. )
  1175. )
  1176. )
  1177. );
  1178. export {IssueListOverview};
  1179. const StyledBody = styled('div')`
  1180. background-color: ${p => p.theme.background};
  1181. flex: 1;
  1182. display: grid;
  1183. gap: 0;
  1184. padding: 0;
  1185. grid-template-rows: 1fr;
  1186. grid-template-columns: minmax(0, 1fr) auto;
  1187. grid-template-areas: 'content saved-searches';
  1188. `;
  1189. const StyledMain = styled('section')`
  1190. grid-area: content;
  1191. padding: ${space(2)};
  1192. @media (min-width: ${p => p.theme.breakpoints.medium}) {
  1193. padding: ${space(3)} ${space(4)};
  1194. }
  1195. `;
  1196. const StyledPagination = styled(Pagination)`
  1197. margin-top: 0;
  1198. `;
  1199. const StyledQueryCount = styled(QueryCount)`
  1200. margin-left: 0;
  1201. `;