eventEntries.tsx 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. import {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import {Location} from 'history';
  4. import {CommitRow} from 'sentry/components/commitRow';
  5. import {EventEvidence} from 'sentry/components/events/eventEvidence';
  6. import {t} from 'sentry/locale';
  7. import {space} from 'sentry/styles/space';
  8. import {
  9. Entry,
  10. Event,
  11. Group,
  12. Organization,
  13. Project,
  14. SharedViewOrganization,
  15. } from 'sentry/types';
  16. import {isNotSharedOrganization} from 'sentry/types/utils';
  17. import {objectIsEmpty} from 'sentry/utils';
  18. import {EventContexts} from './contexts';
  19. import {EventDevice} from './device';
  20. import {EventAttachments} from './eventAttachments';
  21. import {EventCause} from './eventCause';
  22. import {EventDataSection} from './eventDataSection';
  23. import {EventEntry} from './eventEntry';
  24. import {EventErrors} from './eventErrors';
  25. import {EventExtraData} from './eventExtraData';
  26. import {EventSdk} from './eventSdk';
  27. import {EventTagsAndScreenshot} from './eventTagsAndScreenshot';
  28. import {EventViewHierarchy} from './eventViewHierarchy';
  29. import {EventGroupingInfo} from './groupingInfo';
  30. import {EventPackageData} from './packageData';
  31. import {EventRRWebIntegration} from './rrwebIntegration';
  32. import {DataSection} from './styles';
  33. import {EventUserFeedback} from './userFeedback';
  34. type Props = {
  35. location: Location;
  36. /**
  37. * The organization can be the shared view on a public issue view.
  38. */
  39. organization: Organization | SharedViewOrganization;
  40. project: Project;
  41. className?: string;
  42. event?: Event;
  43. group?: Group;
  44. isShare?: boolean;
  45. showTagSummary?: boolean;
  46. };
  47. function EventEntries({
  48. organization,
  49. project,
  50. location,
  51. event,
  52. group,
  53. className,
  54. isShare = false,
  55. showTagSummary = true,
  56. }: Props) {
  57. const orgSlug = organization.slug;
  58. const projectSlug = project.slug;
  59. const orgFeatures = organization?.features ?? [];
  60. if (!event) {
  61. return (
  62. <LatestEventNotAvailable>
  63. <h3>{t('Latest Event Not Available')}</h3>
  64. </LatestEventNotAvailable>
  65. );
  66. }
  67. const hasContext = !objectIsEmpty(event.user ?? {}) || !objectIsEmpty(event.contexts);
  68. return (
  69. <div className={className}>
  70. <EventErrors event={event} project={project} isShare={isShare} />
  71. {!isShare && isNotSharedOrganization(organization) && (
  72. <EventCause
  73. project={project}
  74. eventId={event.id}
  75. group={group}
  76. commitRow={CommitRow}
  77. />
  78. )}
  79. {event.userReport && group && (
  80. <EventDataSection title="User Feedback" type="user-feedback">
  81. <EventUserFeedback
  82. report={event.userReport}
  83. orgId={orgSlug}
  84. issueId={group.id}
  85. />
  86. </EventDataSection>
  87. )}
  88. {showTagSummary && (
  89. <EventTagsAndScreenshot
  90. event={event}
  91. organization={organization as Organization}
  92. projectSlug={projectSlug}
  93. location={location}
  94. isShare={isShare}
  95. />
  96. )}
  97. <EventEvidence event={event} projectSlug={project.slug} />
  98. <Entries
  99. definedEvent={event}
  100. projectSlug={projectSlug}
  101. group={group}
  102. organization={organization}
  103. isShare={isShare}
  104. />
  105. {hasContext && <EventContexts group={group} event={event} />}
  106. <EventExtraData event={event} />
  107. <EventPackageData event={event} />
  108. <EventDevice event={event} />
  109. {!isShare && <EventViewHierarchy event={event} project={project} />}
  110. {!isShare && <EventAttachments event={event} projectSlug={projectSlug} />}
  111. <EventSdk sdk={event.sdk} meta={event._meta?.sdk} />
  112. {!isShare && event.groupID && (
  113. <EventGroupingInfo
  114. projectSlug={projectSlug}
  115. event={event}
  116. showGroupingConfig={
  117. orgFeatures.includes('set-grouping-config') && 'groupingConfig' in event
  118. }
  119. group={group}
  120. />
  121. )}
  122. {!isShare && (
  123. <EventRRWebIntegration event={event} orgId={orgSlug} projectSlug={projectSlug} />
  124. )}
  125. </div>
  126. );
  127. }
  128. function Entries({
  129. definedEvent,
  130. projectSlug,
  131. isShare,
  132. group,
  133. organization,
  134. }: {
  135. definedEvent: Event;
  136. projectSlug: string;
  137. isShare?: boolean;
  138. } & Pick<Props, 'group' | 'organization'>) {
  139. if (!Array.isArray(definedEvent.entries)) {
  140. return null;
  141. }
  142. return (
  143. <Fragment>
  144. {(definedEvent.entries as Array<Entry>).map((entry, entryIdx) => (
  145. <EventEntry
  146. key={entryIdx}
  147. projectSlug={projectSlug}
  148. group={group}
  149. organization={organization}
  150. event={definedEvent}
  151. entry={entry}
  152. isShare={isShare}
  153. />
  154. ))}
  155. </Fragment>
  156. );
  157. }
  158. const LatestEventNotAvailable = styled('div')`
  159. padding: ${space(2)} ${space(4)};
  160. `;
  161. const BorderlessEventEntries = styled(EventEntries)`
  162. & ${DataSection} {
  163. margin-left: 0 !important;
  164. margin-right: 0 !important;
  165. padding: ${space(3)} 0 0 0;
  166. }
  167. & ${DataSection}:first-child {
  168. padding-top: 0;
  169. border-top: 0;
  170. }
  171. `;
  172. export {EventEntries, BorderlessEventEntries};