organizationCreate.tsx 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. name="agreeTerms"
  43. label={tct(
  44. 'I agree to the [termsLink:Terms of Service] and the [privacyLink:Privacy Policy]',
  45. {
  46. termsLink: <a href={termsUrl} />,
  47. privacyLink: <a href={privacyUrl} />,
  48. }
  49. )}
  50. inline={false}
  51. stacked
  52. required
  53. />
  54. )}
  55. </ApiForm>
  56. </NarrowLayout>
  57. </SentryDocumentTitle>
  58. );
  59. }
  60. export default OrganizationCreate;