import React from 'react'; import {RouteComponentProps} from 'react-router'; import {openEditOwnershipRules} from 'app/actionCreators/modal'; import Feature from 'app/components/acl/feature'; import Button from 'app/components/button'; import ExternalLink from 'app/components/links/externalLink'; import {t, tct} from 'app/locale'; import {Organization, Project} from 'app/types'; import routeTitleGen from 'app/utils/routeTitle'; import AsyncView from 'app/views/asyncView'; import Form from 'app/views/settings/components/forms/form'; import JsonForm from 'app/views/settings/components/forms/jsonForm'; import SettingsPageHeader from 'app/views/settings/components/settingsPageHeader'; import PermissionAlert from 'app/views/settings/project/permissionAlert'; import CodeOwnersPanel from 'app/views/settings/project/projectOwnership/codeowners'; import RulesPanel from 'app/views/settings/project/projectOwnership/rulesPanel'; type Props = { organization: Organization; project: Project; } & RouteComponentProps<{orgId: string; projectId: string}, {}>; type State = { ownership: null | any; } & AsyncView['state']; class ProjectOwnership extends AsyncView { getTitle() { const {project} = this.props; return routeTitleGen(t('Issue Owners'), project.slug, false); } getEndpoints(): ReturnType { const {organization, project} = this.props; return [['ownership', `/projects/${organization.slug}/${project.slug}/ownership/`]]; } getPlaceholder() { return `#example usage path:src/example/pipeline/* person@sentry.io #infra url:http://example.com/settings/* #product tags.sku_class:enterprise #enterprise`; } getDetail() { return tct( `Automatically assign issues and send alerts to the right people based on issue properties. [link:Learn more].`, { link: ( ), } ); } handleOwnershipSave = (text: string | null) => { this.setState(prevState => ({ ownership: { ...prevState.ownership, raw: text, }, })); }; renderBody() { const {project, organization} = this.props; const {ownership} = this.state; const disabled = !organization.access.includes('project:write'); return ( {t('View Issues')} } /> openEditOwnershipRules({ organization, project, ownership, onSave: this.handleOwnershipSave, }) } disabled={disabled} > {t('Edit')} , ]} />
); } } export default ProjectOwnership;