monitorIssues.tsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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} from '../types';
  8. type Props = {
  9. monitor: Monitor;
  10. orgId: string;
  11. };
  12. const MonitorIssuesEmptyMessage = () => (
  13. <Panel>
  14. <PanelBody>
  15. <EmptyStateWarning>
  16. <p>{t('No issues relating to this cron monitor have been found.')}</p>
  17. </EmptyStateWarning>
  18. </PanelBody>
  19. </Panel>
  20. );
  21. const MonitorIssues = ({orgId, monitor}: Props) => {
  22. const {selection} = usePageFilters();
  23. const {start, end, period} = selection.datetime;
  24. const timeProps =
  25. start && end
  26. ? {
  27. start: getUtcDateString(start),
  28. end: getUtcDateString(end),
  29. }
  30. : {
  31. statsPeriod: period,
  32. };
  33. return (
  34. <GroupList
  35. orgId={orgId}
  36. endpointPath={`/organizations/${orgId}/issues/`}
  37. queryParams={{
  38. query: `monitor.id:"${monitor.id}"`,
  39. project: monitor.project.id,
  40. limit: 5,
  41. ...timeProps,
  42. }}
  43. query=""
  44. renderEmptyMessage={MonitorIssuesEmptyMessage}
  45. canSelectGroups={false}
  46. withPagination={false}
  47. withChart={false}
  48. useTintRow={false}
  49. source="monitors"
  50. />
  51. );
  52. };
  53. export default MonitorIssues;