overview.tsx 42 KB

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