packageData.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import {Component} from 'react';
  2. import ClippedBox from 'sentry/components/clippedBox';
  3. import ErrorBoundary from 'sentry/components/errorBoundary';
  4. import EventDataSection from 'sentry/components/events/eventDataSection';
  5. import KeyValueList from 'sentry/components/events/interfaces/keyValueList';
  6. import {getMeta} from 'sentry/components/events/meta/metaProxy';
  7. import {t} from 'sentry/locale';
  8. import {Event} from 'sentry/types/event';
  9. type Props = {
  10. event: Event;
  11. };
  12. class EventPackageData extends Component<Props> {
  13. shouldComponentUpdate(nextProps: Props) {
  14. return this.props.event.id !== nextProps.event.id;
  15. }
  16. render() {
  17. const {event} = this.props;
  18. let longKeys: boolean, title: string;
  19. const packages = Object.entries(event.packages || {}).map(([key, value]) => ({
  20. key,
  21. value,
  22. subject: key,
  23. meta: getMeta(event.packages, key),
  24. }));
  25. switch (event.platform) {
  26. case 'csharp':
  27. longKeys = true;
  28. title = t('Assemblies');
  29. break;
  30. default:
  31. longKeys = false;
  32. title = t('Packages');
  33. }
  34. return (
  35. <EventDataSection type="packages" title={title}>
  36. <ClippedBox>
  37. <ErrorBoundary mini>
  38. <KeyValueList data={packages} longKeys={longKeys} />
  39. </ErrorBoundary>
  40. </ClippedBox>
  41. </EventDataSection>
  42. );
  43. }
  44. }
  45. export default EventPackageData;