constants.tsx 1.5 KB

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