constants.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import {
  2. IconCheckmark,
  3. IconFire,
  4. IconTimer,
  5. IconUnsubscribed,
  6. IconWarning,
  7. } from 'sentry/icons';
  8. import {t} from 'sentry/locale';
  9. import type {Aliases} from 'sentry/utils/theme';
  10. import type {StatsBucket} from 'sentry/views/monitors/components/overviewTimeline/types';
  11. import type {MonitorStatus} from 'sentry/views/monitors/types';
  12. import {CheckInStatus} from 'sentry/views/monitors/types';
  13. // Orders the status in terms of ascending precedence for showing to the user
  14. export const CHECKIN_STATUS_PRECEDENT = [
  15. CheckInStatus.IN_PROGRESS,
  16. CheckInStatus.OK,
  17. CheckInStatus.MISSED,
  18. CheckInStatus.TIMEOUT,
  19. CheckInStatus.ERROR,
  20. ] satisfies Array<keyof StatsBucket>;
  21. export const statusIconColorMap: Record<
  22. MonitorStatus,
  23. {color: keyof Aliases; icon: React.ReactNode; label: string}
  24. > = {
  25. ok: {
  26. icon: <IconCheckmark color="successText" />,
  27. color: 'successText',
  28. label: t('Okay'),
  29. },
  30. error: {
  31. icon: <IconFire color="errorText" />,
  32. color: 'errorText',
  33. label: t('Error'),
  34. },
  35. timeout: {
  36. icon: <IconFire color="errorText" />,
  37. color: 'errorText',
  38. label: t('Timed Out'),
  39. },
  40. missed_checkin: {
  41. icon: <IconWarning color="warningText" />,
  42. color: 'warningText',
  43. label: t('Missed'),
  44. },
  45. active: {
  46. icon: <IconTimer color="subText" />,
  47. color: 'subText',
  48. label: t('Waiting For Check-In'),
  49. },
  50. disabled: {
  51. icon: <IconUnsubscribed color="subText" size="xs" />,
  52. color: 'subText',
  53. label: t('Muted'),
  54. },
  55. };