integrationAlertRules.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. const IntegrationAlertRules = ({projects, organization}: Props) => (
  15. <Panel>
  16. <PanelHeader>{t('Project Configuration')}</PanelHeader>
  17. <PanelBody>
  18. {projects.length === 0 && (
  19. <EmptyMessage size="large">
  20. {t('You have no projects to add Alert Rules to')}
  21. </EmptyMessage>
  22. )}
  23. {projects.map(project => (
  24. <ProjectItem key={project.slug}>
  25. <ProjectBadge project={project} avatarSize={16} />
  26. <Button
  27. to={`/organizations/${organization.slug}/alerts/${project.slug}/wizard/`}
  28. size="xs"
  29. >
  30. {t('Add Alert Rule')}
  31. </Button>
  32. </ProjectItem>
  33. ))}
  34. </PanelBody>
  35. </Panel>
  36. );
  37. const ProjectItem = styled(PanelItem)`
  38. align-items: center;
  39. justify-content: space-between;
  40. `;
  41. export default withOrganization(withProjects(IntegrationAlertRules));