import {RouteComponentProps} from 'react-router'; import {Location} from 'history'; import {addErrorMessage} from 'sentry/actionCreators/indicator'; import {updateOrganization} from 'sentry/actionCreators/organizations'; import AsyncComponent from 'sentry/components/asyncComponent'; import AvatarChooser from 'sentry/components/avatarChooser'; import Form from 'sentry/components/forms/form'; import JsonForm from 'sentry/components/forms/jsonForm'; import organizationSettingsFields from 'sentry/data/forms/organizationGeneralSettings'; import {Organization, Scope} from 'sentry/types'; import withOrganization from 'sentry/utils/withOrganization'; type Props = { access: Set; initialData: Organization; location: Location; onSave: (previous: Organization, updated: Record) => void; organization: Organization; } & RouteComponentProps<{orgId: string}, {}>; type State = AsyncComponent['state'] & { authProvider: object; }; class OrganizationSettingsForm extends AsyncComponent { getEndpoints(): ReturnType { const {organization} = this.props; return [['authProvider', `/organizations/${organization.slug}/auth-provider/`]]; } render() { const {initialData, organization, onSave, access} = this.props; const {authProvider} = this.state; const endpoint = `/organizations/${organization.slug}/`; const jsonFormSettings = { additionalFieldProps: {hasSsoEnabled: !!authProvider}, features: new Set(organization.features), access, location: this.props.location, disabled: !access.has('org:write'), }; return (
{ // Special case for slug, need to forward to new slug if (typeof onSave === 'function') { onSave(initialData, model.initialData); } }} onSubmitError={() => addErrorMessage('Unable to save change')} > ); } } export default withOrganization(OrganizationSettingsForm);