routes.tsx 80 KB

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