eventEvidence.tsx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import KeyValueList from 'sentry/components/events/interfaces/keyValueList';
  2. import {ProfileEventEvidence} from 'sentry/components/events/profileEventEvidence';
  3. import type {Event} from 'sentry/types/event';
  4. import type {Group} from 'sentry/types/group';
  5. import type {Project} from 'sentry/types/project';
  6. import {eventIsProfilingIssue} from 'sentry/utils/events';
  7. import {
  8. getConfigForIssueType,
  9. getIssueCategoryAndTypeFromOccurrenceType,
  10. } from 'sentry/utils/issueTypeConfig';
  11. import {FoldSectionKey} from 'sentry/views/issueDetails/streamline/foldSection';
  12. import {InterimSection} from 'sentry/views/issueDetails/streamline/interimSection';
  13. type EvidenceProps = {event: Event; project: Project; group?: Group};
  14. /**
  15. * This component is rendered whenever an `event.occurrence.evidenceDisplay` is
  16. * present and the issue type config is set up to use evidenceDisplay.
  17. */
  18. export function EventEvidence({event, group, project}: EvidenceProps) {
  19. if (!event.occurrence) {
  20. return null;
  21. }
  22. if (eventIsProfilingIssue(event)) {
  23. return <ProfileEventEvidence event={event} projectSlug={project.slug} />;
  24. }
  25. const {issueCategory, issueType} =
  26. group ?? getIssueCategoryAndTypeFromOccurrenceType(event.occurrence.type);
  27. const config = getConfigForIssueType({issueCategory, issueType}, project).evidence;
  28. const evidenceDisplay = event.occurrence?.evidenceDisplay;
  29. if (!evidenceDisplay?.length || !config) {
  30. return null;
  31. }
  32. return (
  33. <InterimSection
  34. type={FoldSectionKey.EVIDENCE}
  35. title={config.title}
  36. help={config.helpText}
  37. >
  38. <KeyValueList
  39. data={evidenceDisplay.map(item => ({
  40. subject: item.name,
  41. key: item.name,
  42. value: item.value,
  43. }))}
  44. shouldSort={false}
  45. />
  46. </InterimSection>
  47. );
  48. }