integrationAlertRules.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import styled from '@emotion/styled';
  2. import {Button} from 'sentry/components/button';
  3. import EmptyMessage from 'sentry/components/emptyMessage';
  4. import ProjectBadge from 'sentry/components/idBadge/projectBadge';
  5. import Panel from 'sentry/components/panels/panel';
  6. import PanelBody from 'sentry/components/panels/panelBody';
  7. import PanelHeader from 'sentry/components/panels/panelHeader';
  8. import PanelItem from 'sentry/components/panels/panelItem';
  9. import {t} from 'sentry/locale';
  10. import useOrganization from 'sentry/utils/useOrganization';
  11. import useProjects from 'sentry/utils/useProjects';
  12. export default function IntegrationAlertRules() {
  13. const organization = useOrganization();
  14. const {projects} = useProjects();
  15. return (
  16. <Panel>
  17. <PanelHeader>{t('Project Configuration')}</PanelHeader>
  18. <PanelBody>
  19. {projects.length === 0 && (
  20. <EmptyMessage size="large">
  21. {t('You have no projects to add Alert Rules to')}
  22. </EmptyMessage>
  23. )}
  24. {projects.map(project => (
  25. <ProjectItem key={project.slug}>
  26. <ProjectBadge project={project} avatarSize={16} />
  27. <Button
  28. to={`/organizations/${organization.slug}/alerts/${project.slug}/wizard/`}
  29. size="xs"
  30. >
  31. {t('Add Alert Rule')}
  32. </Button>
  33. </ProjectItem>
  34. ))}
  35. </PanelBody>
  36. </Panel>
  37. );
  38. }
  39. const ProjectItem = styled(PanelItem)`
  40. align-items: center;
  41. justify-content: space-between;
  42. `;