constants.tsx 1.4 KB

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