create.tsx 885 B

1234567891011121314151617181920212223242526272829303132
  1. import {Fragment} from 'react';
  2. import {browserHistory, RouteComponentProps} from 'react-router';
  3. import AsyncView from 'sentry/views/asyncView';
  4. import MonitorForm from './monitorForm';
  5. import {Monitor} from './types';
  6. type Props = AsyncView['props'] & RouteComponentProps<{orgId: string}, {}>;
  7. export default class CreateMonitor extends AsyncView<Props, AsyncView['state']> {
  8. getTitle() {
  9. return `Monitors - ${this.props.params.orgId}`;
  10. }
  11. onSubmitSuccess = (data: Monitor) => {
  12. browserHistory.push(`/organizations/${this.props.params.orgId}/monitors/${data.id}/`);
  13. };
  14. renderBody() {
  15. return (
  16. <Fragment>
  17. <h1>New Monitor</h1>
  18. <MonitorForm
  19. apiMethod="POST"
  20. apiEndpoint={`/organizations/${this.props.params.orgId}/monitors/`}
  21. onSubmitSuccess={this.onSubmitSuccess}
  22. />
  23. </Fragment>
  24. );
  25. }
  26. }