monitorIssues.tsx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import EmptyStateWarning from 'sentry/components/emptyStateWarning';
  2. import GroupList from 'sentry/components/issues/groupList';
  3. import {Panel, PanelBody} from 'sentry/components/panels';
  4. import {t} from 'sentry/locale';
  5. import {getUtcDateString} from 'sentry/utils/dates';
  6. import usePageFilters from 'sentry/utils/usePageFilters';
  7. import {Monitor, MonitorEnvironment} from '../types';
  8. type Props = {
  9. monitor: Monitor;
  10. monitorEnv: MonitorEnvironment;
  11. orgId: string;
  12. };
  13. function MonitorIssuesEmptyMessage() {
  14. return (
  15. <Panel>
  16. <PanelBody>
  17. <EmptyStateWarning>
  18. <p>{t('No issues relating to this cron monitor have been found.')}</p>
  19. </EmptyStateWarning>
  20. </PanelBody>
  21. </Panel>
  22. );
  23. }
  24. function MonitorIssues({orgId, monitor}: Props) {
  25. const {selection} = usePageFilters();
  26. const {start, end, period} = selection.datetime;
  27. const timeProps =
  28. start && end
  29. ? {
  30. start: getUtcDateString(start),
  31. end: getUtcDateString(end),
  32. }
  33. : {
  34. statsPeriod: period,
  35. };
  36. // TODO(epurkhiser): We probably want to filter on envrionemnt
  37. return (
  38. <GroupList
  39. orgId={orgId}
  40. endpointPath={`/organizations/${orgId}/issues/`}
  41. queryParams={{
  42. query: `monitor.slug:"${monitor.slug}"`,
  43. project: monitor.project.id,
  44. limit: 5,
  45. ...timeProps,
  46. }}
  47. query=""
  48. renderEmptyMessage={MonitorIssuesEmptyMessage}
  49. canSelectGroups={false}
  50. withPagination={false}
  51. withChart={false}
  52. useTintRow={false}
  53. source="monitors"
  54. />
  55. );
  56. }
  57. export default MonitorIssues;