import {Fragment} from 'react'; import {RouteComponentProps} from 'react-router'; import {hasEveryAccess} from 'sentry/components/acl/access'; import Feature from 'sentry/components/acl/feature'; import Form from 'sentry/components/forms/form'; import JsonForm from 'sentry/components/forms/jsonForm'; import ExternalLink from 'sentry/components/links/externalLink'; import {fields} from 'sentry/data/forms/projectIssueGrouping'; import {t, tct} from 'sentry/locale'; import ProjectsStore from 'sentry/stores/projectsStore'; import {EventGroupingConfig, Organization, Project} from 'sentry/types'; import routeTitleGen from 'sentry/utils/routeTitle'; import DeprecatedAsyncView from 'sentry/views/deprecatedAsyncView'; import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader'; import TextBlock from 'sentry/views/settings/components/text/textBlock'; import PermissionAlert from 'sentry/views/settings/project/permissionAlert'; import UpgradeGrouping from './upgradeGrouping'; type Props = RouteComponentProps<{projectId: string}, {}> & { organization: Organization; project: Project; }; type State = { groupingConfigs: EventGroupingConfig[] | null; } & DeprecatedAsyncView['state']; class ProjectIssueGrouping extends DeprecatedAsyncView { getTitle() { const {projectId} = this.props.params; return routeTitleGen(t('Issue Grouping'), projectId, false); } getDefaultState() { return { ...super.getDefaultState(), groupingConfigs: [], }; } getEndpoints(): ReturnType { const {organization, project} = this.props; return [ [ 'groupingConfigs', `/projects/${organization.slug}/${project.slug}/grouping-configs/`, ], ]; } handleSubmit = (response: Project) => { // This will update our project context ProjectsStore.onUpdateSuccess(response); }; renderBody() { const {groupingConfigs} = this.state; const {organization, project, params, location} = this.props; const endpoint = `/projects/${organization.slug}/${project.slug}/`; const access = new Set(organization.access.concat(project.access)); const hasAccess = hasEveryAccess(['project:write'], {organization, project}); const jsonFormProps = { additionalFieldProps: { organization, groupingConfigs, }, features: new Set(organization.features), access, disabled: !hasAccess, }; return ( {tct( `All events have a fingerprint. Events with the same fingerprint are grouped together into an issue. To learn more about issue grouping, [link: read the docs].`, { link: ( ), } )}
); } } export default ProjectIssueGrouping;