organizationCreate.tsx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import {ApiForm, CheckboxField, TextField} from 'sentry/components/forms';
  2. import NarrowLayout from 'sentry/components/narrowLayout';
  3. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  4. import {t, tct} from 'sentry/locale';
  5. import ConfigStore from 'sentry/stores/configStore';
  6. function OrganizationCreate() {
  7. const termsUrl = ConfigStore.get('termsUrl');
  8. const privacyUrl = ConfigStore.get('privacyUrl');
  9. return (
  10. <SentryDocumentTitle title={t('Create Organization')}>
  11. <NarrowLayout showLogout>
  12. <h3>{t('Create a New Organization')}</h3>
  13. <p>
  14. {t(
  15. "Organizations represent the top level in your hierarchy. You'll be able to bundle a collection of teams within an organization as well as give organization-wide permissions to users."
  16. )}
  17. </p>
  18. <ApiForm
  19. initialData={{defaultTeam: true}}
  20. submitLabel={t('Create Organization')}
  21. apiEndpoint="/organizations/"
  22. apiMethod="POST"
  23. onSubmitSuccess={data => {
  24. // redirect to project creation *(BYPASS REACT ROUTER AND FORCE PAGE REFRESH TO GRAB CSRF TOKEN)*
  25. // browserHistory.pushState(null, `/organizations/${data.slug}/projects/new/`);
  26. window.location.href = `/organizations/${data.slug}/projects/new/`;
  27. }}
  28. requireChanges
  29. >
  30. <TextField
  31. id="organization-name"
  32. name="name"
  33. label={t('Organization Name')}
  34. placeholder={t('e.g. My Company')}
  35. inline={false}
  36. flexibleControlStateSize
  37. stacked
  38. required
  39. />
  40. {termsUrl && privacyUrl && (
  41. <CheckboxField
  42. id="agreeTerms"
  43. name="agreeTerms"
  44. label={tct(
  45. 'I agree to the [termsLink:Terms of Service] and the [privacyLink:Privacy Policy]',
  46. {
  47. termsLink: <a href={termsUrl} />,
  48. privacyLink: <a href={privacyUrl} />,
  49. }
  50. )}
  51. inline={false}
  52. stacked
  53. required
  54. />
  55. )}
  56. </ApiForm>
  57. </NarrowLayout>
  58. </SentryDocumentTitle>
  59. );
  60. }
  61. export default OrganizationCreate;