uptimeIssues.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import EmptyStateWarning from 'sentry/components/emptyStateWarning';
  2. import GroupList from 'sentry/components/issues/groupList';
  3. import Panel from 'sentry/components/panels/panel';
  4. import PanelBody from 'sentry/components/panels/panelBody';
  5. import {t} from 'sentry/locale';
  6. import {IssueCategory} from 'sentry/types/group';
  7. import type {Project} from 'sentry/types/project';
  8. import {getUtcDateString} from 'sentry/utils/dates';
  9. import useOrganization from 'sentry/utils/useOrganization';
  10. import usePageFilters from 'sentry/utils/usePageFilters';
  11. interface Props {
  12. project: Project;
  13. }
  14. export function UptimeIssues({project}: Props) {
  15. const organization = useOrganization();
  16. const {selection} = usePageFilters();
  17. const {start, end, period} = selection.datetime;
  18. const timeProps =
  19. start && end
  20. ? {
  21. start: getUtcDateString(start),
  22. end: getUtcDateString(end),
  23. }
  24. : {
  25. statsPeriod: period,
  26. };
  27. // TODO(davidenwang): Replace this with an actual query for the specific uptime alert rule
  28. const query = `issue.category:${IssueCategory.UPTIME}`;
  29. const emptyMessage = () => {
  30. return (
  31. <Panel>
  32. <PanelBody>
  33. <EmptyStateWarning>
  34. <p>{t('No issues relating to this uptime alert have been found.')}</p>
  35. </EmptyStateWarning>
  36. </PanelBody>
  37. </Panel>
  38. );
  39. };
  40. return (
  41. <GroupList
  42. orgSlug={organization.slug}
  43. queryParams={{
  44. query,
  45. project: project.id,
  46. limit: 20,
  47. ...timeProps,
  48. }}
  49. renderEmptyMessage={emptyMessage}
  50. />
  51. );
  52. }