groupDetails.tsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  1. import {cloneElement, Component, Fragment, isValidElement} from 'react';
  2. import {browserHistory, RouteComponentProps} from 'react-router';
  3. import styled from '@emotion/styled';
  4. import * as Sentry from '@sentry/react';
  5. import * as PropTypes from 'prop-types';
  6. import {fetchOrganizationEnvironments} from 'sentry/actionCreators/environments';
  7. import {Client} from 'sentry/api';
  8. import {shouldDisplaySetupSourceMapsAlert} from 'sentry/components/events/interfaces/crashContent/exception/setupSourceMapsAlert';
  9. import LoadingError from 'sentry/components/loadingError';
  10. import LoadingIndicator from 'sentry/components/loadingIndicator';
  11. import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
  12. import MissingProjectMembership from 'sentry/components/projects/missingProjectMembership';
  13. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  14. import {Item, TabPanels, Tabs} from 'sentry/components/tabs';
  15. import {t} from 'sentry/locale';
  16. import SentryTypes from 'sentry/sentryTypes';
  17. import GroupStore from 'sentry/stores/groupStore';
  18. import space from 'sentry/styles/space';
  19. import {
  20. AvatarProject,
  21. Group,
  22. GroupActivityAssigned,
  23. GroupActivityType,
  24. IssueCategory,
  25. Organization,
  26. Project,
  27. } from 'sentry/types';
  28. import {Event} from 'sentry/types/event';
  29. import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
  30. import {getUtcDateString} from 'sentry/utils/dates';
  31. import {getAnalyicsDataForEvent, getMessage, getTitle} from 'sentry/utils/events';
  32. import getDaysSinceDate from 'sentry/utils/getDaysSinceDate';
  33. import Projects from 'sentry/utils/projects';
  34. import recreateRoute from 'sentry/utils/recreateRoute';
  35. import withRouteAnalytics, {
  36. WithRouteAnalyticsProps,
  37. } from 'sentry/utils/routeAnalytics/withRouteAnalytics';
  38. import withApi from 'sentry/utils/withApi';
  39. import {normalizeUrl} from 'sentry/utils/withDomainRequired';
  40. import {ERROR_TYPES} from './constants';
  41. import GroupHeader from './header';
  42. import SampleEventAlert from './sampleEventAlert';
  43. import {Tab, TabPaths} from './types';
  44. import {
  45. fetchGroupEvent,
  46. getGroupReprocessingStatus,
  47. markEventSeen,
  48. ReprocessingStatus,
  49. } from './utils';
  50. /**
  51. * Return the integration type for the first assignment via integration
  52. */
  53. function getAssignmentIntegration(group: Group) {
  54. if (!group.activity) {
  55. return '';
  56. }
  57. const assignmentAcitivies = group.activity.filter(
  58. activity => activity.type === GroupActivityType.ASSIGNED
  59. ) as GroupActivityAssigned[];
  60. const integrationAssignments = assignmentAcitivies.find(
  61. activity => !!activity.data.integration
  62. );
  63. return integrationAssignments?.data.integration || '';
  64. }
  65. type Error = typeof ERROR_TYPES[keyof typeof ERROR_TYPES] | null;
  66. type Props = {
  67. api: Client;
  68. children: React.ReactNode;
  69. environments: string[];
  70. isGlobalSelectionReady: boolean;
  71. organization: Organization;
  72. projects: Project[];
  73. } & WithRouteAnalyticsProps &
  74. RouteComponentProps<{groupId: string; eventId?: string}, {}>;
  75. type State = {
  76. error: boolean;
  77. errorType: Error;
  78. eventError: boolean;
  79. group: Group | null;
  80. loading: boolean;
  81. loadingEvent: boolean;
  82. loadingGroup: boolean;
  83. project: null | (Pick<Project, 'id' | 'slug'> & Partial<Pick<Project, 'platform'>>);
  84. event?: Event;
  85. };
  86. class GroupDetails extends Component<Props, State> {
  87. static childContextTypes = {
  88. group: SentryTypes.Group,
  89. location: PropTypes.object,
  90. };
  91. state = this.initialState;
  92. getChildContext() {
  93. return {
  94. group: this.state.group,
  95. location: this.props.location,
  96. };
  97. }
  98. componentDidMount() {
  99. // only track the view if we are loading the event early
  100. this.fetchData(this.canLoadEventEarly(this.props));
  101. this.updateReprocessingProgress();
  102. // Fetch environments early - used in GroupEventDetailsContainer
  103. fetchOrganizationEnvironments(this.props.api, this.props.organization.slug);
  104. }
  105. componentDidUpdate(prevProps: Props, prevState: State) {
  106. const globalSelectionReadyChanged =
  107. prevProps.isGlobalSelectionReady !== this.props.isGlobalSelectionReady;
  108. if (
  109. globalSelectionReadyChanged ||
  110. prevProps.location.pathname !== this.props.location.pathname
  111. ) {
  112. // Skip tracking for other navigation events like switching events
  113. this.fetchData(globalSelectionReadyChanged && this.canLoadEventEarly(this.props));
  114. }
  115. if (
  116. (!this.canLoadEventEarly(prevProps) && !prevState?.group && this.state.group) ||
  117. (prevProps.params?.eventId !== this.props.params?.eventId && this.state.group)
  118. ) {
  119. // if we are loading events we should record analytics after it's loaded
  120. this.getEvent(this.state.group).then(() => {
  121. if (!this.state.group?.project) {
  122. return;
  123. }
  124. const project = this.props.projects.find(
  125. p => p.id === this.state.group?.project.id
  126. );
  127. project && this.trackView(project);
  128. });
  129. }
  130. }
  131. componentWillUnmount() {
  132. GroupStore.reset();
  133. this.listener?.();
  134. if (this.refetchInterval) {
  135. window.clearInterval(this.refetchInterval);
  136. }
  137. }
  138. refetchInterval: number | null = null;
  139. get initialState(): State {
  140. return {
  141. group: null,
  142. loading: true,
  143. loadingEvent: true,
  144. loadingGroup: true,
  145. error: false,
  146. eventError: false,
  147. errorType: null,
  148. project: null,
  149. };
  150. }
  151. trackView(project: Project) {
  152. const {group, event} = this.state;
  153. const {params, location, organization, router} = this.props;
  154. const {alert_date, alert_rule_id, alert_type} = location.query;
  155. this.props.setEventNames('issue_details.viewed', 'Issue Details: Viewed');
  156. this.props.setRouteAnalyticsParams({
  157. project_id: parseInt(project.id, 10),
  158. group_id: parseInt(params.groupId, 10),
  159. // group properties
  160. issue_category: group?.issueCategory ?? IssueCategory.ERROR,
  161. issue_status: group?.status,
  162. issue_age: group?.firstSeen ? getDaysSinceDate(group.firstSeen) : -1,
  163. issue_level: group?.level,
  164. is_assigned: !!group?.assignedTo,
  165. error_count: Number(group?.count || -1),
  166. error_has_replay: Boolean(event?.tags?.find(({key}) => key === 'replayId')),
  167. group_has_replay: Boolean(group?.tags?.find(({key}) => key === 'replayId')),
  168. num_comments: group ? group.numComments : -1,
  169. project_has_replay: project.hasReplays,
  170. project_has_minified_stack_trace: project.hasMinifiedStackTrace,
  171. project_platform: group?.project.platform,
  172. has_external_issue: group?.annotations ? group?.annotations.length > 0 : false,
  173. has_owner: group?.owners ? group?.owners.length > 0 : false,
  174. integration_assignment_source: group ? getAssignmentIntegration(group) : '',
  175. // event properties
  176. ...getAnalyicsDataForEvent(event),
  177. // Alert properties track if the user came from email/slack alerts
  178. alert_date:
  179. typeof alert_date === 'string' ? getUtcDateString(Number(alert_date)) : undefined,
  180. alert_rule_id: typeof alert_rule_id === 'string' ? alert_rule_id : undefined,
  181. alert_type: typeof alert_type === 'string' ? alert_type : undefined,
  182. has_otel: event?.contexts?.otel !== undefined,
  183. has_setup_source_maps_alert: shouldDisplaySetupSourceMapsAlert(
  184. organization,
  185. router.location.query.project,
  186. event
  187. ),
  188. });
  189. }
  190. remountComponent = () => {
  191. this.setState(this.initialState);
  192. this.fetchData();
  193. };
  194. canLoadEventEarly(props: Props) {
  195. return !props.params.eventId || ['oldest', 'latest'].includes(props.params.eventId);
  196. }
  197. get groupDetailsEndpoint() {
  198. return `/issues/${this.props.params.groupId}/`;
  199. }
  200. get groupReleaseEndpoint() {
  201. return `/issues/${this.props.params.groupId}/first-last-release/`;
  202. }
  203. async getEvent(group?: Group) {
  204. if (group) {
  205. this.setState({loadingEvent: true, eventError: false});
  206. }
  207. const {params, environments, api, organization} = this.props;
  208. const orgSlug = organization.slug;
  209. const groupId = params.groupId;
  210. const eventId = params.eventId ?? 'latest';
  211. const projectId = group?.project?.slug;
  212. try {
  213. const event = await fetchGroupEvent(
  214. api,
  215. orgSlug,
  216. groupId,
  217. eventId,
  218. environments,
  219. projectId
  220. );
  221. this.setState({event, loading: false, eventError: false, loadingEvent: false});
  222. } catch (err) {
  223. // This is an expected error, capture to Sentry so that it is not considered as an unhandled error
  224. Sentry.captureException(err);
  225. this.setState({eventError: true, loading: false, loadingEvent: false});
  226. }
  227. }
  228. getCurrentTab() {
  229. const {router, routes} = this.props;
  230. const currentRoute = routes[routes.length - 1];
  231. // If we're in the tag details page ("/tags/:tagKey/")
  232. if (router.params.tagKey) {
  233. return Tab.TAGS;
  234. }
  235. return (
  236. Object.values(Tab).find(tab => currentRoute.path === TabPaths[tab]) ?? Tab.DETAILS
  237. );
  238. }
  239. getCurrentRouteInfo(group: Group): {baseUrl: string; currentTab: Tab} {
  240. const {organization, params} = this.props;
  241. const {event} = this.state;
  242. const currentTab = this.getCurrentTab();
  243. const baseUrl = normalizeUrl(
  244. `/organizations/${organization.slug}/issues/${group.id}/${
  245. params.eventId && event ? `events/${event.id}/` : ''
  246. }`
  247. );
  248. return {baseUrl, currentTab};
  249. }
  250. updateReprocessingProgress() {
  251. const hasReprocessingV2Feature = this.hasReprocessingV2Feature();
  252. if (!hasReprocessingV2Feature) {
  253. return;
  254. }
  255. if (this.refetchInterval) {
  256. window.clearInterval(this.refetchInterval);
  257. }
  258. this.refetchInterval = window.setInterval(this.refetchGroup, 30000);
  259. }
  260. hasReprocessingV2Feature() {
  261. const {organization} = this.props;
  262. return organization.features?.includes('reprocessing-v2');
  263. }
  264. getReprocessingNewRoute(data: Group) {
  265. const {routes, location, params} = this.props;
  266. const {groupId} = params;
  267. const {id: nextGroupId} = data;
  268. const hasReprocessingV2Feature = this.hasReprocessingV2Feature();
  269. const reprocessingStatus = getGroupReprocessingStatus(data);
  270. const {currentTab, baseUrl} = this.getCurrentRouteInfo(data);
  271. if (groupId !== nextGroupId) {
  272. if (hasReprocessingV2Feature) {
  273. // Redirects to the Activities tab
  274. if (
  275. reprocessingStatus === ReprocessingStatus.REPROCESSED_AND_HASNT_EVENT &&
  276. currentTab !== Tab.ACTIVITY
  277. ) {
  278. return {
  279. pathname: `${baseUrl}${Tab.ACTIVITY}/`,
  280. query: {...params, groupId: nextGroupId},
  281. };
  282. }
  283. }
  284. return recreateRoute('', {
  285. routes,
  286. location,
  287. params: {...params, groupId: nextGroupId},
  288. });
  289. }
  290. if (hasReprocessingV2Feature) {
  291. if (
  292. reprocessingStatus === ReprocessingStatus.REPROCESSING &&
  293. currentTab !== Tab.DETAILS
  294. ) {
  295. return {
  296. pathname: baseUrl,
  297. query: params,
  298. };
  299. }
  300. if (
  301. reprocessingStatus === ReprocessingStatus.REPROCESSED_AND_HASNT_EVENT &&
  302. currentTab !== Tab.ACTIVITY &&
  303. currentTab !== Tab.USER_FEEDBACK
  304. ) {
  305. return {
  306. pathname: `${baseUrl}${Tab.ACTIVITY}/`,
  307. query: params,
  308. };
  309. }
  310. }
  311. return undefined;
  312. }
  313. getGroupQuery(): Record<string, string | string[]> {
  314. const {environments} = this.props;
  315. // Note, we do not want to include the environment key at all if there are no environments
  316. const query: Record<string, string | string[]> = {
  317. ...(environments ? {environment: environments} : {}),
  318. expand: ['inbox', 'owners'],
  319. collapse: 'release',
  320. };
  321. return query;
  322. }
  323. getFetchDataRequestErrorType(status: any): Error {
  324. if (!status) {
  325. return null;
  326. }
  327. if (status === 404) {
  328. return ERROR_TYPES.GROUP_NOT_FOUND;
  329. }
  330. if (status === 403) {
  331. return ERROR_TYPES.MISSING_MEMBERSHIP;
  332. }
  333. return null;
  334. }
  335. handleRequestError(error: any) {
  336. Sentry.captureException(error);
  337. const errorType = this.getFetchDataRequestErrorType(error?.status);
  338. this.setState({
  339. loadingGroup: false,
  340. loading: false,
  341. error: true,
  342. errorType,
  343. });
  344. }
  345. refetchGroup = async () => {
  346. const {loadingGroup, loading, loadingEvent, group} = this.state;
  347. if (
  348. group?.status !== ReprocessingStatus.REPROCESSING ||
  349. loadingGroup ||
  350. loading ||
  351. loadingEvent
  352. ) {
  353. return;
  354. }
  355. const {api} = this.props;
  356. this.setState({loadingGroup: true});
  357. try {
  358. const updatedGroup = await api.requestPromise(this.groupDetailsEndpoint, {
  359. query: this.getGroupQuery(),
  360. });
  361. const reprocessingNewRoute = this.getReprocessingNewRoute(updatedGroup);
  362. if (reprocessingNewRoute) {
  363. browserHistory.push(reprocessingNewRoute);
  364. return;
  365. }
  366. this.setState({group: updatedGroup, loadingGroup: false});
  367. } catch (error) {
  368. this.handleRequestError(error);
  369. }
  370. };
  371. async fetchGroupReleases() {
  372. const {api} = this.props;
  373. const releases = await api.requestPromise(this.groupReleaseEndpoint);
  374. GroupStore.onPopulateReleases(this.props.params.groupId, releases);
  375. }
  376. async fetchData(trackView = false) {
  377. const {api, isGlobalSelectionReady, organization, params} = this.props;
  378. // Need to wait for global selection store to be ready before making request
  379. if (!isGlobalSelectionReady) {
  380. return;
  381. }
  382. try {
  383. const eventPromise = this.canLoadEventEarly(this.props)
  384. ? this.getEvent()
  385. : undefined;
  386. const groupPromise = await api.requestPromise(this.groupDetailsEndpoint, {
  387. query: this.getGroupQuery(),
  388. });
  389. const [data] = await Promise.all([groupPromise, eventPromise]);
  390. const groupReleasePromise = this.fetchGroupReleases();
  391. const reprocessingNewRoute = this.getReprocessingNewRoute(data);
  392. if (reprocessingNewRoute) {
  393. browserHistory.push(reprocessingNewRoute);
  394. return;
  395. }
  396. const project = this.props.projects.find(p => p.id === data.project.id);
  397. if (!project) {
  398. Sentry.withScope(() => {
  399. Sentry.captureException(new Error('Project not found'));
  400. });
  401. } else {
  402. markEventSeen(api, organization.slug, project.slug, params.groupId);
  403. const locationWithProject = {...this.props.location};
  404. if (
  405. locationWithProject.query.project === undefined &&
  406. locationWithProject.query._allp === undefined
  407. ) {
  408. // We use _allp as a temporary measure to know they came from the
  409. // issue list page with no project selected (all projects included in
  410. // filter).
  411. //
  412. // If it is not defined, we add the locked project id to the URL
  413. // (this is because if someone navigates directly to an issue on
  414. // single-project priveleges, then goes back - they were getting
  415. // assigned to the first project).
  416. //
  417. // If it is defined, we do not so that our back button will bring us
  418. // to the issue list page with no project selected instead of the
  419. // locked project.
  420. locationWithProject.query = {...locationWithProject.query, project: project.id};
  421. }
  422. // We delete _allp from the URL to keep the hack a bit cleaner, but
  423. // this is not an ideal solution and will ultimately be replaced with
  424. // something smarter.
  425. delete locationWithProject.query._allp;
  426. browserHistory.replace(locationWithProject);
  427. }
  428. this.setState({project: project || data.project, loadingGroup: false});
  429. GroupStore.loadInitialData([data]);
  430. if (trackView) {
  431. // make sure releases have loaded before we track the view
  432. groupReleasePromise.then(() => project && this.trackView(project));
  433. }
  434. } catch (error) {
  435. this.handleRequestError(error);
  436. }
  437. }
  438. listener = GroupStore.listen(itemIds => this.onGroupChange(itemIds), undefined);
  439. onGroupChange(itemIds: Set<string>) {
  440. const id = this.props.params.groupId;
  441. if (itemIds.has(id)) {
  442. const group = GroupStore.get(id) as Group;
  443. if (group) {
  444. // TODO(ts) This needs a better approach. issueActions is splicing attributes onto
  445. // group objects to cheat here.
  446. if ((group as Group & {stale?: boolean}).stale) {
  447. this.fetchData();
  448. return;
  449. }
  450. this.setState({
  451. group,
  452. });
  453. }
  454. }
  455. }
  456. getTitle() {
  457. const {organization} = this.props;
  458. const {group} = this.state;
  459. const defaultTitle = 'Sentry';
  460. if (!group) {
  461. return defaultTitle;
  462. }
  463. const {title} = getTitle(group, organization?.features);
  464. const message = getMessage(group);
  465. const {project} = group;
  466. const eventDetails = `${organization.slug} - ${project.slug}`;
  467. if (title && message) {
  468. return `${title}: ${message} - ${eventDetails}`;
  469. }
  470. return `${title || message || defaultTitle} - ${eventDetails}`;
  471. }
  472. tabClickAnalyticsEvent(tab: Tab) {
  473. const {organization} = this.props;
  474. const {project, group, event} = this.state;
  475. if (!project || !group) {
  476. return;
  477. }
  478. trackAdvancedAnalyticsEvent('issue_details.tab_changed', {
  479. organization,
  480. group_id: parseInt(group.id, 10),
  481. issue_category: group.issueCategory,
  482. project_id: parseInt(project.id, 10),
  483. tab,
  484. });
  485. if (group.issueCategory !== IssueCategory.ERROR) {
  486. return;
  487. }
  488. const analyticsData = event
  489. ? event.tags
  490. .filter(({key}) => ['device', 'os', 'browser'].includes(key))
  491. .reduce((acc, {key, value}) => {
  492. acc[key] = value;
  493. return acc;
  494. }, {})
  495. : {};
  496. trackAdvancedAnalyticsEvent('issue_group_details.tab.clicked', {
  497. organization,
  498. tab,
  499. platform: project.platform,
  500. ...analyticsData,
  501. });
  502. }
  503. renderError() {
  504. const {projects, location} = this.props;
  505. const projectId = location.query.project;
  506. const project = projects.find(proj => proj.id === projectId);
  507. switch (this.state.errorType) {
  508. case ERROR_TYPES.GROUP_NOT_FOUND:
  509. return (
  510. <StyledLoadingError
  511. message={t('The issue you were looking for was not found.')}
  512. />
  513. );
  514. case ERROR_TYPES.MISSING_MEMBERSHIP:
  515. return (
  516. <MissingProjectMembership
  517. organization={this.props.organization}
  518. project={project}
  519. />
  520. );
  521. default:
  522. return <StyledLoadingError onRetry={this.remountComponent} />;
  523. }
  524. }
  525. renderContent(project: AvatarProject, group: Group) {
  526. const {children, environments, organization, router} = this.props;
  527. const {loadingEvent, eventError, event} = this.state;
  528. const {currentTab, baseUrl} = this.getCurrentRouteInfo(group);
  529. const groupReprocessingStatus = getGroupReprocessingStatus(group);
  530. let childProps: Record<string, any> = {
  531. environments,
  532. group,
  533. project,
  534. };
  535. if (currentTab === Tab.DETAILS) {
  536. if (group.id !== event?.groupID && !eventError) {
  537. // if user pastes only the event id into the url, but it's from another group, redirect to correct group/event
  538. const redirectUrl = `/organizations/${organization.slug}/issues/${event?.groupID}/events/${event?.id}/`;
  539. router.push(normalizeUrl(redirectUrl));
  540. } else {
  541. childProps = {
  542. ...childProps,
  543. event,
  544. loadingEvent,
  545. eventError,
  546. groupReprocessingStatus,
  547. onRetry: () => this.remountComponent(),
  548. };
  549. }
  550. }
  551. if (currentTab === Tab.TAGS) {
  552. childProps = {...childProps, event, baseUrl};
  553. }
  554. return (
  555. <Tabs value={currentTab} onChange={tab => this.tabClickAnalyticsEvent(tab)}>
  556. <GroupHeader
  557. organization={organization}
  558. groupReprocessingStatus={groupReprocessingStatus}
  559. event={event}
  560. group={group}
  561. baseUrl={baseUrl}
  562. project={project as Project}
  563. />
  564. <GroupTabPanels>
  565. <Item key={currentTab}>
  566. {isValidElement(children) ? cloneElement(children, childProps) : children}
  567. </Item>
  568. </GroupTabPanels>
  569. </Tabs>
  570. );
  571. }
  572. renderPageContent() {
  573. const {error: isError, group, project, loading} = this.state;
  574. const isLoading = loading || (!group && !isError);
  575. if (isLoading) {
  576. return <LoadingIndicator />;
  577. }
  578. if (isError) {
  579. return this.renderError();
  580. }
  581. const {organization} = this.props;
  582. return (
  583. <Projects
  584. orgId={organization.slug}
  585. slugs={[project?.slug ?? '']}
  586. data-test-id="group-projects-container"
  587. >
  588. {({projects, initiallyLoaded, fetchError}) =>
  589. initiallyLoaded ? (
  590. fetchError ? (
  591. <StyledLoadingError message={t('Error loading the specified project')} />
  592. ) : (
  593. // TODO(ts): Update renderContent function to deal with empty group
  594. this.renderContent(projects[0], group!)
  595. )
  596. ) : (
  597. <LoadingIndicator />
  598. )
  599. }
  600. </Projects>
  601. );
  602. }
  603. render() {
  604. const {project, group} = this.state;
  605. const {organization} = this.props;
  606. const isSampleError = group?.tags?.some(tag => tag.key === 'sample_event');
  607. return (
  608. <Fragment>
  609. {isSampleError && project && (
  610. <SampleEventAlert project={project} organization={organization} />
  611. )}
  612. <SentryDocumentTitle noSuffix title={this.getTitle()}>
  613. <PageFiltersContainer
  614. skipLoadLastUsed
  615. forceProject={project}
  616. shouldForceProject
  617. >
  618. {this.renderPageContent()}
  619. </PageFiltersContainer>
  620. </SentryDocumentTitle>
  621. </Fragment>
  622. );
  623. }
  624. }
  625. export default withRouteAnalytics(withApi(Sentry.withProfiler(GroupDetails)));
  626. const StyledLoadingError = styled(LoadingError)`
  627. margin: ${space(2)};
  628. `;
  629. const GroupTabPanels = styled(TabPanels)`
  630. flex-grow: 1;
  631. display: flex;
  632. flex-direction: column;
  633. justify-content: stretch;
  634. `;