processingIcon.tsx 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import * as Sentry from '@sentry/react';
  2. import Tooltip from 'sentry/components/tooltip';
  3. import {IconCheckmark, IconInfo, IconWarning} from 'sentry/icons';
  4. import {t} from 'sentry/locale';
  5. import {ImageStatus} from 'sentry/types/debugImage';
  6. type Props = {
  7. status: ImageStatus;
  8. };
  9. function ProcessingIcon({status}: Props) {
  10. switch (status) {
  11. case ImageStatus.TIMEOUT:
  12. case ImageStatus.FETCHING_FAILED: {
  13. return (
  14. <Tooltip
  15. containerDisplayMode="inline-flex"
  16. title={t('The debug information file for this image could not be downloaded')}
  17. >
  18. <IconWarning color="yellow300" size="xs" />
  19. </Tooltip>
  20. );
  21. }
  22. case ImageStatus.MALFORMED: {
  23. return (
  24. <Tooltip
  25. containerDisplayMode="inline-flex"
  26. title={t('The debug information file for this image failed to process')}
  27. >
  28. <IconWarning color="yellow300" size="xs" />
  29. </Tooltip>
  30. );
  31. }
  32. case ImageStatus.MISSING: {
  33. return (
  34. <Tooltip
  35. containerDisplayMode="inline-flex"
  36. title={t('No debug information could be found in any of the specified sources')}
  37. >
  38. <IconWarning color="yellow300" size="xs" />
  39. </Tooltip>
  40. );
  41. }
  42. case ImageStatus.FOUND: {
  43. return (
  44. <Tooltip
  45. containerDisplayMode="inline-flex"
  46. title={t(
  47. 'Debug information for this image was found and successfully processed'
  48. )}
  49. >
  50. <IconCheckmark color="green300" size="xs" />
  51. </Tooltip>
  52. );
  53. }
  54. case ImageStatus.UNUSED: {
  55. return (
  56. <Tooltip
  57. containerDisplayMode="inline-flex"
  58. title={t('The image was not required for processing the stack trace')}
  59. >
  60. <IconInfo color="gray200" size="xs" />
  61. </Tooltip>
  62. );
  63. }
  64. case ImageStatus.OTHER: {
  65. return (
  66. <Tooltip
  67. containerDisplayMode="inline-flex"
  68. title={t('An internal error occurred while handling this image')}
  69. >
  70. <IconWarning color="yellow300" size="xs" />
  71. </Tooltip>
  72. );
  73. }
  74. default: {
  75. Sentry.withScope(scope => {
  76. scope.setLevel('warning');
  77. Sentry.captureException(new Error('Unknown image ProcessingIcon status'));
  78. });
  79. return null; // This shall not happen
  80. }
  81. }
  82. }
  83. export default ProcessingIcon;