import {Component} from 'react'; import ApiForm from 'sentry/components/forms/apiForm'; import MultipleCheckbox from 'sentry/components/forms/controls/multipleCheckbox'; import BooleanField from 'sentry/components/forms/fields/booleanField'; import TextField from 'sentry/components/forms/fields/textField'; import FormField from 'sentry/components/forms/formField'; import Panel from 'sentry/components/panels/panel'; import PanelBody from 'sentry/components/panels/panelBody'; import PanelHeader from 'sentry/components/panels/panelHeader'; import {t} from 'sentry/locale'; import type {ServiceHook} from 'sentry/types/integrations'; import type {Organization} from 'sentry/types/organization'; import {browserHistory} from 'sentry/utils/browserHistory'; import normalizeUrl from 'sentry/utils/url/normalizeUrl'; const EVENT_CHOICES = ['event.alert', 'event.created']; type Props = { initialData: Partial & {isActive: boolean}; organization: Organization; projectId: string; hookId?: string; }; export default class ServiceHookSettingsForm extends Component { onSubmitSuccess = () => { const {organization, projectId} = this.props; browserHistory.push( normalizeUrl(`/settings/${organization.slug}/projects/${projectId}/hooks/`) ); }; render() { const {initialData, organization, projectId, hookId} = this.props; const endpoint = hookId ? `/projects/${organization.slug}/${projectId}/hooks/${hookId}/` : `/projects/${organization.slug}/${projectId}/hooks/`; return ( {t('Hook Configuration')} {({name, value, onChange}) => ( {EVENT_CHOICES.map(event => ( {event} ))} )} ); } }