overview.tsx 42 KB

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