constants.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. },
  20. error: {
  21. icon: <IconFire color="errorText" />,
  22. color: 'errorText',
  23. },
  24. active: {
  25. icon: <IconTimer color="subText" />,
  26. color: 'subText',
  27. label: t('Waiting For Check-In'),
  28. },
  29. disabled: {
  30. icon: <IconUnsubscribed color="subText" size="xs" />,
  31. color: 'subText',
  32. label: t('Muted'),
  33. },
  34. };
  35. export const checkStatusToIndicatorStatus: Record<
  36. CheckInStatus,
  37. StatusIndicatorProps['status']
  38. > = {
  39. [CheckInStatus.OK]: 'success',
  40. [CheckInStatus.ERROR]: 'error',
  41. [CheckInStatus.IN_PROGRESS]: 'muted',
  42. [CheckInStatus.MISSED]: 'warning',
  43. [CheckInStatus.TIMEOUT]: 'error',
  44. };