organizationRepositories.tsx 3.1 KB

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