routes.tsx 72 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301
  1. import React, {Fragment} from 'react';
  2. import {
  3. IndexRedirect,
  4. IndexRoute as BaseIndexRoute,
  5. IndexRouteProps,
  6. Redirect,
  7. Route as BaseRoute,
  8. RouteProps,
  9. } from 'react-router';
  10. import memoize from 'lodash/memoize';
  11. import LazyLoad from 'sentry/components/lazyLoad';
  12. import {EXPERIMENTAL_SPA, usingCustomerDomain} from 'sentry/constants';
  13. import {t} from 'sentry/locale';
  14. import HookStore from 'sentry/stores/hookStore';
  15. import {HookName} from 'sentry/types/hooks';
  16. import errorHandler from 'sentry/utils/errorHandler';
  17. import withDomainRedirect from 'sentry/utils/withDomainRedirect';
  18. import withDomainRequired from 'sentry/utils/withDomainRequired';
  19. import App from 'sentry/views/app';
  20. import AuthLayout from 'sentry/views/auth/layout';
  21. import {Tab, TabPaths} from 'sentry/views/issueDetails/types';
  22. import IssueListContainer from 'sentry/views/issueList';
  23. import IssueListOverview from 'sentry/views/issueList/overview';
  24. import OrganizationContextContainer from 'sentry/views/organizationContextContainer';
  25. import OrganizationDetails from 'sentry/views/organizationDetails';
  26. import OrganizationRoot from 'sentry/views/organizationRoot';
  27. import ProjectEventRedirect from 'sentry/views/projectEventRedirect';
  28. import redirectDeprecatedProjectRoute from 'sentry/views/projects/redirectDeprecatedProjectRoute';
  29. import RouteNotFound from 'sentry/views/routeNotFound';
  30. import SettingsWrapper from 'sentry/views/settings/components/settingsWrapper';
  31. type CustomProps = {
  32. name?: string;
  33. };
  34. /**
  35. * We add some additional props to our routes
  36. */
  37. const Route = BaseRoute as React.ComponentClass<
  38. React.PropsWithChildren<RouteProps & CustomProps>
  39. >;
  40. const IndexRoute = BaseIndexRoute as React.ComponentClass<IndexRouteProps & CustomProps>;
  41. const hook = (name: HookName) => HookStore.get(name).map(cb => cb());
  42. const SafeLazyLoad = errorHandler(LazyLoad);
  43. // NOTE: makeLazyloadComponent is exported for use in the sentry.io (getsentry)
  44. // pirvate routing tree.
  45. /**
  46. * Factory function to produce a component that will render the SafeLazyLoad
  47. * _with_ the required props.
  48. */
  49. export function makeLazyloadComponent<C extends React.ComponentType<any>>(
  50. resolve: () => Promise<{default: C}>
  51. ) {
  52. // XXX: Assign the component to a variable so it has a displayname
  53. function RouteLazyLoad(props: React.ComponentProps<C>) {
  54. // we can use this hook to set the organization as it's
  55. // a child of the organization context
  56. return <SafeLazyLoad {...props} component={resolve} />;
  57. }
  58. return RouteLazyLoad;
  59. }
  60. // Shorthand to avoid extra line wrapping
  61. const make = makeLazyloadComponent;
  62. function buildRoutes() {
  63. // Read this to understand where to add new routes, how / why the routing
  64. // tree is structured the way it is, and how the lazy-loading /
  65. // code-splitting works for pages.
  66. //
  67. // ## Formatting
  68. //
  69. // NOTE that there are intentionally NO blank lines within route tree blocks.
  70. // This helps make it easier to navigate within the file by using your
  71. // editors shortcuts to jump between 'paragraphs' of code.
  72. //
  73. // [!!] Do NOT add blank lines within route blocks to preserve this behavior!
  74. //
  75. //
  76. // ## Lazy loading
  77. //
  78. // * The `SafeLazyLoad` component
  79. //
  80. // Most routes are rendered as LazyLoad components (SafeLazyLoad is the
  81. // errorHandler wrapped version). This means the rendered component for the
  82. // route will only be loaded when the route is loaded. This helps us
  83. // "code-split" the app.
  84. //
  85. // ## Hooks
  86. //
  87. // There are a number of `hook()` routes placed within the routing tree to
  88. // allow for additional routes to be augmented into the application via the
  89. // hookStore mechanism.
  90. //
  91. //
  92. // ## The structure
  93. //
  94. // * `experimentalSpaRoutes`
  95. //
  96. // These routes are specifically for the experimental single-page-app mode,
  97. // where Sentry is run separate from Django. These are NOT part of the root
  98. // <App /> component.
  99. //
  100. // Right now these are mainly used for authentication pages. In the future
  101. // they would be used for other pages like registration.
  102. //
  103. // * `rootRoutes`
  104. //
  105. // These routes live directly under the <App /> container, and generally
  106. // are not specific to an organization.
  107. //
  108. // * `settingsRoutes`
  109. //
  110. // This is the route tree for all of `/settings/`. This route tree is
  111. // composed of a few different sub-trees.
  112. //
  113. // - `accountSettingsRoutes` User specific settings
  114. // - `orgSettingsRoutes` Specific to a organization
  115. // - `projectSettingsRoutes` Specific to a project
  116. // - `legacySettingsRedirects` Routes that used to exist in settings
  117. //
  118. // * `organizationRoutes`
  119. //
  120. // This is where a majority of the app routes live. This is wrapped with
  121. // the <OrganizationDetails /> component, which provides the sidebar and
  122. // organization context.
  123. //
  124. // When adding new routes make sure you have both a route that starts
  125. // with `/organizations/:orgId` and also 'customer-domains' route that
  126. // does not include `/organizations/:orgId`. Often you'll only need to
  127. // worry about this for the container route for that section of the UI.
  128. // Child routes should access the current organization with `useOrganization()`
  129. // or `withOrganization()` methods.
  130. //
  131. // Within these routes are a variety of subroutes. They are not all
  132. // listed here as the subroutes will be added and removed, and most are
  133. // self explanatory.
  134. //
  135. // * `legacyRedirectRoutes`
  136. //
  137. // This route tree contains <Redirect /> routes for many old legacy paths.
  138. //
  139. // You may also find <Redirect />'s collocated next to the feature routes
  140. // they have redirects for. A good rule here is to place 'helper' redirects
  141. // next to the routes they redirect to, and place 'legacy route' redirects
  142. // for routes that have completely changed in this tree.
  143. const experimentalSpaRoutes = EXPERIMENTAL_SPA ? (
  144. <Route path="/auth/login/" component={errorHandler(AuthLayout)}>
  145. <IndexRoute component={make(() => import('sentry/views/auth/login'))} />
  146. <Route path=":orgId/" component={make(() => import('sentry/views/auth/login'))} />
  147. </Route>
  148. ) : null;
  149. const rootRoutes = (
  150. <Fragment>
  151. <IndexRoute component={make(() => import('sentry/views/app/root'))} />
  152. {hook('routes:root')}
  153. <Route
  154. path="/accept/:orgId/:memberId/:token/"
  155. component={make(() => import('sentry/views/acceptOrganizationInvite'))}
  156. />
  157. <Route
  158. path="/accept/:memberId/:token/"
  159. component={make(() => import('sentry/views/acceptOrganizationInvite'))}
  160. />
  161. <Route
  162. path="/accept-transfer/"
  163. component={make(() => import('sentry/views/acceptProjectTransfer'))}
  164. />
  165. <Route
  166. path="/extensions/external-install/:integrationSlug/:installationId"
  167. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  168. />
  169. <Route
  170. path="/extensions/:integrationSlug/link/"
  171. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  172. />
  173. <Route
  174. path="/sentry-apps/:sentryAppSlug/external-install/"
  175. component={make(() => import('sentry/views/sentryAppExternalInstallation'))}
  176. />
  177. <Redirect from="/account/" to="/settings/account/details/" />
  178. <Redirect from="/share/group/:shareId/" to="/share/issue/:shareId/" />
  179. {/* TODO: remove share/issue orgless url */}
  180. <Route
  181. path="/share/issue/:shareId/"
  182. component={make(() => import('sentry/views/sharedGroupDetails'))}
  183. />
  184. <Route
  185. path="/organizations/:orgId/share/issue/:shareId/"
  186. component={make(() => import('sentry/views/sharedGroupDetails'))}
  187. />
  188. <Route
  189. path="/organizations/new/"
  190. component={make(() => import('sentry/views/organizationCreate'))}
  191. />
  192. {usingCustomerDomain && (
  193. <Route
  194. path="/data-export/:dataExportId"
  195. component={withDomainRequired(
  196. make(() => import('sentry/views/dataExport/dataDownload'))
  197. )}
  198. key="orgless-data-export-route"
  199. />
  200. )}
  201. <Route
  202. path="/organizations/:orgId/data-export/:dataExportId"
  203. component={withDomainRedirect(
  204. make(() => import('sentry/views/dataExport/dataDownload'))
  205. )}
  206. key="org-data-export"
  207. />
  208. {usingCustomerDomain && (
  209. <Route
  210. path="/disabled-member/"
  211. component={withDomainRequired(
  212. make(() => import('sentry/views/disabledMember'))
  213. )}
  214. key="orgless-disabled-member-route"
  215. />
  216. )}
  217. <Route
  218. path="/organizations/:orgId/disabled-member/"
  219. component={withDomainRedirect(make(() => import('sentry/views/disabledMember')))}
  220. key="org-disabled-member"
  221. />
  222. {usingCustomerDomain && (
  223. <Route
  224. path="/join-request/"
  225. component={withDomainRequired(
  226. make(() => import('sentry/views/organizationJoinRequest'))
  227. )}
  228. key="orgless-join-request"
  229. />
  230. )}
  231. <Route
  232. path="/join-request/:orgId/"
  233. component={withDomainRedirect(
  234. make(() => import('sentry/views/organizationJoinRequest'))
  235. )}
  236. key="org-join-request"
  237. />
  238. {usingCustomerDomain && (
  239. <Route
  240. path="/onboarding/"
  241. component={errorHandler(withDomainRequired(OrganizationContextContainer))}
  242. key="orgless-onboarding"
  243. >
  244. <IndexRedirect to="welcome/" />
  245. <Route
  246. path=":step/"
  247. component={make(() => import('sentry/views/onboarding'))}
  248. />
  249. </Route>
  250. )}
  251. <Route
  252. path="/onboarding/:orgId/"
  253. component={withDomainRedirect(errorHandler(OrganizationContextContainer))}
  254. key="org-onboarding"
  255. >
  256. <IndexRedirect to="welcome/" />
  257. <Route path=":step/" component={make(() => import('sentry/views/onboarding'))} />
  258. </Route>
  259. </Fragment>
  260. );
  261. const accountSettingsRoutes = (
  262. <Route
  263. path="account/"
  264. name={t('Account')}
  265. component={make(
  266. () => import('sentry/views/settings/account/accountSettingsLayout')
  267. )}
  268. >
  269. <IndexRedirect to="details/" />
  270. <Route
  271. path="details/"
  272. name={t('Details')}
  273. component={make(() => import('sentry/views/settings/account/accountDetails'))}
  274. />
  275. <Route path="notifications/" name={t('Notifications')}>
  276. <IndexRoute
  277. component={make(
  278. () =>
  279. import('sentry/views/settings/account/notifications/notificationSettings')
  280. )}
  281. />
  282. <Route
  283. path=":fineTuneType/"
  284. name={t('Fine Tune Alerts')}
  285. component={make(
  286. () => import('sentry/views/settings/account/accountNotificationFineTuning')
  287. )}
  288. />
  289. </Route>
  290. <Route
  291. path="emails/"
  292. name={t('Emails')}
  293. component={make(() => import('sentry/views/settings/account/accountEmails'))}
  294. />
  295. <Route
  296. path="authorizations/"
  297. component={make(
  298. () => import('sentry/views/settings/account/accountAuthorizations')
  299. )}
  300. />
  301. <Route path="security/" name={t('Security')}>
  302. <Route
  303. component={make(
  304. () =>
  305. import(
  306. 'sentry/views/settings/account/accountSecurity/accountSecurityWrapper'
  307. )
  308. )}
  309. >
  310. <IndexRoute
  311. component={make(
  312. () => import('sentry/views/settings/account/accountSecurity')
  313. )}
  314. />
  315. <Route
  316. path="session-history/"
  317. name={t('Session History')}
  318. component={make(
  319. () => import('sentry/views/settings/account/accountSecurity/sessionHistory')
  320. )}
  321. />
  322. <Route
  323. path="mfa/:authId/"
  324. name={t('Details')}
  325. component={make(
  326. () =>
  327. import(
  328. 'sentry/views/settings/account/accountSecurity/accountSecurityDetails'
  329. )
  330. )}
  331. />
  332. </Route>
  333. <Route
  334. path="mfa/:authId/enroll/"
  335. name={t('Enroll')}
  336. component={make(
  337. () =>
  338. import(
  339. 'sentry/views/settings/account/accountSecurity/accountSecurityEnroll'
  340. )
  341. )}
  342. />
  343. </Route>
  344. <Route
  345. path="subscriptions/"
  346. name={t('Subscriptions')}
  347. component={make(
  348. () => import('sentry/views/settings/account/accountSubscriptions')
  349. )}
  350. />
  351. <Route
  352. path="identities/"
  353. name={t('Identities')}
  354. component={make(() => import('sentry/views/settings/account/accountIdentities'))}
  355. />
  356. <Route path="api/" name={t('API')}>
  357. <IndexRedirect to="auth-tokens/" />
  358. <Route path="auth-tokens/" name={t('User Auth Tokens')}>
  359. <IndexRoute
  360. component={make(() => import('sentry/views/settings/account/apiTokens'))}
  361. />
  362. <Route
  363. path="new-token/"
  364. name={t('Create New Token')}
  365. component={make(() => import('sentry/views/settings/account/apiNewToken'))}
  366. />
  367. </Route>
  368. <Route path="applications/" name={t('Applications')}>
  369. <IndexRoute
  370. component={make(
  371. () => import('sentry/views/settings/account/apiApplications')
  372. )}
  373. />
  374. <Route
  375. path=":appId/"
  376. name={t('Details')}
  377. component={make(
  378. () => import('sentry/views/settings/account/apiApplications/details')
  379. )}
  380. />
  381. </Route>
  382. {hook('routes:api')}
  383. </Route>
  384. <Route
  385. path="close-account/"
  386. name={t('Close Account')}
  387. component={make(() => import('sentry/views/settings/account/accountClose'))}
  388. />
  389. </Route>
  390. );
  391. const projectSettingsRoutes = (
  392. <Route
  393. path="projects/:projectId/"
  394. name={t('Project')}
  395. component={make(
  396. () => import('sentry/views/settings/project/projectSettingsLayout')
  397. )}
  398. >
  399. <IndexRoute
  400. name={t('General')}
  401. component={make(() => import('sentry/views/settings/projectGeneralSettings'))}
  402. />
  403. <Route
  404. path="teams/"
  405. name={t('Teams')}
  406. component={make(() => import('sentry/views/settings/project/projectTeams'))}
  407. />
  408. <Route
  409. path="alerts/"
  410. name={t('Alerts')}
  411. component={make(() => import('sentry/views/settings/projectAlerts'))}
  412. >
  413. <IndexRoute
  414. component={make(() => import('sentry/views/settings/projectAlerts/settings'))}
  415. />
  416. <Redirect from="new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  417. <Redirect from="rules/" to="/organizations/:orgId/alerts/rules/" />
  418. <Redirect from="rules/new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  419. <Redirect
  420. from="metric-rules/new/"
  421. to="/organizations/:orgId/alerts/:projectId/new/"
  422. />
  423. <Redirect
  424. from="rules/:ruleId/"
  425. to="/organizations/:orgId/alerts/rules/:projectId/:ruleId/"
  426. />
  427. <Redirect
  428. from="metric-rules/:ruleId/"
  429. to="/organizations/:orgId/alerts/metric-rules/:projectId/:ruleId/"
  430. />
  431. </Route>
  432. <Route
  433. path="environments/"
  434. name={t('Environments')}
  435. component={make(
  436. () => import('sentry/views/settings/project/projectEnvironments')
  437. )}
  438. >
  439. <IndexRoute />
  440. <Route path="hidden/" />
  441. </Route>
  442. <Route
  443. path="tags/"
  444. name={t('Tags')}
  445. component={make(() => import('sentry/views/settings/projectTags'))}
  446. />
  447. <Redirect from="issue-tracking/" to="/settings/:orgId/:projectId/plugins/" />
  448. <Route
  449. path="release-tracking/"
  450. name={t('Release Tracking')}
  451. component={make(
  452. () => import('sentry/views/settings/project/projectReleaseTracking')
  453. )}
  454. />
  455. <Route
  456. path="ownership/"
  457. name={t('Ownership Rules')}
  458. component={make(() => import('sentry/views/settings/project/projectOwnership'))}
  459. />
  460. <Route
  461. path="data-forwarding/"
  462. name={t('Data Forwarding')}
  463. component={make(() => import('sentry/views/settings/projectDataForwarding'))}
  464. />
  465. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  466. <IndexRoute
  467. component={make(
  468. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  469. )}
  470. />
  471. <Route
  472. path="advanced-data-scrubbing/:scrubbingId/"
  473. component={make(
  474. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  475. )}
  476. />
  477. </Route>
  478. <Route
  479. path="debug-symbols/"
  480. name={t('Debug Information Files')}
  481. component={make(() => import('sentry/views/settings/projectDebugFiles'))}
  482. />
  483. <Route
  484. path="proguard/"
  485. name={t('ProGuard Mappings')}
  486. component={make(() => import('sentry/views/settings/projectProguard'))}
  487. />
  488. <Route
  489. path="performance/"
  490. name={t('Performance')}
  491. component={make(() => import('sentry/views/settings/projectPerformance'))}
  492. />
  493. <Route path="source-maps/" name={t('Source Maps')}>
  494. <IndexRoute
  495. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  496. />
  497. <Route
  498. path="artifact-bundles/"
  499. name={t('Artifact Bundles')}
  500. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  501. >
  502. <Route
  503. name={t('Artifact Bundle')}
  504. path=":bundleId/"
  505. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  506. />
  507. </Route>
  508. <Route
  509. path="release-bundles/"
  510. name={t('Release Bundles')}
  511. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  512. >
  513. <Route
  514. name={t('Release Bundle')}
  515. path=":bundleId/"
  516. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  517. />
  518. </Route>
  519. <Route
  520. path=":name/"
  521. name={t('Archive')}
  522. component={make(() => import('sentry/views/settings/projectSourceMaps/detail'))}
  523. />
  524. </Route>
  525. <Route
  526. path="processing-issues/"
  527. name={t('Processing Issues')}
  528. component={make(
  529. () => import('sentry/views/settings/project/projectProcessingIssues')
  530. )}
  531. />
  532. <Route
  533. path="filters/"
  534. name={t('Inbound Filters')}
  535. component={make(() => import('sentry/views/settings/project/projectFilters'))}
  536. >
  537. <IndexRedirect to="data-filters/" />
  538. <Route path=":filterType/" />
  539. </Route>
  540. <Redirect from="dynamic-sampling/" to="performance/" />
  541. <Route
  542. path="issue-grouping/"
  543. name={t('Issue Grouping')}
  544. component={make(() => import('sentry/views/settings/projectIssueGrouping'))}
  545. />
  546. <Route
  547. path="hooks/"
  548. name={t('Service Hooks')}
  549. component={make(
  550. () => import('sentry/views/settings/project/projectServiceHooks')
  551. )}
  552. />
  553. <Route
  554. path="hooks/new/"
  555. name={t('Create Service Hook')}
  556. component={make(
  557. () => import('sentry/views/settings/project/projectCreateServiceHook')
  558. )}
  559. />
  560. <Route
  561. path="hooks/:hookId/"
  562. name={t('Service Hook Details')}
  563. component={make(
  564. () => import('sentry/views/settings/project/projectServiceHookDetails')
  565. )}
  566. />
  567. <Route path="keys/" name={t('Client Keys')}>
  568. <IndexRoute
  569. component={make(() => import('sentry/views/settings/project/projectKeys/list'))}
  570. />
  571. <Route
  572. path=":keyId/"
  573. name={t('Details')}
  574. component={make(
  575. () => import('sentry/views/settings/project/projectKeys/details')
  576. )}
  577. />
  578. </Route>
  579. <Route
  580. path="user-feedback/"
  581. name={t('User Feedback')}
  582. component={make(
  583. () => import('sentry/views/settings/project/projectUserFeedback')
  584. )}
  585. />
  586. <Redirect from="csp/" to="security-headers/" />
  587. <Route path="security-headers/" name={t('Security Headers')}>
  588. <IndexRoute
  589. component={make(() => import('sentry/views/settings/projectSecurityHeaders'))}
  590. />
  591. <Route
  592. path="csp/"
  593. name={t('Content Security Policy')}
  594. component={make(
  595. () => import('sentry/views/settings/projectSecurityHeaders/csp')
  596. )}
  597. />
  598. <Route
  599. path="expect-ct/"
  600. name={t('Certificate Transparency')}
  601. component={make(
  602. () => import('sentry/views/settings/projectSecurityHeaders/expectCt')
  603. )}
  604. />
  605. <Route
  606. path="hpkp/"
  607. name={t('HPKP')}
  608. component={make(
  609. () => import('sentry/views/settings/projectSecurityHeaders/hpkp')
  610. )}
  611. />
  612. </Route>
  613. <Route path="plugins/" name={t('Legacy Integrations')}>
  614. <IndexRoute
  615. component={make(() => import('sentry/views/settings/projectPlugins'))}
  616. />
  617. <Route
  618. path=":pluginId/"
  619. name={t('Integration Details')}
  620. component={make(() => import('sentry/views/settings/projectPlugins/details'))}
  621. />
  622. </Route>
  623. </Route>
  624. );
  625. const orgSettingsRoutes = (
  626. <Route
  627. component={make(
  628. () => import('sentry/views/settings/organization/organizationSettingsLayout')
  629. )}
  630. >
  631. {hook('routes:organization')}
  632. {!usingCustomerDomain && (
  633. <IndexRoute
  634. name={t('General')}
  635. component={make(
  636. () => import('sentry/views/settings/organizationGeneralSettings')
  637. )}
  638. />
  639. )}
  640. {usingCustomerDomain && (
  641. <Route
  642. path="/settings/organization/"
  643. name={t('General')}
  644. component={make(
  645. () => import('sentry/views/settings/organizationGeneralSettings')
  646. )}
  647. />
  648. )}
  649. <Route
  650. path="projects/"
  651. name={t('Projects')}
  652. component={make(() => import('sentry/views/settings/organizationProjects'))}
  653. />
  654. <Route path="api-keys/" name={t('API Key')}>
  655. <IndexRoute
  656. component={make(() => import('sentry/views/settings/organizationApiKeys'))}
  657. />
  658. <Route
  659. path=":apiKey/"
  660. name={t('Details')}
  661. component={make(
  662. () =>
  663. import(
  664. 'sentry/views/settings/organizationApiKeys/organizationApiKeyDetails'
  665. )
  666. )}
  667. />
  668. </Route>
  669. <Route
  670. path="audit-log/"
  671. name={t('Audit Log')}
  672. component={make(() => import('sentry/views/settings/organizationAuditLog'))}
  673. />
  674. <Route
  675. path="auth/"
  676. name={t('Auth Providers')}
  677. component={make(() => import('sentry/views/settings/organizationAuth'))}
  678. />
  679. <Redirect from="members/requests" to="members/" />
  680. <Route path="members/" name={t('Members')}>
  681. <Route
  682. component={make(
  683. () =>
  684. import(
  685. 'sentry/views/settings/organizationMembers/organizationMembersWrapper'
  686. )
  687. )}
  688. >
  689. <IndexRoute
  690. component={make(
  691. () =>
  692. import(
  693. 'sentry/views/settings/organizationMembers/organizationMembersList'
  694. )
  695. )}
  696. />
  697. </Route>
  698. <Route
  699. path=":memberId/"
  700. name={t('Details')}
  701. component={make(
  702. () =>
  703. import('sentry/views/settings/organizationMembers/organizationMemberDetail')
  704. )}
  705. />
  706. </Route>
  707. <Route
  708. path="rate-limits/"
  709. name={t('Rate Limits')}
  710. component={make(() => import('sentry/views/settings/organizationRateLimits'))}
  711. />
  712. <Route
  713. path="relay/"
  714. name={t('Relay')}
  715. component={make(() => import('sentry/views/settings/organizationRelay'))}
  716. />
  717. <Route
  718. path="repos/"
  719. name={t('Repositories')}
  720. component={make(() => import('sentry/views/settings/organizationRepositories'))}
  721. />
  722. <Route
  723. path="settings/"
  724. component={make(
  725. () => import('sentry/views/settings/organizationGeneralSettings')
  726. )}
  727. />
  728. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  729. <IndexRoute
  730. component={make(
  731. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  732. )}
  733. />
  734. <Route
  735. path="advanced-data-scrubbing/:scrubbingId/"
  736. component={make(
  737. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  738. )}
  739. />
  740. </Route>
  741. <Route path="teams/" name={t('Teams')}>
  742. <IndexRoute
  743. component={make(() => import('sentry/views/settings/organizationTeams'))}
  744. />
  745. <Route
  746. path=":teamId/"
  747. name={t('Team')}
  748. component={make(
  749. () => import('sentry/views/settings/organizationTeams/teamDetails')
  750. )}
  751. >
  752. <IndexRedirect to="members/" />
  753. <Route
  754. path="members/"
  755. name={t('Members')}
  756. component={make(
  757. () => import('sentry/views/settings/organizationTeams/teamMembers')
  758. )}
  759. />
  760. <Route
  761. path="notifications/"
  762. name={t('Notifications')}
  763. component={make(
  764. () => import('sentry/views/settings/organizationTeams/teamNotifications')
  765. )}
  766. />
  767. <Route
  768. path="projects/"
  769. name={t('Projects')}
  770. component={make(
  771. () => import('sentry/views/settings/organizationTeams/teamProjects')
  772. )}
  773. />
  774. <Route
  775. path="settings/"
  776. name={t('Settings')}
  777. component={make(
  778. () => import('sentry/views/settings/organizationTeams/teamSettings')
  779. )}
  780. />
  781. </Route>
  782. </Route>
  783. <Redirect from="plugins/" to="integrations/" />
  784. <Route path="plugins/" name={t('Integrations')}>
  785. <Route
  786. path=":integrationSlug/"
  787. name={t('Integration Details')}
  788. component={make(
  789. () =>
  790. import('sentry/views/settings/organizationIntegrations/pluginDetailedView')
  791. )}
  792. />
  793. </Route>
  794. <Redirect from="sentry-apps/" to="integrations/" />
  795. <Route path="sentry-apps/" name={t('Integrations')}>
  796. <Route
  797. path=":integrationSlug"
  798. name={t('Details')}
  799. component={make(
  800. () =>
  801. import(
  802. 'sentry/views/settings/organizationIntegrations/sentryAppDetailedView'
  803. )
  804. )}
  805. />
  806. </Route>
  807. <Redirect from="document-integrations/" to="integrations/" />
  808. <Route path="document-integrations/" name={t('Integrations')}>
  809. <Route
  810. path=":integrationSlug"
  811. name={t('Details')}
  812. component={make(
  813. () =>
  814. import(
  815. 'sentry/views/settings/organizationIntegrations/docIntegrationDetailedView'
  816. )
  817. )}
  818. />
  819. </Route>
  820. <Route path="integrations/" name={t('Integrations')}>
  821. <IndexRoute
  822. component={make(
  823. () =>
  824. import(
  825. 'sentry/views/settings/organizationIntegrations/integrationListDirectory'
  826. )
  827. )}
  828. />
  829. <Route
  830. path=":integrationSlug"
  831. name={t('Integration Details')}
  832. component={make(
  833. () =>
  834. import(
  835. 'sentry/views/settings/organizationIntegrations/integrationDetailedView'
  836. )
  837. )}
  838. />
  839. <Route
  840. path=":providerKey/:integrationId/"
  841. name={t('Configure Integration')}
  842. component={make(
  843. () =>
  844. import(
  845. 'sentry/views/settings/organizationIntegrations/configureIntegration'
  846. )
  847. )}
  848. />
  849. </Route>
  850. <Redirect from="developer-settings/sentry-functions/" to="developer-settings/" />
  851. <Route path="developer-settings/" name={t('Developer Settings')}>
  852. <IndexRoute
  853. component={make(
  854. () => import('sentry/views/settings/organizationDeveloperSettings')
  855. )}
  856. />
  857. <Route
  858. path="new-public/"
  859. name={t('Create Integration')}
  860. component={make(
  861. () =>
  862. import(
  863. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  864. )
  865. )}
  866. />
  867. <Route
  868. path="new-internal/"
  869. name={t('Create Integration')}
  870. component={make(
  871. () =>
  872. import(
  873. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  874. )
  875. )}
  876. />
  877. <Route
  878. path=":appSlug/"
  879. name={t('Edit Integration')}
  880. component={make(
  881. () =>
  882. import(
  883. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  884. )
  885. )}
  886. />
  887. <Route
  888. path=":appSlug/dashboard/"
  889. name={t('Integration Dashboard')}
  890. component={make(
  891. () =>
  892. import(
  893. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  894. )
  895. )}
  896. />
  897. <Route path="sentry-functions/" name={t('Sentry Functions')}>
  898. <Route
  899. path="new/"
  900. name={t('Create Sentry Function')}
  901. component={make(
  902. () =>
  903. import(
  904. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  905. )
  906. )}
  907. />
  908. <Route
  909. path=":functionSlug/"
  910. name={t('Edit Sentry Function')}
  911. component={make(
  912. () =>
  913. import(
  914. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  915. )
  916. )}
  917. />
  918. </Route>
  919. </Route>
  920. <Route path="auth-tokens/" name={t('Auth Tokens')}>
  921. <IndexRoute
  922. component={make(() => import('sentry/views/settings/organizationAuthTokens'))}
  923. />
  924. <Route
  925. path="new-token/"
  926. name={t('Create New Auth Token')}
  927. component={make(
  928. () => import('sentry/views/settings/organizationAuthTokens/newAuthToken')
  929. )}
  930. />
  931. <Route
  932. path=":tokenId/"
  933. name={t('Edit Auth Token')}
  934. component={make(
  935. () => import('sentry/views/settings/organizationAuthTokens/authTokenDetails')
  936. )}
  937. />
  938. </Route>
  939. </Route>
  940. );
  941. const legacySettingsRedirects = (
  942. <Fragment>
  943. <Redirect from=":projectId/" to="projects/:projectId/" />
  944. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  945. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  946. <Redirect
  947. from=":projectId/alerts/rules/:ruleId/"
  948. to="projects/:projectId/alerts/rules/:ruleId/"
  949. />
  950. </Fragment>
  951. );
  952. const settingsRoutes = (
  953. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  954. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  955. {accountSettingsRoutes}
  956. <Fragment>
  957. {usingCustomerDomain && (
  958. <Route
  959. name={t('Organization')}
  960. component={withDomainRequired(NoOp)}
  961. key="orgless-settings-route"
  962. >
  963. {orgSettingsRoutes}
  964. {projectSettingsRoutes}
  965. </Route>
  966. )}
  967. <Route
  968. path=":orgId/"
  969. name={t('Organization')}
  970. component={withDomainRedirect(NoOp)}
  971. key="org-settings"
  972. >
  973. {orgSettingsRoutes}
  974. {projectSettingsRoutes}
  975. {legacySettingsRedirects}
  976. </Route>
  977. </Fragment>
  978. </Route>
  979. );
  980. const projectsChildRoutes = (
  981. <Fragment>
  982. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  983. <Route
  984. path="new/"
  985. component={make(() => import('sentry/views/projectInstall/newProject'))}
  986. />
  987. <Route
  988. path=":projectId/"
  989. component={make(() => import('sentry/views/projectDetail'))}
  990. />
  991. <Route
  992. path=":projectId/events/:eventId/"
  993. component={errorHandler(ProjectEventRedirect)}
  994. />
  995. <Route
  996. path=":projectId/getting-started/"
  997. component={make(
  998. () => import('sentry/views/projectInstall/platformOrIntegration')
  999. )}
  1000. />
  1001. </Fragment>
  1002. );
  1003. const projectsRoutes = (
  1004. <Fragment>
  1005. {usingCustomerDomain && (
  1006. <Route
  1007. path="/projects/"
  1008. component={make(() => import('sentry/views/projects/'))}
  1009. key="orgless-projects-route"
  1010. >
  1011. {projectsChildRoutes}
  1012. </Route>
  1013. )}
  1014. <Route
  1015. path="/organizations/:orgId/projects/"
  1016. component={make(() => import('sentry/views/projects/'))}
  1017. key="org-projects"
  1018. >
  1019. {projectsChildRoutes}
  1020. </Route>
  1021. </Fragment>
  1022. );
  1023. const dashboardWidgetRoutes = (
  1024. <Fragment>
  1025. <Route
  1026. path="widget/:widgetIndex/edit/"
  1027. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1028. />
  1029. <Route
  1030. path="widget/new/"
  1031. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1032. />
  1033. <Route
  1034. path="widget/:widgetId/"
  1035. component={make(() => import('sentry/views/dashboards/view'))}
  1036. />
  1037. </Fragment>
  1038. );
  1039. const dashboardRoutes = (
  1040. <Fragment>
  1041. <Fragment>
  1042. {usingCustomerDomain && (
  1043. <Route
  1044. path="/dashboards/"
  1045. component={withDomainRequired(make(() => import('sentry/views/dashboards')))}
  1046. key="orgless-dashboards-route"
  1047. >
  1048. <IndexRoute
  1049. component={make(() => import('sentry/views/dashboards/manage'))}
  1050. />
  1051. </Route>
  1052. )}
  1053. <Route
  1054. path="/organizations/:orgId/dashboards/"
  1055. component={withDomainRedirect(make(() => import('sentry/views/dashboards')))}
  1056. key="org-dashboards"
  1057. >
  1058. <IndexRoute component={make(() => import('sentry/views/dashboards/manage'))} />
  1059. </Route>
  1060. </Fragment>
  1061. <Fragment>
  1062. {usingCustomerDomain && (
  1063. <Route
  1064. path="/dashboards/new/"
  1065. component={withDomainRequired(
  1066. make(() => import('sentry/views/dashboards/create'))
  1067. )}
  1068. key="orgless-dashboards-new-route"
  1069. >
  1070. <Route
  1071. path="widget/:widgetIndex/edit/"
  1072. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1073. />
  1074. <Route
  1075. path="widget/new/"
  1076. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1077. />
  1078. </Route>
  1079. )}
  1080. <Route
  1081. path="/organizations/:orgId/dashboards/new/"
  1082. component={withDomainRedirect(
  1083. make(() => import('sentry/views/dashboards/create'))
  1084. )}
  1085. key="org-dashboards-new"
  1086. >
  1087. <Route
  1088. path="widget/:widgetIndex/edit/"
  1089. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1090. />
  1091. <Route
  1092. path="widget/new/"
  1093. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1094. />
  1095. </Route>
  1096. </Fragment>
  1097. <Fragment>
  1098. {usingCustomerDomain && (
  1099. <Route
  1100. path="/dashboards/new/:templateId"
  1101. component={withDomainRequired(
  1102. make(() => import('sentry/views/dashboards/create'))
  1103. )}
  1104. key="orgless-dashboards-new-template-route"
  1105. >
  1106. <Route
  1107. path="widget/:widgetId/"
  1108. component={make(() => import('sentry/views/dashboards/create'))}
  1109. />
  1110. </Route>
  1111. )}
  1112. <Route
  1113. path="/organizations/:orgId/dashboards/new/:templateId"
  1114. component={withDomainRedirect(
  1115. make(() => import('sentry/views/dashboards/create'))
  1116. )}
  1117. key="org-dashboards-new-template"
  1118. >
  1119. <Route
  1120. path="widget/:widgetId/"
  1121. component={make(() => import('sentry/views/dashboards/create'))}
  1122. />
  1123. </Route>
  1124. </Fragment>
  1125. <Redirect
  1126. from="/organizations/:orgId/dashboards/:dashboardId/"
  1127. to="/organizations/:orgId/dashboard/:dashboardId/"
  1128. />
  1129. {usingCustomerDomain && (
  1130. <Redirect from="/dashboards/:dashboardId/" to="/dashboard/:dashboardId/" />
  1131. )}
  1132. <Fragment>
  1133. {usingCustomerDomain && (
  1134. <Route
  1135. path="/dashboard/:dashboardId/"
  1136. component={withDomainRequired(
  1137. make(() => import('sentry/views/dashboards/view'))
  1138. )}
  1139. key="orgless-dashboards-dashboard-id-route"
  1140. >
  1141. {dashboardWidgetRoutes}
  1142. </Route>
  1143. )}
  1144. <Route
  1145. path="/organizations/:orgId/dashboard/:dashboardId/"
  1146. component={withDomainRedirect(
  1147. make(() => import('sentry/views/dashboards/view'))
  1148. )}
  1149. key="org-dashboards-dashboard-id"
  1150. >
  1151. {dashboardWidgetRoutes}
  1152. </Route>
  1153. </Fragment>
  1154. </Fragment>
  1155. );
  1156. const alertChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1157. return (
  1158. <Fragment>
  1159. <IndexRoute
  1160. component={make(() => import('sentry/views/alerts/list/incidents'))}
  1161. />
  1162. <Route path="rules/">
  1163. <IndexRoute component={make(() => import('sentry/views/alerts/list/rules'))} />
  1164. <Route
  1165. path="details/:ruleId/"
  1166. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  1167. />
  1168. <Route
  1169. path=":projectId/"
  1170. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1171. >
  1172. <IndexRedirect
  1173. to={
  1174. forCustomerDomain
  1175. ? '/alerts/rules/'
  1176. : '/organizations/:orgId/alerts/rules/'
  1177. }
  1178. />
  1179. <Route
  1180. path=":ruleId/"
  1181. component={make(() => import('sentry/views/alerts/edit'))}
  1182. />
  1183. </Route>
  1184. <Route path=":projectId/:ruleId/details/">
  1185. <IndexRoute
  1186. component={make(
  1187. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  1188. )}
  1189. />
  1190. </Route>
  1191. </Route>
  1192. <Route path="metric-rules/">
  1193. <IndexRedirect
  1194. to={
  1195. forCustomerDomain ? '/alerts/rules/' : '/organizations/:orgId/alerts/rules/'
  1196. }
  1197. />
  1198. <Route
  1199. path=":projectId/"
  1200. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1201. >
  1202. <IndexRedirect
  1203. to={
  1204. forCustomerDomain
  1205. ? '/alerts/rules/'
  1206. : '/organizations/:orgId/alerts/rules/'
  1207. }
  1208. />
  1209. <Route
  1210. path=":ruleId/"
  1211. component={make(() => import('sentry/views/alerts/edit'))}
  1212. />
  1213. </Route>
  1214. </Route>
  1215. <Route
  1216. path="wizard/"
  1217. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1218. >
  1219. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  1220. </Route>
  1221. <Route
  1222. path="new/"
  1223. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1224. >
  1225. <IndexRedirect
  1226. to={
  1227. forCustomerDomain
  1228. ? '/alerts/wizard/'
  1229. : '/organizations/:orgId/alerts/wizard/'
  1230. }
  1231. />
  1232. <Route
  1233. path=":alertType/"
  1234. component={make(() => import('sentry/views/alerts/create'))}
  1235. />
  1236. </Route>
  1237. <Route
  1238. path=":alertId/"
  1239. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1240. />
  1241. <Route
  1242. path=":projectId/"
  1243. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1244. >
  1245. <Route
  1246. path="new/"
  1247. component={make(() => import('sentry/views/alerts/create'))}
  1248. />
  1249. <Route
  1250. path="wizard/"
  1251. component={make(() => import('sentry/views/alerts/wizard'))}
  1252. />
  1253. </Route>
  1254. </Fragment>
  1255. );
  1256. };
  1257. const alertRoutes = (
  1258. <Fragment>
  1259. {usingCustomerDomain && (
  1260. <Route
  1261. path="/alerts/"
  1262. component={withDomainRequired(make(() => import('sentry/views/alerts')))}
  1263. key="orgless-alerts-route"
  1264. >
  1265. {alertChildRoutes({forCustomerDomain: true})}
  1266. </Route>
  1267. )}
  1268. <Route
  1269. path="/organizations/:orgId/alerts/"
  1270. component={withDomainRedirect(make(() => import('sentry/views/alerts')))}
  1271. key="org-alerts"
  1272. >
  1273. {alertChildRoutes({forCustomerDomain: false})}
  1274. </Route>
  1275. </Fragment>
  1276. );
  1277. const cronsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1278. return (
  1279. <Fragment>
  1280. <IndexRoute component={make(() => import('sentry/views/monitors/overview'))} />
  1281. <Route
  1282. path={
  1283. forCustomerDomain ? '/crons/create/' : '/organizations/:orgId/crons/create/'
  1284. }
  1285. component={make(() => import('sentry/views/monitors/create'))}
  1286. key={forCustomerDomain ? 'orgless-monitors-create' : 'org-monitors-create'}
  1287. />
  1288. <Route
  1289. path={
  1290. forCustomerDomain
  1291. ? '/crons/:monitorSlug/'
  1292. : '/organizations/:orgId/crons/:monitorSlug/'
  1293. }
  1294. component={make(() => import('sentry/views/monitors/details'))}
  1295. key={
  1296. forCustomerDomain ? 'orgless-monitors-monitor-id' : 'org-monitors-monitor-id'
  1297. }
  1298. />
  1299. <Route
  1300. path={
  1301. forCustomerDomain
  1302. ? '/crons/:monitorSlug/edit/'
  1303. : '/organizations/:orgId/crons/:monitorSlug/edit/'
  1304. }
  1305. component={make(() => import('sentry/views/monitors/edit'))}
  1306. key={forCustomerDomain ? 'orgless-monitors-edit' : 'org-monitors-edit'}
  1307. />
  1308. </Fragment>
  1309. );
  1310. };
  1311. const cronsRoutes = (
  1312. <Fragment>
  1313. {usingCustomerDomain && (
  1314. <Route
  1315. path="/crons/"
  1316. component={withDomainRequired(make(() => import('sentry/views/monitors')))}
  1317. key="orgless-monitors-route"
  1318. >
  1319. {cronsChildRoutes({forCustomerDomain: true})}
  1320. </Route>
  1321. )}
  1322. <Route
  1323. path="/organizations/:orgId/crons/"
  1324. component={withDomainRedirect(make(() => import('sentry/views/monitors')))}
  1325. key="org-monitors"
  1326. >
  1327. {cronsChildRoutes({forCustomerDomain: false})}
  1328. </Route>
  1329. </Fragment>
  1330. );
  1331. const replayChildRoutes = (
  1332. <Fragment>
  1333. <IndexRoute component={make(() => import('sentry/views/replays/list'))} />
  1334. <Route
  1335. path=":replaySlug/"
  1336. component={make(() => import('sentry/views/replays/details'))}
  1337. />
  1338. </Fragment>
  1339. );
  1340. const replayRoutes = (
  1341. <Fragment>
  1342. {usingCustomerDomain && (
  1343. <Route
  1344. path="/replays/"
  1345. component={withDomainRequired(make(() => import('sentry/views/replays/index')))}
  1346. key="orgless-replays-route"
  1347. >
  1348. {replayChildRoutes}
  1349. </Route>
  1350. )}
  1351. <Route
  1352. path="/organizations/:orgId/replays/"
  1353. component={withDomainRedirect(make(() => import('sentry/views/replays/index')))}
  1354. key="org-replays"
  1355. >
  1356. {replayChildRoutes}
  1357. </Route>
  1358. </Fragment>
  1359. );
  1360. const releasesChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1361. return (
  1362. <Fragment>
  1363. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1364. <Route
  1365. path=":release/"
  1366. component={make(() => import('sentry/views/releases/detail'))}
  1367. >
  1368. <IndexRoute
  1369. component={make(() => import('sentry/views/releases/detail/overview'))}
  1370. />
  1371. <Route
  1372. path="commits/"
  1373. component={make(
  1374. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1375. )}
  1376. />
  1377. <Route
  1378. path="files-changed/"
  1379. component={make(
  1380. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1381. )}
  1382. />
  1383. {forCustomerDomain ? null : (
  1384. <Fragment>
  1385. <Redirect
  1386. from="new-events/"
  1387. to="/organizations/:orgId/releases/:release/"
  1388. />
  1389. <Redirect
  1390. from="all-events/"
  1391. to="/organizations/:orgId/releases/:release/"
  1392. />
  1393. </Fragment>
  1394. )}
  1395. </Route>
  1396. </Fragment>
  1397. );
  1398. };
  1399. const releasesRoutes = (
  1400. <Fragment>
  1401. {usingCustomerDomain && (
  1402. <Route
  1403. path="/releases/"
  1404. component={withDomainRequired(NoOp)}
  1405. key="orgless-releases-route"
  1406. >
  1407. {releasesChildRoutes({forCustomerDomain: true})}
  1408. </Route>
  1409. )}
  1410. <Route
  1411. path="/organizations/:orgId/releases/"
  1412. component={withDomainRedirect(NoOp)}
  1413. key="org-releases"
  1414. >
  1415. {releasesChildRoutes({forCustomerDomain: false})}
  1416. </Route>
  1417. </Fragment>
  1418. );
  1419. const activityRoutes = (
  1420. <Fragment>
  1421. {usingCustomerDomain && (
  1422. <Route
  1423. path="/activity/"
  1424. component={withDomainRequired(
  1425. make(() => import('sentry/views/organizationActivity'))
  1426. )}
  1427. key="orgless-activity-route"
  1428. />
  1429. )}
  1430. <Route
  1431. path="/organizations/:orgId/activity/"
  1432. component={withDomainRedirect(
  1433. make(() => import('sentry/views/organizationActivity'))
  1434. )}
  1435. key="org-activity"
  1436. />
  1437. </Fragment>
  1438. );
  1439. const statsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1440. return (
  1441. <Fragment>
  1442. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1443. <Route
  1444. path="issues/"
  1445. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1446. >
  1447. <IndexRoute
  1448. component={make(
  1449. () => import('sentry/views/organizationStats/teamInsights/issues')
  1450. )}
  1451. />
  1452. </Route>
  1453. <Route
  1454. path="health/"
  1455. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1456. >
  1457. <IndexRoute
  1458. component={make(
  1459. () => import('sentry/views/organizationStats/teamInsights/health')
  1460. )}
  1461. />
  1462. </Route>
  1463. {forCustomerDomain ? null : (
  1464. <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
  1465. )}
  1466. </Fragment>
  1467. );
  1468. };
  1469. const statsRoutes = (
  1470. <Fragment>
  1471. {usingCustomerDomain && (
  1472. <Route
  1473. path="/stats/"
  1474. component={withDomainRequired(NoOp)}
  1475. key="orgless-stats-route"
  1476. >
  1477. {statsChildRoutes({forCustomerDomain: true})}
  1478. </Route>
  1479. )}
  1480. <Route
  1481. path="/organizations/:orgId/stats/"
  1482. component={withDomainRedirect(NoOp)}
  1483. key="org-stats"
  1484. >
  1485. {statsChildRoutes({forCustomerDomain: false})}
  1486. </Route>
  1487. </Fragment>
  1488. );
  1489. // TODO(mark) Long term this /queries route should go away and /discover
  1490. // should be the canonical route for discover2. We have a redirect right now
  1491. // as /discover was for discover 1 and most of the application is linking to
  1492. // /discover/queries and not /discover
  1493. const discoverChildRoutes = (
  1494. <Fragment>
  1495. <IndexRedirect to="queries/" />
  1496. <Route
  1497. path="homepage/"
  1498. component={make(() => import('sentry/views/discover/homepage'))}
  1499. />
  1500. <Route
  1501. path="queries/"
  1502. component={make(() => import('sentry/views/discover/landing'))}
  1503. />
  1504. <Route
  1505. path="results/"
  1506. component={make(() => import('sentry/views/discover/results'))}
  1507. />
  1508. <Route
  1509. path=":eventSlug/"
  1510. component={make(() => import('sentry/views/discover/eventDetails'))}
  1511. />
  1512. </Fragment>
  1513. );
  1514. const discoverRoutes = (
  1515. <Fragment>
  1516. {usingCustomerDomain && (
  1517. <Route
  1518. path="/discover/"
  1519. component={withDomainRequired(make(() => import('sentry/views/discover')))}
  1520. key="orgless-discover-route"
  1521. >
  1522. {discoverChildRoutes}
  1523. </Route>
  1524. )}
  1525. <Route
  1526. path="/organizations/:orgId/discover/"
  1527. component={withDomainRedirect(make(() => import('sentry/views/discover')))}
  1528. key="org-discover-route"
  1529. >
  1530. {discoverChildRoutes}
  1531. </Route>
  1532. </Fragment>
  1533. );
  1534. const performanceChildRoutes = (
  1535. <Fragment>
  1536. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1537. <Route
  1538. path="trends/"
  1539. component={make(() => import('sentry/views/performance/trends'))}
  1540. />
  1541. <Route path="summary/">
  1542. <IndexRoute
  1543. component={make(
  1544. () =>
  1545. import('sentry/views/performance/transactionSummary/transactionOverview')
  1546. )}
  1547. />
  1548. <Route
  1549. path="replays/"
  1550. component={make(
  1551. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1552. )}
  1553. />
  1554. <Route
  1555. path="vitals/"
  1556. component={make(
  1557. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1558. )}
  1559. />
  1560. <Route
  1561. path="tags/"
  1562. component={make(
  1563. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1564. )}
  1565. />
  1566. <Route
  1567. path="events/"
  1568. component={make(
  1569. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1570. )}
  1571. />
  1572. <Route
  1573. path="anomalies/"
  1574. component={make(
  1575. () =>
  1576. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1577. )}
  1578. />
  1579. <Route
  1580. path="profiles/"
  1581. component={make(
  1582. () =>
  1583. import('sentry/views/performance/transactionSummary/transactionProfiles')
  1584. )}
  1585. />
  1586. <Route path="spans/">
  1587. <IndexRoute
  1588. component={make(
  1589. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1590. )}
  1591. />
  1592. <Route
  1593. path=":spanSlug/"
  1594. component={make(
  1595. () =>
  1596. import(
  1597. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1598. )
  1599. )}
  1600. />
  1601. </Route>
  1602. </Route>
  1603. <Route
  1604. path="vitaldetail/"
  1605. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1606. />
  1607. <Route
  1608. path="trace/:traceSlug/"
  1609. component={make(() => import('sentry/views/performance/traceDetails'))}
  1610. />
  1611. <Route
  1612. path=":eventSlug/"
  1613. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1614. />
  1615. </Fragment>
  1616. );
  1617. const performanceRoutes = (
  1618. <Fragment>
  1619. {usingCustomerDomain && (
  1620. <Route
  1621. path="/performance/"
  1622. component={withDomainRequired(make(() => import('sentry/views/performance')))}
  1623. key="orgless-performance-route"
  1624. >
  1625. {performanceChildRoutes}
  1626. </Route>
  1627. )}
  1628. <Route
  1629. path="/organizations/:orgId/performance/"
  1630. component={withDomainRedirect(make(() => import('sentry/views/performance')))}
  1631. key="org-performance"
  1632. >
  1633. {performanceChildRoutes}
  1634. </Route>
  1635. </Fragment>
  1636. );
  1637. const starfishChildRoutes = (
  1638. <Fragment>
  1639. <IndexRoute
  1640. component={make(() => import('sentry/views/starfish/views/webServiceView'))}
  1641. />
  1642. <Route
  1643. path="failure-detail/:slug/"
  1644. component={make(
  1645. () => import('sentry/views/starfish/views/webServiceView/endpointFailureEvents')
  1646. )}
  1647. />
  1648. <Route
  1649. path="endpoint-overview/"
  1650. component={make(
  1651. () => import('sentry/views/starfish/views/webServiceView/endpointOverview')
  1652. )}
  1653. />
  1654. <Route
  1655. path="database/"
  1656. component={make(() => import('sentry/views/starfish/modules/DBModule'))}
  1657. />
  1658. <Route
  1659. path="definitions/"
  1660. component={make(() => import('sentry/views/starfish/views/definitionsView'))}
  1661. />
  1662. <Route
  1663. path="api/"
  1664. component={make(() => import('sentry/views/starfish/modules/HTTPModule'))}
  1665. />
  1666. <Route
  1667. path="spans/"
  1668. component={make(() => import('sentry/views/starfish/views/spans'))}
  1669. />
  1670. <Route
  1671. path="span/:groupId/"
  1672. component={make(() => import('sentry/views/starfish/views/spanSummaryPage'))}
  1673. />
  1674. </Fragment>
  1675. );
  1676. const starfishRoutes = (
  1677. <Fragment>
  1678. {usingCustomerDomain && (
  1679. <Route
  1680. path="/starfish/"
  1681. component={withDomainRequired(make(() => import('sentry/views/starfish')))}
  1682. key="orgless-starfish-route"
  1683. >
  1684. {starfishChildRoutes}
  1685. </Route>
  1686. )}
  1687. <Route
  1688. path="/organizations/:orgId/starfish/"
  1689. component={withDomainRedirect(make(() => import('sentry/views/starfish/')))}
  1690. key="org-starfish"
  1691. >
  1692. {starfishChildRoutes}
  1693. </Route>
  1694. </Fragment>
  1695. );
  1696. const userFeedbackRoutes = (
  1697. <Fragment>
  1698. {usingCustomerDomain && (
  1699. <Route
  1700. path="/user-feedback/"
  1701. component={withDomainRequired(make(() => import('sentry/views/userFeedback')))}
  1702. key="orgless-user-feedback-route"
  1703. />
  1704. )}
  1705. <Route
  1706. path="/organizations/:orgId/user-feedback/"
  1707. component={withDomainRedirect(make(() => import('sentry/views/userFeedback')))}
  1708. key="org-user-feedback"
  1709. />
  1710. </Fragment>
  1711. );
  1712. const issueListRoutes = (
  1713. <Fragment>
  1714. {usingCustomerDomain && (
  1715. <Route
  1716. path="/issues/(searches/:searchId/)"
  1717. component={withDomainRequired(errorHandler(IssueListContainer))}
  1718. key="orgless-issues-route"
  1719. >
  1720. <IndexRoute component={errorHandler(IssueListOverview)} />
  1721. </Route>
  1722. )}
  1723. <Route
  1724. path="/organizations/:orgId/issues/(searches/:searchId/)"
  1725. component={withDomainRedirect(errorHandler(IssueListContainer))}
  1726. key="org-issues"
  1727. >
  1728. <Redirect from="/organizations/:orgId/" to="/organizations/:orgId/issues/" />
  1729. <IndexRoute component={errorHandler(IssueListOverview)} />
  1730. </Route>
  1731. </Fragment>
  1732. );
  1733. // Once org issues is complete, these routes can be nested under
  1734. // /organizations/:orgId/issues
  1735. const issueTabs = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1736. const hoc = forCustomerDomain ? withDomainRequired : x => x;
  1737. return (
  1738. <Fragment>
  1739. <IndexRoute
  1740. component={hoc(
  1741. make(() => import('sentry/views/issueDetails/groupEventDetails'))
  1742. )}
  1743. />
  1744. <Route
  1745. path={TabPaths[Tab.REPLAYS]}
  1746. component={hoc(make(() => import('sentry/views/issueDetails/groupReplays')))}
  1747. />
  1748. <Route
  1749. path={TabPaths[Tab.ACTIVITY]}
  1750. component={hoc(make(() => import('sentry/views/issueDetails/groupActivity')))}
  1751. />
  1752. <Route
  1753. path={TabPaths[Tab.EVENTS]}
  1754. component={hoc(make(() => import('sentry/views/issueDetails/groupEvents')))}
  1755. />
  1756. <Route
  1757. path={TabPaths[Tab.TAGS]}
  1758. component={hoc(make(() => import('sentry/views/issueDetails/groupTags')))}
  1759. />
  1760. <Route
  1761. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1762. component={make(() => import('sentry/views/issueDetails/groupTagValues'))}
  1763. />
  1764. <Route
  1765. path={TabPaths[Tab.USER_FEEDBACK]}
  1766. component={hoc(
  1767. make(() => import('sentry/views/issueDetails/groupUserFeedback'))
  1768. )}
  1769. />
  1770. <Route
  1771. path={TabPaths[Tab.ATTACHMENTS]}
  1772. component={hoc(
  1773. make(() => import('sentry/views/issueDetails/groupEventAttachments'))
  1774. )}
  1775. />
  1776. <Route
  1777. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1778. component={hoc(
  1779. make(() => import('sentry/views/issueDetails/groupSimilarIssues'))
  1780. )}
  1781. />
  1782. <Route
  1783. path={TabPaths[Tab.MERGED]}
  1784. component={hoc(make(() => import('sentry/views/issueDetails/groupMerged')))}
  1785. />
  1786. <Route
  1787. path={TabPaths[Tab.GROUPING]}
  1788. component={hoc(make(() => import('sentry/views/issueDetails/grouping')))}
  1789. />
  1790. </Fragment>
  1791. );
  1792. };
  1793. const issueDetailsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => (
  1794. <Fragment>
  1795. {issueTabs({forCustomerDomain})}
  1796. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  1797. {issueTabs({forCustomerDomain})}
  1798. </Route>
  1799. </Fragment>
  1800. );
  1801. const issueDetailsRoutes = (
  1802. <Fragment>
  1803. <Route
  1804. path="/organizations/:orgId/issues/:groupId/"
  1805. component={withDomainRedirect(make(() => import('sentry/views/issueDetails')))}
  1806. key="org-issues-group-id"
  1807. >
  1808. {issueDetailsChildRoutes({forCustomerDomain: false})}
  1809. </Route>
  1810. {usingCustomerDomain && (
  1811. <Route
  1812. path="/issues/:groupId/"
  1813. component={withDomainRequired(make(() => import('sentry/views/issueDetails')))}
  1814. key="orgless-issues-group-id-route"
  1815. >
  1816. {issueDetailsChildRoutes({forCustomerDomain: true})}
  1817. </Route>
  1818. )}
  1819. </Fragment>
  1820. );
  1821. // These are the "manage" pages. For sentry.io, these are _different_ from
  1822. // the SaaS admin routes in getsentry.
  1823. const adminManageRoutes = (
  1824. <Route
  1825. path="/manage/"
  1826. component={make(() => import('sentry/views/admin/adminLayout'))}
  1827. >
  1828. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1829. <Route
  1830. path="buffer/"
  1831. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1832. />
  1833. <Route
  1834. path="relays/"
  1835. component={make(() => import('sentry/views/admin/adminRelays'))}
  1836. />
  1837. <Route
  1838. path="organizations/"
  1839. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1840. />
  1841. <Route
  1842. path="projects/"
  1843. component={make(() => import('sentry/views/admin/adminProjects'))}
  1844. />
  1845. <Route
  1846. path="queue/"
  1847. component={make(() => import('sentry/views/admin/adminQueue'))}
  1848. />
  1849. <Route
  1850. path="quotas/"
  1851. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1852. />
  1853. <Route
  1854. path="settings/"
  1855. component={make(() => import('sentry/views/admin/adminSettings'))}
  1856. />
  1857. <Route path="users/">
  1858. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1859. <Route
  1860. path=":id"
  1861. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1862. />
  1863. </Route>
  1864. <Route
  1865. path="status/mail/"
  1866. component={make(() => import('sentry/views/admin/adminMail'))}
  1867. />
  1868. <Route
  1869. path="status/environment/"
  1870. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1871. />
  1872. <Route
  1873. path="status/packages/"
  1874. component={make(() => import('sentry/views/admin/adminPackages'))}
  1875. />
  1876. <Route
  1877. path="status/warnings/"
  1878. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1879. />
  1880. </Route>
  1881. );
  1882. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1883. // me why we need the OrganizationRoot root container.
  1884. const legacyOrganizationRootRoutes = (
  1885. <Route component={errorHandler(OrganizationRoot)}>
  1886. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  1887. <Route path="/organizations/:orgId/">
  1888. {hook('routes:organization')}
  1889. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  1890. <Redirect
  1891. from="/organizations/:orgId/teams/your-teams/"
  1892. to="/settings/:orgId/teams/"
  1893. />
  1894. <Redirect
  1895. from="/organizations/:orgId/teams/all-teams/"
  1896. to="/settings/:orgId/teams/"
  1897. />
  1898. <Redirect
  1899. from="/organizations/:orgId/teams/:teamId/"
  1900. to="/settings/:orgId/teams/:teamId/"
  1901. />
  1902. <Redirect
  1903. from="/organizations/:orgId/teams/:teamId/members/"
  1904. to="/settings/:orgId/teams/:teamId/members/"
  1905. />
  1906. <Redirect
  1907. from="/organizations/:orgId/teams/:teamId/projects/"
  1908. to="/settings/:orgId/teams/:teamId/projects/"
  1909. />
  1910. <Redirect
  1911. from="/organizations/:orgId/teams/:teamId/settings/"
  1912. to="/settings/:orgId/teams/:teamId/settings/"
  1913. />
  1914. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  1915. <Redirect
  1916. from="/organizations/:orgId/api-keys/"
  1917. to="/settings/:orgId/api-keys/"
  1918. />
  1919. <Redirect
  1920. from="/organizations/:orgId/api-keys/:apiKey/"
  1921. to="/settings/:orgId/api-keys/:apiKey/"
  1922. />
  1923. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  1924. <Redirect
  1925. from="/organizations/:orgId/members/:memberId/"
  1926. to="/settings/:orgId/members/:memberId/"
  1927. />
  1928. <Redirect
  1929. from="/organizations/:orgId/rate-limits/"
  1930. to="/settings/:orgId/rate-limits/"
  1931. />
  1932. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  1933. </Route>
  1934. </Route>
  1935. );
  1936. const gettingStartedRoutes = (
  1937. <Fragment>
  1938. {usingCustomerDomain && (
  1939. <Fragment>
  1940. <Redirect
  1941. from="/getting-started/:projectId/"
  1942. to="/projects/:projectId/getting-started/"
  1943. />
  1944. <Redirect
  1945. from="/getting-started/:projectId/:platform/"
  1946. to="/projects/:projectId/getting-started/"
  1947. />
  1948. </Fragment>
  1949. )}
  1950. <Redirect
  1951. from="/:orgId/:projectId/getting-started/"
  1952. to="/organizations/:orgId/projects/:projectId/getting-started/"
  1953. />
  1954. <Redirect
  1955. from="/:orgId/:projectId/getting-started/:platform/"
  1956. to="/organizations/:orgId/projects/:projectId/getting-started/"
  1957. />
  1958. </Fragment>
  1959. );
  1960. const profilingChildRoutes = (
  1961. <Fragment>
  1962. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  1963. <Route
  1964. path="summary/:projectId/"
  1965. component={make(() => import('sentry/views/profiling/profileSummary'))}
  1966. />
  1967. <Route
  1968. path="profile/:projectId/:eventId/"
  1969. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  1970. >
  1971. <Route
  1972. path="flamechart/"
  1973. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  1974. />
  1975. </Route>
  1976. </Fragment>
  1977. );
  1978. const profilingRoutes = (
  1979. <Fragment>
  1980. {usingCustomerDomain && (
  1981. <Route
  1982. path="/profiling/"
  1983. component={withDomainRequired(make(() => import('sentry/views/profiling')))}
  1984. key="orgless-profiling-route"
  1985. >
  1986. {profilingChildRoutes}
  1987. </Route>
  1988. )}
  1989. <Route
  1990. path="/organizations/:orgId/profiling/"
  1991. component={withDomainRedirect(make(() => import('sentry/views/profiling')))}
  1992. key="org-profiling"
  1993. >
  1994. {profilingChildRoutes}
  1995. </Route>
  1996. </Fragment>
  1997. );
  1998. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  1999. // canonical URLs.
  2000. //
  2001. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  2002. // or do these need to be nested into the OrganizationDetails tree?
  2003. const legacyOrgRedirects = (
  2004. <Route path="/:orgId/:projectId/">
  2005. <IndexRoute
  2006. component={errorHandler(
  2007. redirectDeprecatedProjectRoute(
  2008. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2009. )
  2010. )}
  2011. />
  2012. <Route
  2013. path="issues/"
  2014. component={errorHandler(
  2015. redirectDeprecatedProjectRoute(
  2016. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2017. )
  2018. )}
  2019. />
  2020. <Route
  2021. path="dashboard/"
  2022. component={errorHandler(
  2023. redirectDeprecatedProjectRoute(
  2024. ({orgId, projectId}) =>
  2025. `/organizations/${orgId}/dashboards/?project=${projectId}`
  2026. )
  2027. )}
  2028. />
  2029. <Route
  2030. path="user-feedback/"
  2031. component={errorHandler(
  2032. redirectDeprecatedProjectRoute(
  2033. ({orgId, projectId}) =>
  2034. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  2035. )
  2036. )}
  2037. />
  2038. <Route
  2039. path="releases/"
  2040. component={errorHandler(
  2041. redirectDeprecatedProjectRoute(
  2042. ({orgId, projectId}) =>
  2043. `/organizations/${orgId}/releases/?project=${projectId}`
  2044. )
  2045. )}
  2046. />
  2047. <Route
  2048. path="releases/:version/"
  2049. component={errorHandler(
  2050. redirectDeprecatedProjectRoute(
  2051. ({orgId, projectId, router}) =>
  2052. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  2053. )
  2054. )}
  2055. />
  2056. <Route
  2057. path="releases/:version/new-events/"
  2058. component={errorHandler(
  2059. redirectDeprecatedProjectRoute(
  2060. ({orgId, projectId, router}) =>
  2061. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  2062. )
  2063. )}
  2064. />
  2065. <Route
  2066. path="releases/:version/all-events/"
  2067. component={errorHandler(
  2068. redirectDeprecatedProjectRoute(
  2069. ({orgId, projectId, router}) =>
  2070. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  2071. )
  2072. )}
  2073. />
  2074. <Route
  2075. path="releases/:version/commits/"
  2076. component={errorHandler(
  2077. redirectDeprecatedProjectRoute(
  2078. ({orgId, projectId, router}) =>
  2079. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  2080. )
  2081. )}
  2082. />
  2083. </Route>
  2084. );
  2085. const organizationRoutes = (
  2086. <Route component={errorHandler(OrganizationDetails)}>
  2087. {settingsRoutes}
  2088. {projectsRoutes}
  2089. {dashboardRoutes}
  2090. {userFeedbackRoutes}
  2091. {issueListRoutes}
  2092. {issueDetailsRoutes}
  2093. {alertRoutes}
  2094. {cronsRoutes}
  2095. {replayRoutes}
  2096. {releasesRoutes}
  2097. {activityRoutes}
  2098. {statsRoutes}
  2099. {discoverRoutes}
  2100. {performanceRoutes}
  2101. {starfishRoutes}
  2102. {profilingRoutes}
  2103. {gettingStartedRoutes}
  2104. {adminManageRoutes}
  2105. {legacyOrganizationRootRoutes}
  2106. {legacyOrgRedirects}
  2107. </Route>
  2108. );
  2109. const legacyRedirectRoutes = (
  2110. <Route path="/:orgId/">
  2111. <IndexRedirect to="/organizations/:orgId/" />
  2112. <Route path=":projectId/settings/">
  2113. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2114. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2115. <Redirect
  2116. from="alerts/rules/"
  2117. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2118. />
  2119. <Redirect
  2120. from="alerts/rules/new/"
  2121. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2122. />
  2123. <Redirect
  2124. from="alerts/rules/:ruleId/"
  2125. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2126. />
  2127. <Redirect
  2128. from="environments/"
  2129. to="/settings/:orgId/projects/:projectId/environments/"
  2130. />
  2131. <Redirect
  2132. from="environments/hidden/"
  2133. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2134. />
  2135. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2136. <Redirect
  2137. from="issue-tracking/"
  2138. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2139. />
  2140. <Redirect
  2141. from="release-tracking/"
  2142. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2143. />
  2144. <Redirect
  2145. from="ownership/"
  2146. to="/settings/:orgId/projects/:projectId/ownership/"
  2147. />
  2148. <Redirect
  2149. from="data-forwarding/"
  2150. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2151. />
  2152. <Redirect
  2153. from="debug-symbols/"
  2154. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2155. />
  2156. <Redirect
  2157. from="processing-issues/"
  2158. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2159. />
  2160. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2161. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2162. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2163. <Redirect
  2164. from="keys/:keyId/"
  2165. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2166. />
  2167. <Redirect
  2168. from="user-feedback/"
  2169. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2170. />
  2171. <Redirect
  2172. from="security-headers/"
  2173. to="/settings/:orgId/projects/:projectId/security-headers/"
  2174. />
  2175. <Redirect
  2176. from="security-headers/csp/"
  2177. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2178. />
  2179. <Redirect
  2180. from="security-headers/expect-ct/"
  2181. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2182. />
  2183. <Redirect
  2184. from="security-headers/hpkp/"
  2185. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2186. />
  2187. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2188. <Redirect
  2189. from="plugins/:pluginId/"
  2190. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2191. />
  2192. <Redirect
  2193. from="integrations/:providerKey/"
  2194. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2195. />
  2196. </Route>
  2197. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2198. <Redirect
  2199. from=":projectId/issues/:groupId/"
  2200. to="/organizations/:orgId/issues/:groupId/"
  2201. />
  2202. <Redirect
  2203. from=":projectId/issues/:groupId/events/"
  2204. to="/organizations/:orgId/issues/:groupId/events/"
  2205. />
  2206. <Redirect
  2207. from=":projectId/issues/:groupId/events/:eventId/"
  2208. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2209. />
  2210. <Redirect
  2211. from=":projectId/issues/:groupId/tags/"
  2212. to="/organizations/:orgId/issues/:groupId/tags/"
  2213. />
  2214. <Redirect
  2215. from=":projectId/issues/:groupId/tags/:tagKey/"
  2216. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2217. />
  2218. <Redirect
  2219. from=":projectId/issues/:groupId/feedback/"
  2220. to="/organizations/:orgId/issues/:groupId/feedback/"
  2221. />
  2222. <Redirect
  2223. from=":projectId/issues/:groupId/similar/"
  2224. to="/organizations/:orgId/issues/:groupId/similar/"
  2225. />
  2226. <Redirect
  2227. from=":projectId/issues/:groupId/merged/"
  2228. to="/organizations/:orgId/issues/:groupId/merged/"
  2229. />
  2230. <Route
  2231. path=":projectId/events/:eventId/"
  2232. component={errorHandler(ProjectEventRedirect)}
  2233. />
  2234. </Route>
  2235. );
  2236. const appRoutes = (
  2237. <Route>
  2238. {experimentalSpaRoutes}
  2239. <Route path="/" component={errorHandler(App)}>
  2240. {rootRoutes}
  2241. {organizationRoutes}
  2242. {legacyRedirectRoutes}
  2243. <Route path="*" component={errorHandler(RouteNotFound)} />
  2244. </Route>
  2245. </Route>
  2246. );
  2247. return appRoutes;
  2248. }
  2249. // We load routes both when initializing the SDK (for routing integrations) and
  2250. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2251. export const routes = memoize(buildRoutes);
  2252. // Exported for use in tests.
  2253. export {buildRoutes};
  2254. function NoOp(props: {children: React.ReactNode}) {
  2255. return <Fragment>{props.children}</Fragment>;
  2256. }