groupEventDetailsContent.tsx 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. import {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import {CommitRow} from 'sentry/components/commitRow';
  4. import {EventContexts} from 'sentry/components/events/contexts';
  5. import {EventDevice} from 'sentry/components/events/device';
  6. import {EventAttachments} from 'sentry/components/events/eventAttachments';
  7. import {EventCause} from 'sentry/components/events/eventCause';
  8. import {EventDataSection} from 'sentry/components/events/eventDataSection';
  9. import {EventEntry} from 'sentry/components/events/eventEntry';
  10. import {EventErrors} from 'sentry/components/events/eventErrors';
  11. import {EventEvidence} from 'sentry/components/events/eventEvidence';
  12. import {EventExtraData} from 'sentry/components/events/eventExtraData';
  13. import {EventSdk} from 'sentry/components/events/eventSdk';
  14. import {EventTagsAndScreenshot} from 'sentry/components/events/eventTagsAndScreenshot';
  15. import {EventViewHierarchy} from 'sentry/components/events/eventViewHierarchy';
  16. import {EventGroupingInfo} from 'sentry/components/events/groupingInfo';
  17. import {AnrRootCause} from 'sentry/components/events/interfaces/performance/anrRootCause';
  18. import {SpanEvidenceSection} from 'sentry/components/events/interfaces/performance/spanEvidence';
  19. import {EventPackageData} from 'sentry/components/events/packageData';
  20. import {EventRRWebIntegration} from 'sentry/components/events/rrwebIntegration';
  21. import {EventUserFeedback} from 'sentry/components/events/userFeedback';
  22. import {t} from 'sentry/locale';
  23. import {space} from 'sentry/styles/space';
  24. import {Event, Group, IssueCategory, Project} from 'sentry/types';
  25. import {EntryType, EventTransaction} from 'sentry/types/event';
  26. import {useLocation} from 'sentry/utils/useLocation';
  27. import useOrganization from 'sentry/utils/useOrganization';
  28. import {ResourcesAndMaybeSolutions} from 'sentry/views/issueDetails/resourcesAndMaybeSolutions';
  29. type GroupEventDetailsContentProps = {
  30. group: Group;
  31. project: Project;
  32. event?: Event;
  33. };
  34. type GroupEventEntryProps = {
  35. entryType: EntryType;
  36. event: Event;
  37. group: Group;
  38. project: Project;
  39. };
  40. function GroupEventEntry({event, entryType, group, project}: GroupEventEntryProps) {
  41. const organization = useOrganization();
  42. const matchingEntry = event.entries.find(entry => entry.type === entryType);
  43. if (!matchingEntry) {
  44. return null;
  45. }
  46. return (
  47. <EventEntry
  48. projectSlug={project.slug}
  49. group={group}
  50. entry={matchingEntry}
  51. {...{organization, event}}
  52. />
  53. );
  54. }
  55. function GroupEventDetailsContent({
  56. group,
  57. event,
  58. project,
  59. }: GroupEventDetailsContentProps) {
  60. const organization = useOrganization();
  61. const location = useLocation();
  62. const hasReplay = Boolean(event?.tags?.find(({key}) => key === 'replayId')?.value);
  63. const mechanism = event?.tags?.find(({key}) => key === 'mechanism')?.value;
  64. const isANR = mechanism === 'ANR' || mechanism === 'AppExitInfo';
  65. const hasAnrImprovementsFeature = organization.features.includes('anr-improvements');
  66. if (!event) {
  67. return (
  68. <NotFoundMessage>
  69. <h3>{t('Latest event not available')}</h3>
  70. </NotFoundMessage>
  71. );
  72. }
  73. const eventEntryProps = {group, event, project};
  74. return (
  75. <Fragment>
  76. <EventErrors event={event} project={project} isShare={false} />
  77. <EventCause
  78. project={project}
  79. eventId={event.id}
  80. group={group}
  81. commitRow={CommitRow}
  82. />
  83. {event.userReport && (
  84. <EventDataSection title="User Feedback" type="user-feedback">
  85. <EventUserFeedback
  86. report={event.userReport}
  87. orgId={organization.slug}
  88. issueId={group.id}
  89. />
  90. </EventDataSection>
  91. )}
  92. <EventTagsAndScreenshot
  93. event={event}
  94. organization={organization}
  95. projectSlug={project.slug}
  96. location={location}
  97. />
  98. <EventEvidence event={event} group={group} projectSlug={project.slug} />
  99. <GroupEventEntry entryType={EntryType.MESSAGE} {...eventEntryProps} />
  100. <GroupEventEntry entryType={EntryType.EXCEPTION} {...eventEntryProps} />
  101. <GroupEventEntry entryType={EntryType.STACKTRACE} {...eventEntryProps} />
  102. <GroupEventEntry entryType={EntryType.THREADS} {...eventEntryProps} />
  103. {hasAnrImprovementsFeature && isANR && (
  104. <AnrRootCause event={event} organization={organization} />
  105. )}
  106. {group.issueCategory === IssueCategory.PERFORMANCE && (
  107. <SpanEvidenceSection
  108. event={event as EventTransaction}
  109. organization={organization}
  110. projectSlug={project.slug}
  111. />
  112. )}
  113. <GroupEventEntry entryType={EntryType.HPKP} {...eventEntryProps} />
  114. <GroupEventEntry entryType={EntryType.CSP} {...eventEntryProps} />
  115. <GroupEventEntry entryType={EntryType.EXPECTCT} {...eventEntryProps} />
  116. <GroupEventEntry entryType={EntryType.EXPECTSTAPLE} {...eventEntryProps} />
  117. <GroupEventEntry entryType={EntryType.TEMPLATE} {...eventEntryProps} />
  118. <GroupEventEntry entryType={EntryType.BREADCRUMBS} {...eventEntryProps} />
  119. <ResourcesAndMaybeSolutions
  120. event={event}
  121. projectSlug={project.slug}
  122. group={group}
  123. />
  124. <GroupEventEntry entryType={EntryType.DEBUGMETA} {...eventEntryProps} />
  125. <GroupEventEntry entryType={EntryType.REQUEST} {...eventEntryProps} />
  126. <EventContexts group={group} event={event} />
  127. <EventExtraData event={event} />
  128. <EventPackageData event={event} />
  129. <EventDevice event={event} />
  130. <EventViewHierarchy event={event} project={project} />
  131. <EventAttachments event={event} projectSlug={project.slug} />
  132. <EventSdk sdk={event.sdk} meta={event._meta?.sdk} />
  133. {event.groupID && (
  134. <EventGroupingInfo
  135. projectSlug={project.slug}
  136. event={event}
  137. showGroupingConfig={
  138. organization.features.includes('set-grouping-config') &&
  139. 'groupingConfig' in event
  140. }
  141. group={group}
  142. />
  143. )}
  144. {!hasReplay && (
  145. <EventRRWebIntegration
  146. event={event}
  147. orgId={organization.slug}
  148. projectSlug={project.slug}
  149. />
  150. )}
  151. </Fragment>
  152. );
  153. }
  154. const NotFoundMessage = styled('div')`
  155. padding: ${space(2)} ${space(4)};
  156. `;
  157. export default GroupEventDetailsContent;