projectReplays.tsx 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import type {RouteComponentProps} from 'react-router';
  2. import Access from 'sentry/components/acl/access';
  3. import {Button} from 'sentry/components/button';
  4. import Form from 'sentry/components/forms/form';
  5. import JsonForm from 'sentry/components/forms/jsonForm';
  6. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  7. import formGroups from 'sentry/data/forms/replay';
  8. import {t} from 'sentry/locale';
  9. import type {Organization, Project} from 'sentry/types';
  10. import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader';
  11. import PermissionAlert from 'sentry/views/settings/project/permissionAlert';
  12. type RouteParams = {
  13. projectId: string;
  14. };
  15. type Props = RouteComponentProps<RouteParams, {}> & {
  16. organization: Organization;
  17. project: Project;
  18. };
  19. function ProjectReplaySettings({organization, project, params: {projectId}}: Props) {
  20. return (
  21. <SentryDocumentTitle title={t('Replays')} projectSlug={project.slug}>
  22. <SettingsPageHeader
  23. title={t('Replays')}
  24. action={
  25. <Button
  26. external
  27. href="https://docs.sentry.io/product/session-replay/replay-page-and-filters/"
  28. >
  29. {t('Read the docs')}
  30. </Button>
  31. }
  32. />
  33. <PermissionAlert project={project} />
  34. <Form
  35. saveOnBlur
  36. apiMethod="PUT"
  37. apiEndpoint={`/projects/${organization.slug}/${projectId}/`}
  38. initialData={project.options}
  39. >
  40. <Access access={['project:write']} project={project}>
  41. {({hasAccess}) => <JsonForm disabled={!hasAccess} forms={formGroups} />}
  42. </Access>
  43. </Form>
  44. </SentryDocumentTitle>
  45. );
  46. }
  47. export default ProjectReplaySettings;