projectReplays.tsx 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 type {JsonFormObject} from 'sentry/components/forms/types';
  7. import Link from 'sentry/components/links/link';
  8. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  9. import {t, tct} from 'sentry/locale';
  10. import type {Organization} from 'sentry/types/organization';
  11. import type {Project} from 'sentry/types/project';
  12. import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader';
  13. import PermissionAlert from 'sentry/views/settings/project/permissionAlert';
  14. type RouteParams = {
  15. projectId: string;
  16. };
  17. type Props = RouteComponentProps<RouteParams, {}> & {
  18. organization: Organization;
  19. project: Project;
  20. };
  21. function ProjectReplaySettings({organization, project, params: {projectId}}: Props) {
  22. const formGroups: JsonFormObject[] = [
  23. {
  24. title: 'Settings',
  25. fields: [
  26. {
  27. name: 'sentry:replay_rage_click_issues',
  28. type: 'boolean',
  29. // additional data/props that is related to rendering of form field rather than data
  30. label: t('Create Rage Click Issues'),
  31. help: t('Toggles whether or not to create Session Replay Rage Click Issues'),
  32. getData: data => ({options: data}),
  33. },
  34. {
  35. name: 'sentry:replay_hydration_error_issues',
  36. type: 'boolean',
  37. // additional data/props that is related to rendering of form field rather than data
  38. label: t('Create Hydration Error Issues'),
  39. help() {
  40. return tct(
  41. 'Toggles whether or not to create Session Replay Hydration Error Issues during replay ingest. Using [inboundFilters: inbound filters] to filter out hydration errors does not affect this setting.',
  42. {
  43. inboundFilters: (
  44. <Link
  45. to={`/settings/projects/${project.slug}/filters/data-filters/#filters-react-hydration-errors_help`}
  46. />
  47. ),
  48. }
  49. );
  50. },
  51. getData: data => ({options: data}),
  52. visible({features}) {
  53. return features.has('session-replay-hydration-error-issue-creation');
  54. },
  55. },
  56. ],
  57. },
  58. ];
  59. return (
  60. <SentryDocumentTitle title={t('Replays')} projectSlug={project.slug}>
  61. <SettingsPageHeader
  62. title={t('Replays')}
  63. action={
  64. <Button
  65. external
  66. href="https://docs.sentry.io/product/session-replay/replay-page-and-filters/"
  67. >
  68. {t('Read the Docs')}
  69. </Button>
  70. }
  71. />
  72. <PermissionAlert project={project} />
  73. <Form
  74. saveOnBlur
  75. apiMethod="PUT"
  76. apiEndpoint={`/projects/${organization.slug}/${projectId}/`}
  77. initialData={project.options}
  78. >
  79. <Access access={['project:write']} project={project}>
  80. {({hasAccess}) => (
  81. <JsonForm
  82. disabled={!hasAccess}
  83. features={new Set(organization.features)}
  84. forms={formGroups}
  85. />
  86. )}
  87. </Access>
  88. </Form>
  89. </SentryDocumentTitle>
  90. );
  91. }
  92. export default ProjectReplaySettings;