projectReplays.tsx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import type {RouteComponentProps} from 'react-router';
  2. import styled from '@emotion/styled';
  3. import Access from 'sentry/components/acl/access';
  4. import {Button} from 'sentry/components/button';
  5. import Form from 'sentry/components/forms/form';
  6. import JsonForm from 'sentry/components/forms/jsonForm';
  7. import formGroups from 'sentry/data/forms/replay';
  8. import {t} from 'sentry/locale';
  9. import {space} from 'sentry/styles/space';
  10. import type {Organization, Project} from 'sentry/types';
  11. import routeTitleGen from 'sentry/utils/routeTitle';
  12. import DeprecatedAsyncView from 'sentry/views/deprecatedAsyncView';
  13. import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader';
  14. import PermissionAlert from 'sentry/views/settings/project/permissionAlert';
  15. type RouteParams = {
  16. projectId: string;
  17. };
  18. type Props = RouteComponentProps<RouteParams, {}> & {
  19. organization: Organization;
  20. project: Project;
  21. };
  22. class ProjectUserFeedbackSettings extends DeprecatedAsyncView<Props> {
  23. submitTimeout: number | undefined = undefined;
  24. getEndpoints(): ReturnType<DeprecatedAsyncView['getEndpoints']> {
  25. const {organization} = this.props;
  26. const {projectId} = this.props.params;
  27. return [['project', `/projects/${organization.slug}/${projectId}/`]];
  28. }
  29. getTitle(): string {
  30. const {projectId} = this.props.params;
  31. return routeTitleGen(t('Replays'), projectId, false);
  32. }
  33. renderBody() {
  34. const {organization, project} = this.props;
  35. const {projectId} = this.props.params;
  36. return (
  37. <div>
  38. <SettingsPageHeader
  39. title={t('Replays')}
  40. action={
  41. <ButtonList>
  42. <Button
  43. external
  44. href="https://docs.sentry.io/product/session-replay/replay-page-and-filters/"
  45. >
  46. {t('Read the docs')}
  47. </Button>
  48. </ButtonList>
  49. }
  50. />
  51. <PermissionAlert project={project} />
  52. <Form
  53. saveOnBlur
  54. apiMethod="PUT"
  55. apiEndpoint={`/projects/${organization.slug}/${projectId}/`}
  56. initialData={this.state.project.options}
  57. >
  58. <Access access={['project:write']} project={project}>
  59. {({hasAccess}) => <JsonForm disabled={!hasAccess} forms={formGroups} />}
  60. </Access>
  61. </Form>
  62. </div>
  63. );
  64. }
  65. }
  66. export default ProjectUserFeedbackSettings;
  67. const ButtonList = styled('div')`
  68. display: inline-grid;
  69. grid-auto-flow: column;
  70. gap: ${space(1)};
  71. `;