projectReplays.tsx 3.6 KB

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