organizationRepositories.tsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import AlertLink from 'sentry/components/alertLink';
  2. import {Button} from 'sentry/components/button';
  3. import EmptyMessage from 'sentry/components/emptyMessage';
  4. import ExternalLink from 'sentry/components/links/externalLink';
  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 RepositoryRow from 'sentry/components/repositoryRow';
  9. import {IconCommit} from 'sentry/icons';
  10. import {t, tct} from 'sentry/locale';
  11. import {Organization, Repository, RepositoryStatus} from 'sentry/types';
  12. import useApi from 'sentry/utils/useApi';
  13. import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader';
  14. import TextBlock from 'sentry/views/settings/components/text/textBlock';
  15. type Props = {
  16. itemList: Repository[];
  17. onRepositoryChange: (data: {id: string; status: RepositoryStatus}) => void;
  18. organization: Organization;
  19. };
  20. function OrganizationRepositories({itemList, onRepositoryChange, organization}: Props) {
  21. const api = useApi();
  22. const hasItemList = itemList && itemList.length > 0;
  23. return (
  24. <div>
  25. <SettingsPageHeader title={t('Repositories')} />
  26. <AlertLink to={`/settings/${organization.slug}/integrations/`}>
  27. {t(
  28. 'Want to add a repository to start tracking commits? Install or configure your version control integration here.'
  29. )}
  30. </AlertLink>
  31. {!hasItemList && (
  32. <div className="m-b-2">
  33. <TextBlock>
  34. {t(
  35. "Connecting a repository allows Sentry to capture commit data via webhooks. This enables features like suggested assignees and resolving issues via commit message. Once you've connected a repository, you can associate commits with releases via the API."
  36. )}
  37. &nbsp;
  38. {tct('See our [link:documentation] for more details.', {
  39. link: <ExternalLink href="https://docs.sentry.io/learn/releases/" />,
  40. })}
  41. </TextBlock>
  42. </div>
  43. )}
  44. {hasItemList ? (
  45. <Panel>
  46. <PanelHeader>{t('Added Repositories')}</PanelHeader>
  47. <PanelBody>
  48. <div>
  49. {itemList.map(repo => (
  50. <RepositoryRow
  51. api={api}
  52. key={repo.id}
  53. repository={repo}
  54. showProvider
  55. orgSlug={organization.slug}
  56. onRepositoryChange={onRepositoryChange}
  57. />
  58. ))}
  59. </div>
  60. </PanelBody>
  61. </Panel>
  62. ) : (
  63. <Panel>
  64. <EmptyMessage
  65. icon={<IconCommit size="xl" />}
  66. title={t('Sentry is better with commit data')}
  67. description={t(
  68. 'Adding one or more repositories will enable enhanced releases and the ability to resolve Sentry Issues via git message.'
  69. )}
  70. action={
  71. <Button external href="https://docs.sentry.io/learn/releases/">
  72. {t('Learn more')}
  73. </Button>
  74. }
  75. />
  76. </Panel>
  77. )}
  78. </div>
  79. );
  80. }
  81. export default OrganizationRepositories;