content.tsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import isNil from 'lodash/isNil';
  2. import CrashContent from 'sentry/components/events/interfaces/crashContent';
  3. import Pill from 'sentry/components/pill';
  4. import Pills from 'sentry/components/pills';
  5. import {t} from 'sentry/locale';
  6. import {Event, Project, STACK_TYPE, STACK_VIEW, Thread} from 'sentry/types';
  7. import NoStackTraceMessage from '../noStackTraceMessage';
  8. type CrashContentProps = React.ComponentProps<typeof CrashContent>;
  9. type Props = {
  10. event: Event;
  11. newestFirst: boolean;
  12. projectId: Project['id'];
  13. stackTraceNotFound: boolean;
  14. stackType: STACK_TYPE;
  15. data?: Thread;
  16. stackView?: STACK_VIEW;
  17. } & Pick<
  18. CrashContentProps,
  19. 'exception' | 'stacktrace' | 'hasHierarchicalGrouping' | 'groupingCurrentLevel'
  20. >;
  21. const Content = ({
  22. event,
  23. projectId,
  24. data,
  25. stackView,
  26. groupingCurrentLevel,
  27. stackType,
  28. newestFirst,
  29. exception,
  30. stacktrace,
  31. stackTraceNotFound,
  32. hasHierarchicalGrouping,
  33. }: Props) => (
  34. <div className="thread">
  35. {data && (!isNil(data?.id) || !!data?.name) && (
  36. <Pills>
  37. {!isNil(data.id) && <Pill name={t('id')} value={String(data.id)} />}
  38. {!!data.name?.trim() && <Pill name={t('name')} value={data.name} />}
  39. <Pill name={t('was active')} value={data.current} />
  40. <Pill name={t('errored')} className={data.crashed ? 'false' : 'true'}>
  41. {data.crashed ? t('yes') : t('no')}
  42. </Pill>
  43. </Pills>
  44. )}
  45. {stackTraceNotFound ? (
  46. <NoStackTraceMessage message={data?.crashed ? t('Thread Errored') : undefined} />
  47. ) : (
  48. <CrashContent
  49. event={event}
  50. stackType={stackType}
  51. stackView={stackView}
  52. newestFirst={newestFirst}
  53. projectId={projectId}
  54. exception={exception}
  55. stacktrace={stacktrace}
  56. groupingCurrentLevel={groupingCurrentLevel}
  57. hasHierarchicalGrouping={hasHierarchicalGrouping}
  58. />
  59. )}
  60. </div>
  61. );
  62. export default Content;