index.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import * as Sentry from '@sentry/react';
  2. import Tag from 'sentry/components/tag';
  3. import {t} from 'sentry/locale';
  4. import {CandidateDownloadStatus} from 'sentry/types/debugImage';
  5. type Props = {
  6. status: CandidateDownloadStatus;
  7. };
  8. function Status({status}: Props) {
  9. switch (status) {
  10. case CandidateDownloadStatus.OK: {
  11. return <Tag type="success">{t('Ok')}</Tag>;
  12. }
  13. case CandidateDownloadStatus.ERROR:
  14. case CandidateDownloadStatus.MALFORMED: {
  15. return <Tag type="error">{t('Failed')}</Tag>;
  16. }
  17. case CandidateDownloadStatus.NOT_FOUND: {
  18. return <Tag>{t('Not Found')}</Tag>;
  19. }
  20. case CandidateDownloadStatus.NO_PERMISSION: {
  21. return <Tag type="highlight">{t('Permissions')}</Tag>;
  22. }
  23. case CandidateDownloadStatus.DELETED: {
  24. return <Tag type="success">{t('Deleted')}</Tag>;
  25. }
  26. case CandidateDownloadStatus.UNAPPLIED: {
  27. return <Tag type="warning">{t('Unapplied')}</Tag>;
  28. }
  29. default: {
  30. Sentry.withScope(scope => {
  31. scope.setLevel('warning');
  32. Sentry.captureException(new Error('Unknown image candidate download status'));
  33. });
  34. return <Tag>{t('Unknown')}</Tag>; // This shall not happen
  35. }
  36. }
  37. }
  38. export default Status;