integrationAlertRules.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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, PanelBody, PanelHeader, PanelItem} from 'sentry/components/panels';
  6. import {t} from 'sentry/locale';
  7. import {Organization, Project} from 'sentry/types';
  8. import withOrganization from 'sentry/utils/withOrganization';
  9. import withProjects from 'sentry/utils/withProjects';
  10. type Props = {
  11. organization: Organization;
  12. projects: Project[];
  13. };
  14. function IntegrationAlertRules({projects, organization}: Props) {
  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. `;
  43. export default withOrganization(withProjects(IntegrationAlertRules));