constants.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import {t} from 'sentry/locale';
  2. import type {SelectValue} from 'sentry/types/core';
  3. import {TimePeriod, TimeWindow} from 'sentry/views/alerts/rules/metric/types';
  4. export const SELECTOR_RELATIVE_PERIODS = {
  5. [TimePeriod.SIX_HOURS]: t('Last 6 hours'),
  6. [TimePeriod.ONE_DAY]: t('Last 24 hours'),
  7. [TimePeriod.THREE_DAYS]: t('Last 3 days'),
  8. [TimePeriod.SEVEN_DAYS]: t('Last 7 days'),
  9. };
  10. export const ALERT_DEFAULT_CHART_PERIOD = '7d';
  11. export const TIME_OPTIONS: SelectValue<string>[] = [
  12. {label: t('Last 6 hours'), value: TimePeriod.SIX_HOURS},
  13. {label: t('Last 24 hours'), value: TimePeriod.ONE_DAY},
  14. {label: t('Last 3 days'), value: TimePeriod.THREE_DAYS},
  15. {label: t('Last 7 days'), value: TimePeriod.SEVEN_DAYS},
  16. {label: t('Last 14 days'), value: TimePeriod.FOURTEEN_DAYS},
  17. ];
  18. export const TIME_WINDOWS = {
  19. [TimePeriod.SIX_HOURS]: TimeWindow.ONE_HOUR * 6 * 60 * 1000,
  20. [TimePeriod.ONE_DAY]: TimeWindow.ONE_DAY * 60 * 1000,
  21. [TimePeriod.THREE_DAYS]: TimeWindow.ONE_DAY * 3 * 60 * 1000,
  22. [TimePeriod.SEVEN_DAYS]: TimeWindow.ONE_DAY * 7 * 60 * 1000,
  23. [TimePeriod.FOURTEEN_DAYS]: TimeWindow.ONE_DAY * 14 * 60 * 1000,
  24. };
  25. export const SELECTOR_DEFAULT_PERIOD = TimePeriod.FOURTEEN_DAYS;
  26. export const API_INTERVAL_POINTS_LIMIT = 10000;
  27. export const API_INTERVAL_POINTS_MIN = 150;
  28. export type TimePeriodType = {
  29. display: React.ReactNode;
  30. end: string;
  31. label: string;
  32. period: string;
  33. start: string;
  34. /**
  35. * The start/end were chosen from the period and not the user
  36. */
  37. usingPeriod: boolean;
  38. custom?: boolean;
  39. utc?: boolean;
  40. };