device.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import {EventDataSection} from 'sentry/components/events/eventDataSection';
  2. import {t} from 'sentry/locale';
  3. import type {Event} from 'sentry/types/event';
  4. import {isEmptyObject} from 'sentry/utils/object/isEmptyObject';
  5. import KeyValueList from './interfaces/keyValueList';
  6. type Props = {
  7. event: Event;
  8. };
  9. export function EventDevice({event}: Props) {
  10. const data = event.device ?? {};
  11. const extras = Object.entries<any>(data.data ?? {}).map(([key, value]) => ({
  12. key,
  13. value,
  14. subject: key,
  15. isContextData: true,
  16. }));
  17. if (isEmptyObject(event.device)) {
  18. return null;
  19. }
  20. return (
  21. <EventDataSection type="device" title={t('Device')}>
  22. <KeyValueList
  23. shouldSort={false}
  24. data={[
  25. {
  26. key: 'name',
  27. subject: t('Name'),
  28. value: data.name,
  29. },
  30. {
  31. key: 'version',
  32. subject: t('Version'),
  33. value: data.version,
  34. },
  35. {
  36. key: 'build',
  37. subject: t('Build'),
  38. value: data.build,
  39. },
  40. ...extras,
  41. ]}
  42. />
  43. </EventDataSection>
  44. );
  45. }