routes.tsx 80 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566
  1. import {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. {usingCustomerDomain && (
  189. <Route
  190. path="/unsubscribe/project/:id/"
  191. component={make(() => import('sentry/views/unsubscribe/project'))}
  192. />
  193. )}
  194. <Route
  195. path="/unsubscribe/:orgId/project/:id/"
  196. component={make(() => import('sentry/views/unsubscribe/project'))}
  197. />
  198. {usingCustomerDomain && (
  199. <Route
  200. path="/unsubscribe/issue/:id/"
  201. component={make(() => import('sentry/views/unsubscribe/issue'))}
  202. />
  203. )}
  204. <Route
  205. path="/unsubscribe/:orgId/issue/:id/"
  206. component={make(() => import('sentry/views/unsubscribe/issue'))}
  207. />
  208. <Route
  209. path="/organizations/new/"
  210. component={make(() => import('sentry/views/organizationCreate'))}
  211. />
  212. {usingCustomerDomain && (
  213. <Route
  214. path="/data-export/:dataExportId"
  215. component={withDomainRequired(
  216. make(() => import('sentry/views/dataExport/dataDownload'))
  217. )}
  218. key="orgless-data-export-route"
  219. />
  220. )}
  221. <Route
  222. path="/organizations/:orgId/data-export/:dataExportId"
  223. component={withDomainRedirect(
  224. make(() => import('sentry/views/dataExport/dataDownload'))
  225. )}
  226. key="org-data-export"
  227. />
  228. {usingCustomerDomain && (
  229. <Route
  230. path="/disabled-member/"
  231. component={withDomainRequired(
  232. make(() => import('sentry/views/disabledMember'))
  233. )}
  234. key="orgless-disabled-member-route"
  235. />
  236. )}
  237. <Route
  238. path="/organizations/:orgId/disabled-member/"
  239. component={withDomainRedirect(make(() => import('sentry/views/disabledMember')))}
  240. key="org-disabled-member"
  241. />
  242. {usingCustomerDomain && (
  243. <Route
  244. path="/restore/"
  245. component={make(() => import('sentry/views/organizationRestore'))}
  246. />
  247. )}
  248. <Route
  249. path="/organizations/:orgId/restore/"
  250. component={make(() => import('sentry/views/organizationRestore'))}
  251. />
  252. {usingCustomerDomain && (
  253. <Route
  254. path="/join-request/"
  255. component={withDomainRequired(
  256. make(() => import('sentry/views/organizationJoinRequest'))
  257. )}
  258. key="orgless-join-request"
  259. />
  260. )}
  261. <Route
  262. path="/join-request/:orgId/"
  263. component={withDomainRedirect(
  264. make(() => import('sentry/views/organizationJoinRequest'))
  265. )}
  266. key="org-join-request"
  267. />
  268. <Route
  269. path="/relocation/"
  270. component={
  271. make(() => import('sentry/views/relocation'))
  272. }
  273. key="orgless-relocation"
  274. >
  275. <IndexRedirect to="get-started/" />
  276. <Route
  277. path=":step/"
  278. component={make(() => import('sentry/views/relocation'))}
  279. />
  280. </Route>
  281. {usingCustomerDomain && (
  282. <Route
  283. path="/onboarding/"
  284. component={errorHandler(withDomainRequired(OrganizationContextContainer))}
  285. key="orgless-onboarding"
  286. >
  287. <IndexRedirect to="welcome/" />
  288. <Route
  289. path=":step/"
  290. component={make(() => import('sentry/views/onboarding'))}
  291. />
  292. </Route>
  293. )}
  294. <Route
  295. path="/onboarding/:orgId/"
  296. component={withDomainRedirect(errorHandler(OrganizationContextContainer))}
  297. key="org-onboarding"
  298. >
  299. <IndexRedirect to="welcome/" />
  300. <Route path=":step/" component={make(() => import('sentry/views/onboarding'))} />
  301. </Route>
  302. {usingCustomerDomain && (
  303. <Route
  304. path="/stories/"
  305. component={make(() => import('sentry/views/stories/index'))}
  306. key="orgless-stories"
  307. />
  308. )}
  309. <Route
  310. path="/organizations/:orgId/stories/"
  311. component={withDomainRedirect(make(() => import('sentry/views/stories/index')))}
  312. key="org-stories"
  313. />
  314. </Fragment>
  315. );
  316. const accountSettingsRoutes = (
  317. <Route
  318. path="account/"
  319. name={t('Account')}
  320. component={make(
  321. () => import('sentry/views/settings/account/accountSettingsLayout')
  322. )}
  323. >
  324. <IndexRedirect to="details/" />
  325. <Route
  326. path="details/"
  327. name={t('Details')}
  328. component={make(() => import('sentry/views/settings/account/accountDetails'))}
  329. />
  330. <Route path="notifications/" name={t('Notifications')}>
  331. <IndexRoute
  332. component={make(
  333. () =>
  334. import(
  335. 'sentry/views/settings/account/notifications/notificationSettingsController'
  336. )
  337. )}
  338. />
  339. <Route
  340. path=":fineTuneType/"
  341. name={t('Fine Tune Alerts')}
  342. component={make(
  343. () =>
  344. import(
  345. 'sentry/views/settings/account/accountNotificationFineTuningController'
  346. )
  347. )}
  348. />
  349. </Route>
  350. <Route
  351. path="emails/"
  352. name={t('Emails')}
  353. component={make(() => import('sentry/views/settings/account/accountEmails'))}
  354. />
  355. <Route
  356. path="authorizations/"
  357. component={make(
  358. () => import('sentry/views/settings/account/accountAuthorizations')
  359. )}
  360. />
  361. <Route path="security/" name={t('Security')}>
  362. <Route
  363. component={make(
  364. () =>
  365. import(
  366. 'sentry/views/settings/account/accountSecurity/accountSecurityWrapper'
  367. )
  368. )}
  369. >
  370. <IndexRoute
  371. component={make(
  372. () => import('sentry/views/settings/account/accountSecurity')
  373. )}
  374. />
  375. <Route
  376. path="session-history/"
  377. name={t('Session History')}
  378. component={make(
  379. () => import('sentry/views/settings/account/accountSecurity/sessionHistory')
  380. )}
  381. />
  382. <Route
  383. path="mfa/:authId/"
  384. name={t('Details')}
  385. component={make(
  386. () =>
  387. import(
  388. 'sentry/views/settings/account/accountSecurity/accountSecurityDetails'
  389. )
  390. )}
  391. />
  392. </Route>
  393. <Route
  394. path="mfa/:authId/enroll/"
  395. name={t('Enroll')}
  396. component={make(
  397. () =>
  398. import(
  399. 'sentry/views/settings/account/accountSecurity/accountSecurityEnroll'
  400. )
  401. )}
  402. />
  403. </Route>
  404. <Route
  405. path="subscriptions/"
  406. name={t('Subscriptions')}
  407. component={make(
  408. () => import('sentry/views/settings/account/accountSubscriptions')
  409. )}
  410. />
  411. <Route
  412. path="identities/"
  413. name={t('Identities')}
  414. component={make(() => import('sentry/views/settings/account/accountIdentities'))}
  415. />
  416. <Route path="api/" name={t('API')}>
  417. <IndexRedirect to="auth-tokens/" />
  418. <Route path="auth-tokens/" name={t('User Auth Tokens')}>
  419. <IndexRoute
  420. component={make(() => import('sentry/views/settings/account/apiTokens'))}
  421. />
  422. <Route
  423. path="new-token/"
  424. name={t('Create New Token')}
  425. component={make(() => import('sentry/views/settings/account/apiNewToken'))}
  426. />
  427. </Route>
  428. <Route path="applications/" name={t('Applications')}>
  429. <IndexRoute
  430. component={make(
  431. () => import('sentry/views/settings/account/apiApplications')
  432. )}
  433. />
  434. <Route
  435. path=":appId/"
  436. name={t('Details')}
  437. component={make(
  438. () => import('sentry/views/settings/account/apiApplications/details')
  439. )}
  440. />
  441. </Route>
  442. {hook('routes:api')}
  443. </Route>
  444. <Route
  445. path="close-account/"
  446. name={t('Close Account')}
  447. component={make(() => import('sentry/views/settings/account/accountClose'))}
  448. />
  449. </Route>
  450. );
  451. const projectSettingsRoutes = (
  452. <Route
  453. path="projects/:projectId/"
  454. name={t('Project')}
  455. component={make(
  456. () => import('sentry/views/settings/project/projectSettingsLayout')
  457. )}
  458. >
  459. <IndexRoute
  460. name={t('General')}
  461. component={make(() => import('sentry/views/settings/projectGeneralSettings'))}
  462. />
  463. <Redirect from="install/" to="/projects/:projectId/getting-started/" />
  464. <Route
  465. path="teams/"
  466. name={t('Teams')}
  467. component={make(() => import('sentry/views/settings/project/projectTeams'))}
  468. />
  469. <Route
  470. path="alerts/"
  471. name={t('Alerts')}
  472. component={make(() => import('sentry/views/settings/projectAlerts'))}
  473. >
  474. <IndexRoute
  475. component={make(() => import('sentry/views/settings/projectAlerts/settings'))}
  476. />
  477. <Redirect from="new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  478. <Redirect from="rules/" to="/organizations/:orgId/alerts/rules/" />
  479. <Redirect from="rules/new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  480. <Redirect
  481. from="metric-rules/new/"
  482. to="/organizations/:orgId/alerts/:projectId/new/"
  483. />
  484. <Redirect
  485. from="rules/:ruleId/"
  486. to="/organizations/:orgId/alerts/rules/:projectId/:ruleId/"
  487. />
  488. <Redirect
  489. from="metric-rules/:ruleId/"
  490. to="/organizations/:orgId/alerts/metric-rules/:projectId/:ruleId/"
  491. />
  492. </Route>
  493. <Route
  494. path="environments/"
  495. name={t('Environments')}
  496. component={make(
  497. () => import('sentry/views/settings/project/projectEnvironments')
  498. )}
  499. >
  500. <IndexRoute />
  501. <Route path="hidden/" />
  502. </Route>
  503. <Route
  504. path="tags/"
  505. name={t('Tags')}
  506. component={make(() => import('sentry/views/settings/projectTags'))}
  507. />
  508. <Redirect from="issue-tracking/" to="/settings/:orgId/:projectId/plugins/" />
  509. <Route
  510. path="release-tracking/"
  511. name={t('Release Tracking')}
  512. component={make(
  513. () => import('sentry/views/settings/project/projectReleaseTracking')
  514. )}
  515. />
  516. <Route
  517. path="ownership/"
  518. name={t('Ownership Rules')}
  519. component={make(() => import('sentry/views/settings/project/projectOwnership'))}
  520. />
  521. <Route
  522. path="data-forwarding/"
  523. name={t('Data Forwarding')}
  524. component={make(() => import('sentry/views/settings/projectDataForwarding'))}
  525. />
  526. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  527. <IndexRoute
  528. component={make(
  529. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  530. )}
  531. />
  532. <Route
  533. path="advanced-data-scrubbing/:scrubbingId/"
  534. component={make(
  535. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  536. )}
  537. />
  538. </Route>
  539. <Route
  540. path="debug-symbols/"
  541. name={t('Debug Information Files')}
  542. component={make(() => import('sentry/views/settings/projectDebugFiles'))}
  543. />
  544. <Route
  545. path="proguard/"
  546. name={t('ProGuard Mappings')}
  547. component={make(() => import('sentry/views/settings/projectProguard'))}
  548. />
  549. <Route
  550. path="performance/"
  551. name={t('Performance')}
  552. component={make(() => import('sentry/views/settings/projectPerformance'))}
  553. />
  554. <Route path="metrics/" name={t('Metrics')}>
  555. <IndexRoute
  556. component={make(() => import('sentry/views/settings/projectMetrics'))}
  557. />
  558. <Route
  559. name={t('Metrics Details')}
  560. path=":mri/"
  561. component={make(
  562. () => import('sentry/views/settings/projectMetrics/projectMetricsDetails')
  563. )}
  564. />
  565. </Route>
  566. <Route path="source-maps/" name={t('Source Maps')}>
  567. <IndexRoute
  568. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  569. />
  570. <Route
  571. path="artifact-bundles/"
  572. name={t('Artifact Bundles')}
  573. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  574. >
  575. <Route
  576. name={t('Artifact Bundle')}
  577. path=":bundleId/"
  578. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  579. />
  580. </Route>
  581. <Route
  582. path="release-bundles/"
  583. name={t('Release Bundles')}
  584. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  585. >
  586. <Route
  587. name={t('Release Bundle')}
  588. path=":bundleId/"
  589. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  590. />
  591. </Route>
  592. <Redirect from=":name/" to="release-bundles/:name/" />
  593. </Route>
  594. <Route
  595. path="processing-issues/"
  596. name={t('Processing Issues')}
  597. component={make(
  598. () => import('sentry/views/settings/project/projectProcessingIssues')
  599. )}
  600. />
  601. <Route
  602. path="filters/"
  603. name={t('Inbound Filters')}
  604. component={make(() => import('sentry/views/settings/project/projectFilters'))}
  605. >
  606. <IndexRedirect to="data-filters/" />
  607. <Route path=":filterType/" />
  608. </Route>
  609. <Redirect from="dynamic-sampling/" to="performance/" />
  610. <Route
  611. path="issue-grouping/"
  612. name={t('Issue Grouping')}
  613. component={make(() => import('sentry/views/settings/projectIssueGrouping'))}
  614. />
  615. <Route
  616. path="hooks/"
  617. name={t('Service Hooks')}
  618. component={make(
  619. () => import('sentry/views/settings/project/projectServiceHooks')
  620. )}
  621. />
  622. <Route
  623. path="hooks/new/"
  624. name={t('Create Service Hook')}
  625. component={make(
  626. () => import('sentry/views/settings/project/projectCreateServiceHook')
  627. )}
  628. />
  629. <Route
  630. path="hooks/:hookId/"
  631. name={t('Service Hook Details')}
  632. component={make(
  633. () => import('sentry/views/settings/project/projectServiceHookDetails')
  634. )}
  635. />
  636. <Route path="keys/" name={t('Client Keys')}>
  637. <IndexRoute
  638. component={make(() => import('sentry/views/settings/project/projectKeys/list'))}
  639. />
  640. <Route
  641. path=":keyId/"
  642. name={t('Details')}
  643. component={make(
  644. () => import('sentry/views/settings/project/projectKeys/details')
  645. )}
  646. />
  647. </Route>
  648. <Route
  649. path="loader-script/"
  650. name={t('Loader Script')}
  651. component={make(() => import('sentry/views/settings/project/loaderScript'))}
  652. />
  653. <Route
  654. path="user-feedback/"
  655. name={t('User Feedback')}
  656. component={make(
  657. () => import('sentry/views/settings/project/projectUserFeedback')
  658. )}
  659. />
  660. <Redirect from="csp/" to="security-headers/" />
  661. <Route path="security-headers/" name={t('Security Headers')}>
  662. <IndexRoute
  663. component={make(() => import('sentry/views/settings/projectSecurityHeaders'))}
  664. />
  665. <Route
  666. path="csp/"
  667. name={t('Content Security Policy')}
  668. component={make(
  669. () => import('sentry/views/settings/projectSecurityHeaders/csp')
  670. )}
  671. />
  672. <Route
  673. path="expect-ct/"
  674. name={t('Certificate Transparency')}
  675. component={make(
  676. () => import('sentry/views/settings/projectSecurityHeaders/expectCt')
  677. )}
  678. />
  679. <Route
  680. path="hpkp/"
  681. name={t('HPKP')}
  682. component={make(
  683. () => import('sentry/views/settings/projectSecurityHeaders/hpkp')
  684. )}
  685. />
  686. </Route>
  687. <Route path="plugins/" name={t('Legacy Integrations')}>
  688. <IndexRoute
  689. component={make(() => import('sentry/views/settings/projectPlugins'))}
  690. />
  691. <Route
  692. path=":pluginId/"
  693. name={t('Integration Details')}
  694. component={make(() => import('sentry/views/settings/projectPlugins/details'))}
  695. />
  696. </Route>
  697. </Route>
  698. );
  699. const orgSettingsRoutes = (
  700. <Route
  701. component={make(
  702. () => import('sentry/views/settings/organization/organizationSettingsLayout')
  703. )}
  704. >
  705. {hook('routes:organization')}
  706. {!usingCustomerDomain && (
  707. <IndexRoute
  708. name={t('General')}
  709. component={make(
  710. () => import('sentry/views/settings/organizationGeneralSettings')
  711. )}
  712. />
  713. )}
  714. {usingCustomerDomain && (
  715. <Route
  716. path="/settings/organization/"
  717. name={t('General')}
  718. component={make(
  719. () => import('sentry/views/settings/organizationGeneralSettings')
  720. )}
  721. />
  722. )}
  723. <Route
  724. path="projects/"
  725. name={t('Projects')}
  726. component={make(() => import('sentry/views/settings/organizationProjects'))}
  727. />
  728. <Route path="api-keys/" name={t('API Key')}>
  729. <IndexRoute
  730. component={make(() => import('sentry/views/settings/organizationApiKeys'))}
  731. />
  732. <Route
  733. path=":apiKey/"
  734. name={t('Details')}
  735. component={make(
  736. () =>
  737. import(
  738. 'sentry/views/settings/organizationApiKeys/organizationApiKeyDetails'
  739. )
  740. )}
  741. />
  742. </Route>
  743. <Route
  744. path="audit-log/"
  745. name={t('Audit Log')}
  746. component={make(() => import('sentry/views/settings/organizationAuditLog'))}
  747. />
  748. <Route
  749. path="auth/"
  750. name={t('Auth Providers')}
  751. component={make(() => import('sentry/views/settings/organizationAuth'))}
  752. />
  753. <Redirect from="members/requests" to="members/" />
  754. <Route path="members/" name={t('Members')}>
  755. <Route
  756. component={make(
  757. () =>
  758. import(
  759. 'sentry/views/settings/organizationMembers/organizationMembersWrapper'
  760. )
  761. )}
  762. >
  763. <IndexRoute
  764. component={make(
  765. () =>
  766. import(
  767. 'sentry/views/settings/organizationMembers/organizationMembersList'
  768. )
  769. )}
  770. />
  771. </Route>
  772. <Route
  773. path=":memberId/"
  774. name={t('Details')}
  775. component={make(
  776. () =>
  777. import('sentry/views/settings/organizationMembers/organizationMemberDetail')
  778. )}
  779. />
  780. </Route>
  781. <Route
  782. path="rate-limits/"
  783. name={t('Rate Limits')}
  784. component={make(() => import('sentry/views/settings/organizationRateLimits'))}
  785. />
  786. <Route
  787. path="relay/"
  788. name={t('Relay')}
  789. component={make(() => import('sentry/views/settings/organizationRelay'))}
  790. />
  791. <Route
  792. path="repos/"
  793. name={t('Repositories')}
  794. component={make(() => import('sentry/views/settings/organizationRepositories'))}
  795. />
  796. <Route
  797. path="settings/"
  798. component={make(
  799. () => import('sentry/views/settings/organizationGeneralSettings')
  800. )}
  801. />
  802. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  803. <IndexRoute
  804. component={make(
  805. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  806. )}
  807. />
  808. <Route
  809. path="advanced-data-scrubbing/:scrubbingId/"
  810. component={make(
  811. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  812. )}
  813. />
  814. </Route>
  815. <Route path="teams/" name={t('Teams')}>
  816. <IndexRoute
  817. component={make(() => import('sentry/views/settings/organizationTeams'))}
  818. />
  819. <Route
  820. path=":teamId/"
  821. name={t('Team')}
  822. component={make(
  823. () => import('sentry/views/settings/organizationTeams/teamDetails')
  824. )}
  825. >
  826. <IndexRedirect to="members/" />
  827. <Route
  828. path="members/"
  829. name={t('Members')}
  830. component={make(
  831. () => import('sentry/views/settings/organizationTeams/teamMembers')
  832. )}
  833. />
  834. <Route
  835. path="notifications/"
  836. name={t('Notifications')}
  837. component={make(
  838. () => import('sentry/views/settings/organizationTeams/teamNotifications')
  839. )}
  840. />
  841. <Route
  842. path="projects/"
  843. name={t('Projects')}
  844. component={make(
  845. () => import('sentry/views/settings/organizationTeams/teamProjects')
  846. )}
  847. />
  848. <Route
  849. path="settings/"
  850. name={t('Settings')}
  851. component={make(
  852. () => import('sentry/views/settings/organizationTeams/teamSettings')
  853. )}
  854. />
  855. </Route>
  856. </Route>
  857. <Redirect from="plugins/" to="integrations/" />
  858. <Route path="plugins/" name={t('Integrations')}>
  859. <Route
  860. path=":integrationSlug/"
  861. name={t('Integration Details')}
  862. component={make(
  863. () =>
  864. import('sentry/views/settings/organizationIntegrations/pluginDetailedView')
  865. )}
  866. />
  867. </Route>
  868. <Redirect from="sentry-apps/" to="integrations/" />
  869. <Route path="sentry-apps/" name={t('Integrations')}>
  870. <Route
  871. path=":integrationSlug"
  872. name={t('Details')}
  873. component={make(
  874. () =>
  875. import(
  876. 'sentry/views/settings/organizationIntegrations/sentryAppDetailedView'
  877. )
  878. )}
  879. />
  880. </Route>
  881. <Redirect from="document-integrations/" to="integrations/" />
  882. <Route path="document-integrations/" name={t('Integrations')}>
  883. <Route
  884. path=":integrationSlug"
  885. name={t('Details')}
  886. component={make(
  887. () =>
  888. import(
  889. 'sentry/views/settings/organizationIntegrations/docIntegrationDetailedView'
  890. )
  891. )}
  892. />
  893. </Route>
  894. <Route path="integrations/" name={t('Integrations')}>
  895. <IndexRoute
  896. component={make(
  897. () =>
  898. import(
  899. 'sentry/views/settings/organizationIntegrations/integrationListDirectory'
  900. )
  901. )}
  902. />
  903. <Route
  904. path=":integrationSlug"
  905. name={t('Integration Details')}
  906. component={make(
  907. () =>
  908. import(
  909. 'sentry/views/settings/organizationIntegrations/integrationDetailedView'
  910. )
  911. )}
  912. />
  913. <Route
  914. path=":providerKey/:integrationId/"
  915. name={t('Configure Integration')}
  916. component={make(
  917. () =>
  918. import(
  919. 'sentry/views/settings/organizationIntegrations/configureIntegration'
  920. )
  921. )}
  922. />
  923. </Route>
  924. <Redirect from="developer-settings/sentry-functions/" to="developer-settings/" />
  925. <Route path="developer-settings/" name={t('Custom Integrations')}>
  926. <IndexRoute
  927. component={make(
  928. () => import('sentry/views/settings/organizationDeveloperSettings')
  929. )}
  930. />
  931. <Route
  932. path="new-public/"
  933. name={t('Create Integration')}
  934. component={make(
  935. () =>
  936. import(
  937. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  938. )
  939. )}
  940. />
  941. <Route
  942. path="new-internal/"
  943. name={t('Create Integration')}
  944. component={make(
  945. () =>
  946. import(
  947. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  948. )
  949. )}
  950. />
  951. <Route
  952. path=":appSlug/"
  953. name={t('Edit Integration')}
  954. component={make(
  955. () =>
  956. import(
  957. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  958. )
  959. )}
  960. />
  961. <Route
  962. path=":appSlug/dashboard/"
  963. name={t('Integration Dashboard')}
  964. component={make(
  965. () =>
  966. import(
  967. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  968. )
  969. )}
  970. />
  971. <Route path="sentry-functions/" name={t('Sentry Functions')}>
  972. <Route
  973. path="new/"
  974. name={t('Create Sentry Function')}
  975. component={make(
  976. () =>
  977. import(
  978. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  979. )
  980. )}
  981. />
  982. <Route
  983. path=":functionSlug/"
  984. name={t('Edit Sentry Function')}
  985. component={make(
  986. () =>
  987. import(
  988. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  989. )
  990. )}
  991. />
  992. </Route>
  993. </Route>
  994. <Route path="auth-tokens/" name={t('Auth Tokens')}>
  995. <IndexRoute
  996. component={make(() => import('sentry/views/settings/organizationAuthTokens'))}
  997. />
  998. <Route
  999. path="new-token/"
  1000. name={t('Create New Auth Token')}
  1001. component={make(
  1002. () => import('sentry/views/settings/organizationAuthTokens/newAuthToken')
  1003. )}
  1004. />
  1005. <Route
  1006. path=":tokenId/"
  1007. name={t('Edit Auth Token')}
  1008. component={make(
  1009. () => import('sentry/views/settings/organizationAuthTokens/authTokenDetails')
  1010. )}
  1011. />
  1012. </Route>
  1013. <Route
  1014. path="early-features/"
  1015. name={t('Early Features')}
  1016. component={make(() => import('sentry/views/settings/earlyFeatures'))}
  1017. />
  1018. </Route>
  1019. );
  1020. const legacySettingsRedirects = (
  1021. <Fragment>
  1022. <Redirect from=":projectId/" to="projects/:projectId/" />
  1023. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  1024. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  1025. <Redirect
  1026. from=":projectId/alerts/rules/:ruleId/"
  1027. to="projects/:projectId/alerts/rules/:ruleId/"
  1028. />
  1029. </Fragment>
  1030. );
  1031. const settingsRoutes = (
  1032. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  1033. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  1034. {accountSettingsRoutes}
  1035. <Fragment>
  1036. {usingCustomerDomain && (
  1037. <Route
  1038. name={t('Organization')}
  1039. component={withDomainRequired(NoOp)}
  1040. key="orgless-settings-route"
  1041. >
  1042. {orgSettingsRoutes}
  1043. {projectSettingsRoutes}
  1044. </Route>
  1045. )}
  1046. <Route
  1047. path=":orgId/"
  1048. name={t('Organization')}
  1049. component={withDomainRedirect(NoOp)}
  1050. key="org-settings"
  1051. >
  1052. {orgSettingsRoutes}
  1053. {projectSettingsRoutes}
  1054. {legacySettingsRedirects}
  1055. </Route>
  1056. </Fragment>
  1057. </Route>
  1058. );
  1059. const projectsChildRoutes = (
  1060. <Fragment>
  1061. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  1062. <Route
  1063. path="new/"
  1064. component={make(() => import('sentry/views/projectInstall/newProject'))}
  1065. />
  1066. <Route
  1067. path=":projectId/"
  1068. component={make(() => import('sentry/views/projectDetail'))}
  1069. />
  1070. <Route
  1071. path=":projectId/events/:eventId/"
  1072. component={errorHandler(ProjectEventRedirect)}
  1073. />
  1074. <Route
  1075. path=":projectId/getting-started/"
  1076. component={make(
  1077. () => import('sentry/views/projectInstall/platformOrIntegration')
  1078. )}
  1079. />
  1080. </Fragment>
  1081. );
  1082. const projectsRoutes = (
  1083. <Fragment>
  1084. {usingCustomerDomain && (
  1085. <Route
  1086. path="/projects/"
  1087. component={make(() => import('sentry/views/projects/'))}
  1088. key="orgless-projects-route"
  1089. >
  1090. {projectsChildRoutes}
  1091. </Route>
  1092. )}
  1093. <Route
  1094. path="/organizations/:orgId/projects/"
  1095. component={make(() => import('sentry/views/projects/'))}
  1096. key="org-projects"
  1097. >
  1098. {projectsChildRoutes}
  1099. </Route>
  1100. </Fragment>
  1101. );
  1102. const dashboardWidgetRoutes = (
  1103. <Fragment>
  1104. <Route
  1105. path="widget/:widgetIndex/edit/"
  1106. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1107. />
  1108. <Route
  1109. path="widget/new/"
  1110. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1111. />
  1112. <Route
  1113. path="widget/:widgetId/"
  1114. component={make(() => import('sentry/views/dashboards/view'))}
  1115. />
  1116. </Fragment>
  1117. );
  1118. const dashboardRoutes = (
  1119. <Fragment>
  1120. <Fragment>
  1121. {usingCustomerDomain && (
  1122. <Route
  1123. path="/dashboards/"
  1124. component={withDomainRequired(make(() => import('sentry/views/dashboards')))}
  1125. key="orgless-dashboards-route"
  1126. >
  1127. <IndexRoute
  1128. component={make(() => import('sentry/views/dashboards/manage'))}
  1129. />
  1130. </Route>
  1131. )}
  1132. <Route
  1133. path="/organizations/:orgId/dashboards/"
  1134. component={withDomainRedirect(make(() => import('sentry/views/dashboards')))}
  1135. key="org-dashboards"
  1136. >
  1137. <IndexRoute component={make(() => import('sentry/views/dashboards/manage'))} />
  1138. </Route>
  1139. </Fragment>
  1140. <Fragment>
  1141. {usingCustomerDomain && (
  1142. <Route
  1143. path="/dashboards/new/"
  1144. component={withDomainRequired(
  1145. make(() => import('sentry/views/dashboards/create'))
  1146. )}
  1147. key="orgless-dashboards-new-route"
  1148. >
  1149. <Route
  1150. path="widget/:widgetIndex/edit/"
  1151. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1152. />
  1153. <Route
  1154. path="widget/new/"
  1155. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1156. />
  1157. </Route>
  1158. )}
  1159. <Route
  1160. path="/organizations/:orgId/dashboards/new/"
  1161. component={withDomainRedirect(
  1162. make(() => import('sentry/views/dashboards/create'))
  1163. )}
  1164. key="org-dashboards-new"
  1165. >
  1166. <Route
  1167. path="widget/:widgetIndex/edit/"
  1168. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1169. />
  1170. <Route
  1171. path="widget/new/"
  1172. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1173. />
  1174. </Route>
  1175. </Fragment>
  1176. <Fragment>
  1177. {usingCustomerDomain && (
  1178. <Route
  1179. path="/dashboards/new/:templateId"
  1180. component={withDomainRequired(
  1181. make(() => import('sentry/views/dashboards/create'))
  1182. )}
  1183. key="orgless-dashboards-new-template-route"
  1184. >
  1185. <Route
  1186. path="widget/:widgetId/"
  1187. component={make(() => import('sentry/views/dashboards/create'))}
  1188. />
  1189. </Route>
  1190. )}
  1191. <Route
  1192. path="/organizations/:orgId/dashboards/new/:templateId"
  1193. component={withDomainRedirect(
  1194. make(() => import('sentry/views/dashboards/create'))
  1195. )}
  1196. key="org-dashboards-new-template"
  1197. >
  1198. <Route
  1199. path="widget/:widgetId/"
  1200. component={make(() => import('sentry/views/dashboards/create'))}
  1201. />
  1202. </Route>
  1203. </Fragment>
  1204. <Redirect
  1205. from="/organizations/:orgId/dashboards/:dashboardId/"
  1206. to="/organizations/:orgId/dashboard/:dashboardId/"
  1207. />
  1208. {usingCustomerDomain && (
  1209. <Redirect from="/dashboards/:dashboardId/" to="/dashboard/:dashboardId/" />
  1210. )}
  1211. <Fragment>
  1212. {usingCustomerDomain && (
  1213. <Route
  1214. path="/dashboard/:dashboardId/"
  1215. component={withDomainRequired(
  1216. make(() => import('sentry/views/dashboards/view'))
  1217. )}
  1218. key="orgless-dashboards-dashboard-id-route"
  1219. >
  1220. {dashboardWidgetRoutes}
  1221. </Route>
  1222. )}
  1223. <Route
  1224. path="/organizations/:orgId/dashboard/:dashboardId/"
  1225. component={withDomainRedirect(
  1226. make(() => import('sentry/views/dashboards/view'))
  1227. )}
  1228. key="org-dashboards-dashboard-id"
  1229. >
  1230. {dashboardWidgetRoutes}
  1231. </Route>
  1232. </Fragment>
  1233. </Fragment>
  1234. );
  1235. const alertChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1236. return (
  1237. <Fragment>
  1238. <IndexRoute
  1239. component={make(() => import('sentry/views/alerts/list/incidents'))}
  1240. />
  1241. <Route path="rules/">
  1242. <IndexRoute
  1243. component={make(
  1244. () => import('sentry/views/alerts/list/rules/alertRulesList')
  1245. )}
  1246. />
  1247. <Route
  1248. path="details/:ruleId/"
  1249. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  1250. />
  1251. <Route
  1252. path=":projectId/"
  1253. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1254. >
  1255. <IndexRedirect
  1256. to={
  1257. forCustomerDomain
  1258. ? '/alerts/rules/'
  1259. : '/organizations/:orgId/alerts/rules/'
  1260. }
  1261. />
  1262. <Route
  1263. path=":ruleId/"
  1264. component={make(() => import('sentry/views/alerts/edit'))}
  1265. />
  1266. </Route>
  1267. <Route path=":projectId/:ruleId/details/">
  1268. <IndexRoute
  1269. component={make(
  1270. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  1271. )}
  1272. />
  1273. </Route>
  1274. </Route>
  1275. <Route path="metric-rules/">
  1276. <IndexRedirect
  1277. to={
  1278. forCustomerDomain ? '/alerts/rules/' : '/organizations/:orgId/alerts/rules/'
  1279. }
  1280. />
  1281. <Route
  1282. path=":projectId/"
  1283. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1284. >
  1285. <IndexRedirect
  1286. to={
  1287. forCustomerDomain
  1288. ? '/alerts/rules/'
  1289. : '/organizations/:orgId/alerts/rules/'
  1290. }
  1291. />
  1292. <Route
  1293. path=":ruleId/"
  1294. component={make(() => import('sentry/views/alerts/edit'))}
  1295. />
  1296. </Route>
  1297. </Route>
  1298. <Route
  1299. path="wizard/"
  1300. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1301. >
  1302. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  1303. </Route>
  1304. <Route
  1305. path="new/"
  1306. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1307. >
  1308. <IndexRedirect
  1309. to={
  1310. forCustomerDomain
  1311. ? '/alerts/wizard/'
  1312. : '/organizations/:orgId/alerts/wizard/'
  1313. }
  1314. />
  1315. <Route
  1316. path=":alertType/"
  1317. component={make(() => import('sentry/views/alerts/create'))}
  1318. />
  1319. </Route>
  1320. <Route
  1321. path=":alertId/"
  1322. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1323. />
  1324. <Route
  1325. path=":projectId/"
  1326. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1327. >
  1328. <Route
  1329. path="new/"
  1330. component={make(() => import('sentry/views/alerts/create'))}
  1331. />
  1332. <Route
  1333. path="wizard/"
  1334. component={make(() => import('sentry/views/alerts/wizard'))}
  1335. />
  1336. </Route>
  1337. </Fragment>
  1338. );
  1339. };
  1340. const alertRoutes = (
  1341. <Fragment>
  1342. {usingCustomerDomain && (
  1343. <Route
  1344. path="/alerts/"
  1345. component={withDomainRequired(make(() => import('sentry/views/alerts')))}
  1346. key="orgless-alerts-route"
  1347. >
  1348. {alertChildRoutes({forCustomerDomain: true})}
  1349. </Route>
  1350. )}
  1351. <Route
  1352. path="/organizations/:orgId/alerts/"
  1353. component={withDomainRedirect(make(() => import('sentry/views/alerts')))}
  1354. key="org-alerts"
  1355. >
  1356. {alertChildRoutes({forCustomerDomain: false})}
  1357. </Route>
  1358. </Fragment>
  1359. );
  1360. const cronsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1361. return (
  1362. <Fragment>
  1363. <IndexRoute component={make(() => import('sentry/views/monitors/overview'))} />
  1364. <Route
  1365. path={
  1366. forCustomerDomain ? '/crons/create/' : '/organizations/:orgId/crons/create/'
  1367. }
  1368. component={make(() => import('sentry/views/monitors/create'))}
  1369. key={forCustomerDomain ? 'orgless-monitors-create' : 'org-monitors-create'}
  1370. />
  1371. <Route
  1372. path={
  1373. forCustomerDomain
  1374. ? '/crons/:monitorSlug/'
  1375. : '/organizations/:orgId/crons/:monitorSlug/'
  1376. }
  1377. component={make(() => import('sentry/views/monitors/details'))}
  1378. key={
  1379. forCustomerDomain ? 'orgless-monitors-monitor-id' : 'org-monitors-monitor-id'
  1380. }
  1381. />
  1382. <Route
  1383. path={
  1384. forCustomerDomain
  1385. ? '/crons/:monitorSlug/edit/'
  1386. : '/organizations/:orgId/crons/:monitorSlug/edit/'
  1387. }
  1388. component={make(() => import('sentry/views/monitors/edit'))}
  1389. key={forCustomerDomain ? 'orgless-monitors-edit' : 'org-monitors-edit'}
  1390. />
  1391. </Fragment>
  1392. );
  1393. };
  1394. const cronsRoutes = (
  1395. <Fragment>
  1396. {usingCustomerDomain && (
  1397. <Route
  1398. path="/crons/"
  1399. component={withDomainRequired(make(() => import('sentry/views/monitors')))}
  1400. key="orgless-monitors-route"
  1401. >
  1402. {cronsChildRoutes({forCustomerDomain: true})}
  1403. </Route>
  1404. )}
  1405. <Route
  1406. path="/organizations/:orgId/crons/"
  1407. component={withDomainRedirect(make(() => import('sentry/views/monitors')))}
  1408. key="org-monitors"
  1409. >
  1410. {cronsChildRoutes({forCustomerDomain: false})}
  1411. </Route>
  1412. </Fragment>
  1413. );
  1414. const replayChildRoutes = (
  1415. <Fragment>
  1416. <IndexRoute component={make(() => import('sentry/views/replays/list'))} />
  1417. <Route
  1418. path="selectors/"
  1419. component={make(
  1420. () => import('sentry/views/replays/deadRageClick/deadRageClickList')
  1421. )}
  1422. />
  1423. <Route
  1424. path=":replaySlug/"
  1425. component={make(() => import('sentry/views/replays/details'))}
  1426. />
  1427. </Fragment>
  1428. );
  1429. const replayRoutes = (
  1430. <Fragment>
  1431. {usingCustomerDomain && (
  1432. <Route
  1433. path="/replays/"
  1434. component={withDomainRequired(make(() => import('sentry/views/replays/index')))}
  1435. key="orgless-replays-route"
  1436. >
  1437. {replayChildRoutes}
  1438. </Route>
  1439. )}
  1440. <Route
  1441. path="/organizations/:orgId/replays/"
  1442. component={withDomainRedirect(make(() => import('sentry/views/replays/index')))}
  1443. key="org-replays"
  1444. >
  1445. {replayChildRoutes}
  1446. </Route>
  1447. </Fragment>
  1448. );
  1449. const releasesChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1450. return (
  1451. <Fragment>
  1452. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1453. <Route
  1454. path=":release/"
  1455. component={make(() => import('sentry/views/releases/detail'))}
  1456. >
  1457. <IndexRoute
  1458. component={make(() => import('sentry/views/releases/detail/overview'))}
  1459. />
  1460. <Route
  1461. path="commits/"
  1462. component={make(
  1463. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1464. )}
  1465. />
  1466. <Route
  1467. path="files-changed/"
  1468. component={make(
  1469. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1470. )}
  1471. />
  1472. {forCustomerDomain ? null : (
  1473. <Fragment>
  1474. <Redirect
  1475. from="new-events/"
  1476. to="/organizations/:orgId/releases/:release/"
  1477. />
  1478. <Redirect
  1479. from="all-events/"
  1480. to="/organizations/:orgId/releases/:release/"
  1481. />
  1482. </Fragment>
  1483. )}
  1484. </Route>
  1485. </Fragment>
  1486. );
  1487. };
  1488. const releasesRoutes = (
  1489. <Fragment>
  1490. {usingCustomerDomain && (
  1491. <Route
  1492. path="/releases/"
  1493. component={withDomainRequired(NoOp)}
  1494. key="orgless-releases-route"
  1495. >
  1496. {releasesChildRoutes({forCustomerDomain: true})}
  1497. </Route>
  1498. )}
  1499. <Route
  1500. path="/organizations/:orgId/releases/"
  1501. component={withDomainRedirect(NoOp)}
  1502. key="org-releases"
  1503. >
  1504. {releasesChildRoutes({forCustomerDomain: false})}
  1505. </Route>
  1506. </Fragment>
  1507. );
  1508. const releaseThresholdRoutes = (
  1509. <Fragment>
  1510. {usingCustomerDomain && (
  1511. <Route
  1512. path="/release-thresholds/"
  1513. component={withDomainRequired(NoOp)}
  1514. key="orgless-release-thresholds-route"
  1515. >
  1516. <IndexRoute
  1517. component={make(() => import('sentry/views/releases/thresholdsList'))}
  1518. />
  1519. </Route>
  1520. )}
  1521. <Route
  1522. path="/organizations/:orgId/release-thresholds/"
  1523. component={withDomainRedirect(NoOp)}
  1524. key="org-release-thresholds"
  1525. >
  1526. <IndexRoute
  1527. component={make(() => import('sentry/views/releases/thresholdsList'))}
  1528. />
  1529. </Route>
  1530. </Fragment>
  1531. );
  1532. const activityRoutes = (
  1533. <Fragment>
  1534. {usingCustomerDomain && (
  1535. <Route
  1536. path="/activity/"
  1537. component={withDomainRequired(
  1538. make(() => import('sentry/views/organizationActivity'))
  1539. )}
  1540. key="orgless-activity-route"
  1541. />
  1542. )}
  1543. <Route
  1544. path="/organizations/:orgId/activity/"
  1545. component={withDomainRedirect(
  1546. make(() => import('sentry/views/organizationActivity'))
  1547. )}
  1548. key="org-activity"
  1549. />
  1550. </Fragment>
  1551. );
  1552. const statsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1553. return (
  1554. <Fragment>
  1555. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1556. <Route
  1557. path="issues/"
  1558. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1559. >
  1560. <IndexRoute
  1561. component={make(
  1562. () => import('sentry/views/organizationStats/teamInsights/issues')
  1563. )}
  1564. />
  1565. </Route>
  1566. <Route
  1567. path="health/"
  1568. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1569. >
  1570. <IndexRoute
  1571. component={make(
  1572. () => import('sentry/views/organizationStats/teamInsights/health')
  1573. )}
  1574. />
  1575. </Route>
  1576. {forCustomerDomain ? null : (
  1577. <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
  1578. )}
  1579. </Fragment>
  1580. );
  1581. };
  1582. const statsRoutes = (
  1583. <Fragment>
  1584. {usingCustomerDomain && (
  1585. <Route
  1586. path="/stats/"
  1587. component={withDomainRequired(NoOp)}
  1588. key="orgless-stats-route"
  1589. >
  1590. {statsChildRoutes({forCustomerDomain: true})}
  1591. </Route>
  1592. )}
  1593. <Route
  1594. path="/organizations/:orgId/stats/"
  1595. component={withDomainRedirect(NoOp)}
  1596. key="org-stats"
  1597. >
  1598. {statsChildRoutes({forCustomerDomain: false})}
  1599. </Route>
  1600. </Fragment>
  1601. );
  1602. // TODO(mark) Long term this /queries route should go away and /discover
  1603. // should be the canonical route for discover2. We have a redirect right now
  1604. // as /discover was for discover 1 and most of the application is linking to
  1605. // /discover/queries and not /discover
  1606. const discoverChildRoutes = (
  1607. <Fragment>
  1608. <IndexRedirect to="queries/" />
  1609. <Route
  1610. path="homepage/"
  1611. component={make(() => import('sentry/views/discover/homepage'))}
  1612. />
  1613. <Route
  1614. path="queries/"
  1615. component={make(() => import('sentry/views/discover/landing'))}
  1616. />
  1617. <Route
  1618. path="results/"
  1619. component={make(() => import('sentry/views/discover/results'))}
  1620. />
  1621. <Route
  1622. path=":eventSlug/"
  1623. component={make(() => import('sentry/views/discover/eventDetails'))}
  1624. />
  1625. </Fragment>
  1626. );
  1627. const discoverRoutes = (
  1628. <Fragment>
  1629. {usingCustomerDomain && (
  1630. <Route
  1631. path="/discover/"
  1632. component={withDomainRequired(make(() => import('sentry/views/discover')))}
  1633. key="orgless-discover-route"
  1634. >
  1635. {discoverChildRoutes}
  1636. </Route>
  1637. )}
  1638. <Route
  1639. path="/organizations/:orgId/discover/"
  1640. component={withDomainRedirect(make(() => import('sentry/views/discover')))}
  1641. key="org-discover-route"
  1642. >
  1643. {discoverChildRoutes}
  1644. </Route>
  1645. </Fragment>
  1646. );
  1647. const performanceChildRoutes = (
  1648. <Fragment>
  1649. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1650. <Route
  1651. path="trends/"
  1652. component={make(() => import('sentry/views/performance/trends'))}
  1653. />
  1654. <Route path="database/">
  1655. <IndexRoute
  1656. component={make(
  1657. () => import('sentry/views/performance/database/databaseLandingPage')
  1658. )}
  1659. />
  1660. <Route
  1661. path="spans/span/:groupId/"
  1662. component={make(
  1663. () => import('sentry/views/performance/database/databaseSpanSummaryPage')
  1664. )}
  1665. />
  1666. </Route>
  1667. <Route path="browser/">
  1668. <Route path="interactions/">
  1669. <IndexRoute
  1670. component={make(
  1671. () => import('sentry/views/performance/browser/interactionsLandingPage')
  1672. )}
  1673. />
  1674. <Route
  1675. path="summary/"
  1676. component={make(
  1677. () => import('sentry/views/performance/browser/interactionSummary/index')
  1678. )}
  1679. />
  1680. </Route>
  1681. <Route path="pageloads/">
  1682. <IndexRoute
  1683. component={make(
  1684. () =>
  1685. import('sentry/views/performance/browser/webVitals/webVitalsLandingPage')
  1686. )}
  1687. />
  1688. <Route
  1689. path="overview/"
  1690. component={make(
  1691. () => import('sentry/views/performance/browser/webVitals/pageOverview')
  1692. )}
  1693. />
  1694. </Route>
  1695. <Route path="resources/">
  1696. <IndexRoute
  1697. component={make(
  1698. () => import('sentry/views/performance/browser/resources/index')
  1699. )}
  1700. />
  1701. <Route
  1702. path="spans/span/:groupId/"
  1703. component={make(
  1704. () =>
  1705. import(
  1706. 'sentry/views/performance/browser/resources/resourceSummaryPage/index'
  1707. )
  1708. )}
  1709. />
  1710. </Route>
  1711. </Route>
  1712. <Route path="mobile/">
  1713. <Route path="screens/">
  1714. <IndexRoute
  1715. component={make(
  1716. () => import('sentry/views/starfish/modules/mobile/pageload')
  1717. )}
  1718. />
  1719. <Route
  1720. path="spans/"
  1721. component={make(
  1722. () => import('sentry/views/starfish/views/screens/screenLoadSpans')
  1723. )}
  1724. />
  1725. </Route>
  1726. </Route>
  1727. <Route path="summary/">
  1728. <IndexRoute
  1729. component={make(
  1730. () =>
  1731. import('sentry/views/performance/transactionSummary/transactionOverview')
  1732. )}
  1733. />
  1734. <Route
  1735. path="replays/"
  1736. component={make(
  1737. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1738. )}
  1739. />
  1740. <Route
  1741. path="vitals/"
  1742. component={make(
  1743. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1744. )}
  1745. />
  1746. <Route
  1747. path="tags/"
  1748. component={make(
  1749. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1750. )}
  1751. />
  1752. <Route
  1753. path="events/"
  1754. component={make(
  1755. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1756. )}
  1757. />
  1758. <Route
  1759. path="anomalies/"
  1760. component={make(
  1761. () =>
  1762. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1763. )}
  1764. />
  1765. <Route
  1766. path="profiles/"
  1767. component={make(
  1768. () =>
  1769. import('sentry/views/performance/transactionSummary/transactionProfiles')
  1770. )}
  1771. />
  1772. <Route
  1773. path="aggregateWaterfall/"
  1774. component={make(
  1775. () =>
  1776. import('sentry/views/performance/transactionSummary/aggregateSpanWaterfall')
  1777. )}
  1778. />
  1779. <Route path="spans/">
  1780. <IndexRoute
  1781. component={make(
  1782. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1783. )}
  1784. />
  1785. <Route
  1786. path=":spanSlug/"
  1787. component={make(
  1788. () =>
  1789. import(
  1790. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1791. )
  1792. )}
  1793. />
  1794. </Route>
  1795. </Route>
  1796. <Route
  1797. path="vitaldetail/"
  1798. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1799. />
  1800. <Route
  1801. path="trace/:traceSlug/"
  1802. component={make(() => import('sentry/views/performance/traceDetails'))}
  1803. />
  1804. <Route
  1805. path=":eventSlug/"
  1806. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1807. />
  1808. </Fragment>
  1809. );
  1810. const performanceRoutes = (
  1811. <Fragment>
  1812. {usingCustomerDomain && (
  1813. <Route
  1814. path="/performance/"
  1815. component={withDomainRequired(make(() => import('sentry/views/performance')))}
  1816. key="orgless-performance-route"
  1817. >
  1818. {performanceChildRoutes}
  1819. </Route>
  1820. )}
  1821. <Route
  1822. path="/organizations/:orgId/performance/"
  1823. component={withDomainRedirect(make(() => import('sentry/views/performance')))}
  1824. key="org-performance"
  1825. >
  1826. {performanceChildRoutes}
  1827. </Route>
  1828. </Fragment>
  1829. );
  1830. const starfishChildRoutes = (
  1831. <Fragment>
  1832. <IndexRoute
  1833. component={make(() => import('sentry/views/starfish/views/webServiceView'))}
  1834. />
  1835. <Route path="endpoint-overview/">
  1836. <IndexRoute
  1837. component={make(
  1838. () => import('sentry/views/starfish/views/webServiceView/endpointOverview')
  1839. )}
  1840. />
  1841. <Route
  1842. path="span/:groupId/"
  1843. component={make(() => import('sentry/views/starfish/views/spanSummaryPage'))}
  1844. />
  1845. </Route>
  1846. <Redirect from="database/" to="/performance/database" />
  1847. <Route path="appStartup/">
  1848. <IndexRoute
  1849. component={make(
  1850. () => import('sentry/views/starfish/modules/mobile/appStartup')
  1851. )}
  1852. />
  1853. <Route
  1854. path="spans/"
  1855. component={make(
  1856. () => import('sentry/views/starfish/views/appStartup/screenSummary')
  1857. )}
  1858. />
  1859. </Route>
  1860. <Route path="responsiveness/">
  1861. <IndexRoute
  1862. component={make(
  1863. () => import('sentry/views/starfish/modules/mobile/responsiveness')
  1864. )}
  1865. />
  1866. </Route>
  1867. <Route path="spans/">
  1868. <IndexRoute component={make(() => import('sentry/views/starfish/views/spans'))} />
  1869. <Route
  1870. path="span/:groupId/"
  1871. component={make(() => import('sentry/views/starfish/views/spanSummaryPage'))}
  1872. />
  1873. </Route>
  1874. </Fragment>
  1875. );
  1876. const starfishRoutes = (
  1877. <Fragment>
  1878. {usingCustomerDomain && (
  1879. <Route
  1880. path="/starfish/"
  1881. component={withDomainRequired(make(() => import('sentry/views/starfish')))}
  1882. key="orgless-starfish-route"
  1883. >
  1884. {starfishChildRoutes}
  1885. </Route>
  1886. )}
  1887. <Route
  1888. path="/organizations/:orgId/starfish/"
  1889. component={withDomainRedirect(make(() => import('sentry/views/starfish/')))}
  1890. key="org-starfish"
  1891. >
  1892. {starfishChildRoutes}
  1893. </Route>
  1894. </Fragment>
  1895. );
  1896. const userFeedbackRoutes = (
  1897. <Fragment>
  1898. {usingCustomerDomain && (
  1899. <Route
  1900. path="/user-feedback/"
  1901. component={withDomainRequired(make(() => import('sentry/views/userFeedback')))}
  1902. key="orgless-user-feedback-route"
  1903. />
  1904. )}
  1905. <Route
  1906. path="/organizations/:orgId/user-feedback/"
  1907. component={withDomainRedirect(make(() => import('sentry/views/userFeedback')))}
  1908. key="org-user-feedback"
  1909. />
  1910. </Fragment>
  1911. );
  1912. const feedbackChildRoutes = (
  1913. <Fragment>
  1914. <IndexRoute
  1915. component={make(() => import('sentry/views/feedback/feedbackListPage'))}
  1916. />
  1917. </Fragment>
  1918. );
  1919. const feedbackv2Routes = (
  1920. <Fragment>
  1921. {usingCustomerDomain && (
  1922. <Route
  1923. path="/feedback/"
  1924. component={withDomainRequired(
  1925. make(() => import('sentry/views/feedback/index'))
  1926. )}
  1927. key="orgless-feedback-list-route"
  1928. >
  1929. {feedbackChildRoutes}
  1930. </Route>
  1931. )}
  1932. <Route
  1933. path="/organizations/:orgId/feedback/"
  1934. component={withDomainRedirect(make(() => import('sentry/views/feedback/index')))}
  1935. key="org-feedback-list-route"
  1936. >
  1937. {feedbackChildRoutes}
  1938. </Route>
  1939. </Fragment>
  1940. );
  1941. const issueListRoutes = (
  1942. <Fragment>
  1943. {usingCustomerDomain && (
  1944. <Route
  1945. path="/issues/(searches/:searchId/)"
  1946. component={withDomainRequired(errorHandler(IssueListContainer))}
  1947. key="orgless-issues-route"
  1948. >
  1949. <IndexRoute component={errorHandler(IssueListOverview)} />
  1950. </Route>
  1951. )}
  1952. <Route
  1953. path="/organizations/:orgId/issues/(searches/:searchId/)"
  1954. component={withDomainRedirect(errorHandler(IssueListContainer))}
  1955. key="org-issues"
  1956. >
  1957. <Redirect from="/organizations/:orgId/" to="/organizations/:orgId/issues/" />
  1958. <IndexRoute component={errorHandler(IssueListOverview)} />
  1959. </Route>
  1960. </Fragment>
  1961. );
  1962. // Once org issues is complete, these routes can be nested under
  1963. // /organizations/:orgId/issues
  1964. const issueTabs = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1965. const hoc = forCustomerDomain ? withDomainRequired : x => x;
  1966. return (
  1967. <Fragment>
  1968. <IndexRoute
  1969. component={hoc(
  1970. make(() => import('sentry/views/issueDetails/groupEventDetails'))
  1971. )}
  1972. />
  1973. <Route
  1974. path={TabPaths[Tab.REPLAYS]}
  1975. component={hoc(make(() => import('sentry/views/issueDetails/groupReplays')))}
  1976. />
  1977. <Route
  1978. path={TabPaths[Tab.ACTIVITY]}
  1979. component={hoc(make(() => import('sentry/views/issueDetails/groupActivity')))}
  1980. />
  1981. <Route
  1982. path={TabPaths[Tab.EVENTS]}
  1983. component={hoc(make(() => import('sentry/views/issueDetails/groupEvents')))}
  1984. />
  1985. <Route
  1986. path={TabPaths[Tab.TAGS]}
  1987. component={hoc(make(() => import('sentry/views/issueDetails/groupTags')))}
  1988. />
  1989. <Route
  1990. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1991. component={make(() => import('sentry/views/issueDetails/groupTagValues'))}
  1992. />
  1993. <Route
  1994. path={TabPaths[Tab.USER_FEEDBACK]}
  1995. component={hoc(
  1996. make(() => import('sentry/views/issueDetails/groupUserFeedback'))
  1997. )}
  1998. />
  1999. <Route
  2000. path={TabPaths[Tab.ATTACHMENTS]}
  2001. component={hoc(
  2002. make(() => import('sentry/views/issueDetails/groupEventAttachments'))
  2003. )}
  2004. />
  2005. <Route
  2006. path={TabPaths[Tab.SIMILAR_ISSUES]}
  2007. component={hoc(
  2008. make(() => import('sentry/views/issueDetails/groupSimilarIssues'))
  2009. )}
  2010. />
  2011. <Route
  2012. path={TabPaths[Tab.MERGED]}
  2013. component={hoc(make(() => import('sentry/views/issueDetails/groupMerged')))}
  2014. />
  2015. </Fragment>
  2016. );
  2017. };
  2018. const issueDetailsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => (
  2019. <Fragment>
  2020. {issueTabs({forCustomerDomain})}
  2021. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  2022. {issueTabs({forCustomerDomain})}
  2023. </Route>
  2024. </Fragment>
  2025. );
  2026. const issueDetailsRoutes = (
  2027. <Fragment>
  2028. <Route
  2029. path="/organizations/:orgId/issues/:groupId/"
  2030. component={withDomainRedirect(
  2031. make(() => import('sentry/views/issueDetails/groupDetails'))
  2032. )}
  2033. key="org-issues-group-id"
  2034. >
  2035. {issueDetailsChildRoutes({forCustomerDomain: false})}
  2036. </Route>
  2037. {usingCustomerDomain && (
  2038. <Route
  2039. path="/issues/:groupId/"
  2040. component={withDomainRequired(
  2041. make(() => import('sentry/views/issueDetails/groupDetails'))
  2042. )}
  2043. key="orgless-issues-group-id-route"
  2044. >
  2045. {issueDetailsChildRoutes({forCustomerDomain: true})}
  2046. </Route>
  2047. )}
  2048. </Fragment>
  2049. );
  2050. // These are the "manage" pages. For sentry.io, these are _different_ from
  2051. // the SaaS admin routes in getsentry.
  2052. const adminManageRoutes = (
  2053. <Route
  2054. path="/manage/"
  2055. component={make(() => import('sentry/views/admin/adminLayout'))}
  2056. >
  2057. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  2058. <Route
  2059. path="buffer/"
  2060. component={make(() => import('sentry/views/admin/adminBuffer'))}
  2061. />
  2062. <Route
  2063. path="relays/"
  2064. component={make(() => import('sentry/views/admin/adminRelays'))}
  2065. />
  2066. <Route
  2067. path="organizations/"
  2068. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  2069. />
  2070. <Route
  2071. path="projects/"
  2072. component={make(() => import('sentry/views/admin/adminProjects'))}
  2073. />
  2074. <Route
  2075. path="queue/"
  2076. component={make(() => import('sentry/views/admin/adminQueue'))}
  2077. />
  2078. <Route
  2079. path="quotas/"
  2080. component={make(() => import('sentry/views/admin/adminQuotas'))}
  2081. />
  2082. <Route
  2083. path="settings/"
  2084. component={make(() => import('sentry/views/admin/adminSettings'))}
  2085. />
  2086. <Route path="users/">
  2087. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  2088. <Route
  2089. path=":id"
  2090. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  2091. />
  2092. </Route>
  2093. <Route
  2094. path="status/mail/"
  2095. component={make(() => import('sentry/views/admin/adminMail'))}
  2096. />
  2097. <Route
  2098. path="status/environment/"
  2099. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  2100. />
  2101. <Route
  2102. path="status/packages/"
  2103. component={make(() => import('sentry/views/admin/adminPackages'))}
  2104. />
  2105. <Route
  2106. path="status/warnings/"
  2107. component={make(() => import('sentry/views/admin/adminWarnings'))}
  2108. />
  2109. </Route>
  2110. );
  2111. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  2112. // me why we need the OrganizationRoot root container.
  2113. const legacyOrganizationRootRoutes = (
  2114. <Route component={errorHandler(OrganizationRoot)}>
  2115. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  2116. <Route path="/organizations/:orgId/">
  2117. {hook('routes:organization')}
  2118. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  2119. <Redirect
  2120. from="/organizations/:orgId/teams/your-teams/"
  2121. to="/settings/:orgId/teams/"
  2122. />
  2123. <Redirect
  2124. from="/organizations/:orgId/teams/all-teams/"
  2125. to="/settings/:orgId/teams/"
  2126. />
  2127. <Redirect
  2128. from="/organizations/:orgId/teams/:teamId/"
  2129. to="/settings/:orgId/teams/:teamId/"
  2130. />
  2131. <Redirect
  2132. from="/organizations/:orgId/teams/:teamId/members/"
  2133. to="/settings/:orgId/teams/:teamId/members/"
  2134. />
  2135. <Redirect
  2136. from="/organizations/:orgId/teams/:teamId/projects/"
  2137. to="/settings/:orgId/teams/:teamId/projects/"
  2138. />
  2139. <Redirect
  2140. from="/organizations/:orgId/teams/:teamId/settings/"
  2141. to="/settings/:orgId/teams/:teamId/settings/"
  2142. />
  2143. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  2144. <Redirect
  2145. from="/organizations/:orgId/api-keys/"
  2146. to="/settings/:orgId/api-keys/"
  2147. />
  2148. <Redirect
  2149. from="/organizations/:orgId/api-keys/:apiKey/"
  2150. to="/settings/:orgId/api-keys/:apiKey/"
  2151. />
  2152. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  2153. <Redirect
  2154. from="/organizations/:orgId/members/:memberId/"
  2155. to="/settings/:orgId/members/:memberId/"
  2156. />
  2157. <Redirect
  2158. from="/organizations/:orgId/rate-limits/"
  2159. to="/settings/:orgId/rate-limits/"
  2160. />
  2161. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  2162. </Route>
  2163. </Route>
  2164. );
  2165. const gettingStartedRoutes = (
  2166. <Fragment>
  2167. {usingCustomerDomain && (
  2168. <Fragment>
  2169. <Redirect
  2170. from="/getting-started/:projectId/"
  2171. to="/projects/:projectId/getting-started/"
  2172. />
  2173. <Redirect
  2174. from="/getting-started/:projectId/:platform/"
  2175. to="/projects/:projectId/getting-started/"
  2176. />
  2177. </Fragment>
  2178. )}
  2179. <Redirect
  2180. from="/:orgId/:projectId/getting-started/"
  2181. to="/organizations/:orgId/projects/:projectId/getting-started/"
  2182. />
  2183. <Redirect
  2184. from="/:orgId/:projectId/getting-started/:platform/"
  2185. to="/organizations/:orgId/projects/:projectId/getting-started/"
  2186. />
  2187. </Fragment>
  2188. );
  2189. const profilingChildRoutes = (
  2190. <Fragment>
  2191. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  2192. <Route
  2193. path="summary/:projectId/"
  2194. component={make(() => import('sentry/views/profiling/profileSummary'))}
  2195. />
  2196. <Route
  2197. path="profile/:projectId/differential-flamegraph/"
  2198. component={make(() => import('sentry/views/profiling/differentialFlamegraph'))}
  2199. />
  2200. <Route
  2201. path="profile/:projectId/:eventId/"
  2202. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  2203. >
  2204. <Route
  2205. path="flamegraph/"
  2206. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  2207. />
  2208. </Route>
  2209. </Fragment>
  2210. );
  2211. const profilingRoutes = (
  2212. <Fragment>
  2213. {usingCustomerDomain && (
  2214. <Route
  2215. path="/profiling/"
  2216. component={withDomainRequired(make(() => import('sentry/views/profiling')))}
  2217. key="orgless-profiling-route"
  2218. >
  2219. {profilingChildRoutes}
  2220. </Route>
  2221. )}
  2222. <Route
  2223. path="/organizations/:orgId/profiling/"
  2224. component={withDomainRedirect(make(() => import('sentry/views/profiling')))}
  2225. key="org-profiling"
  2226. >
  2227. {profilingChildRoutes}
  2228. </Route>
  2229. </Fragment>
  2230. );
  2231. const ddmChildRoutes = (
  2232. <Fragment>
  2233. <IndexRoute component={make(() => import('sentry/views/ddm/ddm'))} />
  2234. </Fragment>
  2235. );
  2236. const ddmRoutes = (
  2237. <Fragment>
  2238. {usingCustomerDomain && (
  2239. <Route
  2240. path="/ddm/"
  2241. component={withDomainRequired(make(() => import('sentry/views/ddm')))}
  2242. key="orgless-ddm-route"
  2243. >
  2244. {ddmChildRoutes}
  2245. </Route>
  2246. )}
  2247. <Route
  2248. path="/organizations/:orgId/ddm/"
  2249. component={withDomainRedirect(make(() => import('sentry/views/ddm')))}
  2250. key="org-ddm"
  2251. >
  2252. {ddmChildRoutes}
  2253. </Route>
  2254. </Fragment>
  2255. );
  2256. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  2257. // canonical URLs.
  2258. //
  2259. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  2260. // or do these need to be nested into the OrganizationDetails tree?
  2261. const legacyOrgRedirects = (
  2262. <Route path="/:orgId/:projectId/">
  2263. <IndexRoute
  2264. component={errorHandler(
  2265. redirectDeprecatedProjectRoute(
  2266. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2267. )
  2268. )}
  2269. />
  2270. <Route
  2271. path="issues/"
  2272. component={errorHandler(
  2273. redirectDeprecatedProjectRoute(
  2274. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2275. )
  2276. )}
  2277. />
  2278. <Route
  2279. path="dashboard/"
  2280. component={errorHandler(
  2281. redirectDeprecatedProjectRoute(
  2282. ({orgId, projectId}) =>
  2283. `/organizations/${orgId}/dashboards/?project=${projectId}`
  2284. )
  2285. )}
  2286. />
  2287. <Route
  2288. path="user-feedback/"
  2289. component={errorHandler(
  2290. redirectDeprecatedProjectRoute(
  2291. ({orgId, projectId}) =>
  2292. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  2293. )
  2294. )}
  2295. />
  2296. <Route
  2297. path="releases/"
  2298. component={errorHandler(
  2299. redirectDeprecatedProjectRoute(
  2300. ({orgId, projectId}) =>
  2301. `/organizations/${orgId}/releases/?project=${projectId}`
  2302. )
  2303. )}
  2304. />
  2305. <Route
  2306. path="releases/:version/"
  2307. component={errorHandler(
  2308. redirectDeprecatedProjectRoute(
  2309. ({orgId, projectId, router}) =>
  2310. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  2311. )
  2312. )}
  2313. />
  2314. <Route
  2315. path="releases/:version/new-events/"
  2316. component={errorHandler(
  2317. redirectDeprecatedProjectRoute(
  2318. ({orgId, projectId, router}) =>
  2319. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  2320. )
  2321. )}
  2322. />
  2323. <Route
  2324. path="releases/:version/all-events/"
  2325. component={errorHandler(
  2326. redirectDeprecatedProjectRoute(
  2327. ({orgId, projectId, router}) =>
  2328. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  2329. )
  2330. )}
  2331. />
  2332. <Route
  2333. path="releases/:version/commits/"
  2334. component={errorHandler(
  2335. redirectDeprecatedProjectRoute(
  2336. ({orgId, projectId, router}) =>
  2337. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  2338. )
  2339. )}
  2340. />
  2341. </Route>
  2342. );
  2343. const organizationRoutes = (
  2344. <Route component={errorHandler(OrganizationDetails)}>
  2345. {settingsRoutes}
  2346. {projectsRoutes}
  2347. {dashboardRoutes}
  2348. {userFeedbackRoutes}
  2349. {feedbackv2Routes}
  2350. {issueListRoutes}
  2351. {issueDetailsRoutes}
  2352. {alertRoutes}
  2353. {cronsRoutes}
  2354. {replayRoutes}
  2355. {releasesRoutes}
  2356. {releaseThresholdRoutes}
  2357. {activityRoutes}
  2358. {statsRoutes}
  2359. {discoverRoutes}
  2360. {performanceRoutes}
  2361. {starfishRoutes}
  2362. {profilingRoutes}
  2363. {ddmRoutes}
  2364. {gettingStartedRoutes}
  2365. {adminManageRoutes}
  2366. {legacyOrganizationRootRoutes}
  2367. {legacyOrgRedirects}
  2368. </Route>
  2369. );
  2370. const legacyRedirectRoutes = (
  2371. <Route path="/:orgId/">
  2372. <IndexRedirect to="/organizations/:orgId/" />
  2373. <Route path=":projectId/settings/">
  2374. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2375. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2376. <Redirect
  2377. from="alerts/rules/"
  2378. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2379. />
  2380. <Redirect
  2381. from="alerts/rules/new/"
  2382. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2383. />
  2384. <Redirect
  2385. from="alerts/rules/:ruleId/"
  2386. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2387. />
  2388. <Redirect
  2389. from="environments/"
  2390. to="/settings/:orgId/projects/:projectId/environments/"
  2391. />
  2392. <Redirect
  2393. from="environments/hidden/"
  2394. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2395. />
  2396. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2397. <Redirect
  2398. from="issue-tracking/"
  2399. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2400. />
  2401. <Redirect
  2402. from="release-tracking/"
  2403. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2404. />
  2405. <Redirect
  2406. from="ownership/"
  2407. to="/settings/:orgId/projects/:projectId/ownership/"
  2408. />
  2409. <Redirect
  2410. from="data-forwarding/"
  2411. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2412. />
  2413. <Redirect
  2414. from="debug-symbols/"
  2415. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2416. />
  2417. <Redirect
  2418. from="processing-issues/"
  2419. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2420. />
  2421. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2422. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2423. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2424. <Redirect
  2425. from="keys/:keyId/"
  2426. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2427. />
  2428. <Redirect
  2429. from="user-feedback/"
  2430. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2431. />
  2432. <Redirect
  2433. from="security-headers/"
  2434. to="/settings/:orgId/projects/:projectId/security-headers/"
  2435. />
  2436. <Redirect
  2437. from="security-headers/csp/"
  2438. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2439. />
  2440. <Redirect
  2441. from="security-headers/expect-ct/"
  2442. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2443. />
  2444. <Redirect
  2445. from="security-headers/hpkp/"
  2446. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2447. />
  2448. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2449. <Redirect
  2450. from="plugins/:pluginId/"
  2451. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2452. />
  2453. <Redirect
  2454. from="integrations/:providerKey/"
  2455. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2456. />
  2457. </Route>
  2458. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2459. <Redirect
  2460. from=":projectId/issues/:groupId/"
  2461. to="/organizations/:orgId/issues/:groupId/"
  2462. />
  2463. <Redirect
  2464. from=":projectId/issues/:groupId/events/"
  2465. to="/organizations/:orgId/issues/:groupId/events/"
  2466. />
  2467. <Redirect
  2468. from=":projectId/issues/:groupId/events/:eventId/"
  2469. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2470. />
  2471. <Redirect
  2472. from=":projectId/issues/:groupId/tags/"
  2473. to="/organizations/:orgId/issues/:groupId/tags/"
  2474. />
  2475. <Redirect
  2476. from=":projectId/issues/:groupId/tags/:tagKey/"
  2477. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2478. />
  2479. <Redirect
  2480. from=":projectId/issues/:groupId/feedback/"
  2481. to="/organizations/:orgId/issues/:groupId/feedback/"
  2482. />
  2483. <Redirect
  2484. from=":projectId/issues/:groupId/similar/"
  2485. to="/organizations/:orgId/issues/:groupId/similar/"
  2486. />
  2487. <Redirect
  2488. from=":projectId/issues/:groupId/merged/"
  2489. to="/organizations/:orgId/issues/:groupId/merged/"
  2490. />
  2491. <Route
  2492. path=":projectId/events/:eventId/"
  2493. component={errorHandler(ProjectEventRedirect)}
  2494. />
  2495. </Route>
  2496. );
  2497. const appRoutes = (
  2498. <Route>
  2499. {experimentalSpaRoutes}
  2500. <Route path="/" component={errorHandler(App)}>
  2501. {rootRoutes}
  2502. {organizationRoutes}
  2503. {legacyRedirectRoutes}
  2504. <Route path="*" component={errorHandler(RouteNotFound)} />
  2505. </Route>
  2506. </Route>
  2507. );
  2508. return appRoutes;
  2509. }
  2510. // We load routes both when initializing the SDK (for routing integrations) and
  2511. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2512. export const routes = memoize(buildRoutes);
  2513. // Exported for use in tests.
  2514. export {buildRoutes};
  2515. function NoOp(props: {children: React.ReactNode}) {
  2516. return <Fragment>{props.children}</Fragment>;
  2517. }