monitor.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import {
  2. type Monitor,
  3. MonitorStatus,
  4. MonitorType,
  5. ScheduleType,
  6. } from 'sentry/views/monitors/types';
  7. import {Project} from './project';
  8. export function MonitorFixture(params: Partial<Monitor> = {}): Monitor {
  9. return {
  10. id: '',
  11. isMuted: false,
  12. name: 'My Monitor',
  13. project: Project(),
  14. slug: 'my-monitor',
  15. status: 'active',
  16. type: MonitorType.CRON_JOB,
  17. config: {
  18. checkin_margin: 5,
  19. max_runtime: 10,
  20. timezone: 'America/Los_Angeles',
  21. alert_rule_id: 1234,
  22. failure_issue_threshold: 2,
  23. recovery_threshold: 2,
  24. schedule_type: ScheduleType.CRONTAB,
  25. schedule: '10 * * * *',
  26. },
  27. dateCreated: '2023-01-01T00:00:00Z',
  28. environments: [
  29. {
  30. dateCreated: '2023-01-01T00:10:00Z',
  31. isMuted: false,
  32. lastCheckIn: '2023-12-25T17:13:00Z',
  33. name: 'production',
  34. nextCheckIn: '2023-12-25T16:10:00Z',
  35. nextCheckInLatest: '2023-12-25T15:15:00Z',
  36. status: MonitorStatus.OK,
  37. },
  38. ],
  39. alertRule: {
  40. targets: [{targetIdentifier: 1, targetType: 'Member'}],
  41. },
  42. ...params,
  43. };
  44. }