projectReplays.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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} from 'sentry/types/organization';
  10. import type {Project} from 'sentry/types/project';
  11. import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader';
  12. import PermissionAlert from 'sentry/views/settings/project/permissionAlert';
  13. type RouteParams = {
  14. projectId: string;
  15. };
  16. type Props = RouteComponentProps<RouteParams, {}> & {
  17. organization: Organization;
  18. project: Project;
  19. };
  20. function ProjectReplaySettings({organization, project, params: {projectId}}: Props) {
  21. return (
  22. <SentryDocumentTitle title={t('Replays')} projectSlug={project.slug}>
  23. <SettingsPageHeader
  24. title={t('Replays')}
  25. action={
  26. <Button
  27. external
  28. href="https://docs.sentry.io/product/session-replay/replay-page-and-filters/"
  29. >
  30. {t('Read the Docs')}
  31. </Button>
  32. }
  33. />
  34. <PermissionAlert project={project} />
  35. <Form
  36. saveOnBlur
  37. apiMethod="PUT"
  38. apiEndpoint={`/projects/${organization.slug}/${projectId}/`}
  39. initialData={project.options}
  40. >
  41. <Access access={['project:write']} project={project}>
  42. {({hasAccess}) => (
  43. <JsonForm
  44. features={new Set(organization.features)}
  45. disabled={!hasAccess}
  46. forms={formGroups}
  47. />
  48. )}
  49. </Access>
  50. </Form>
  51. </SentryDocumentTitle>
  52. );
  53. }
  54. export default ProjectReplaySettings;