routes.tsx 73 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311
  1. import {Fragment, lazy} from 'react';
  2. import {IndexRedirect, Redirect} from 'react-router';
  3. import memoize from 'lodash/memoize';
  4. import LazyLoad from 'sentry/components/lazyLoad';
  5. import {EXPERIMENTAL_SPA, USING_CUSTOMER_DOMAIN} from 'sentry/constants';
  6. import {t} from 'sentry/locale';
  7. import HookStore from 'sentry/stores/hookStore';
  8. import type {HookName} from 'sentry/types/hooks';
  9. import errorHandler from 'sentry/utils/errorHandler';
  10. import retryableImport from 'sentry/utils/retryableImport';
  11. import withDomainRedirect from 'sentry/utils/withDomainRedirect';
  12. import withDomainRequired from 'sentry/utils/withDomainRequired';
  13. import App from 'sentry/views/app';
  14. import AuthLayout from 'sentry/views/auth/layout';
  15. import {Tab, TabPaths} from 'sentry/views/issueDetails/types';
  16. import IssueListContainer from 'sentry/views/issueList';
  17. import IssueListOverview from 'sentry/views/issueList/overview';
  18. import OrganizationContainer from 'sentry/views/organizationContainer';
  19. import OrganizationLayout from 'sentry/views/organizationLayout';
  20. import OrganizationRoot from 'sentry/views/organizationRoot';
  21. import ProjectEventRedirect from 'sentry/views/projectEventRedirect';
  22. import redirectDeprecatedProjectRoute from 'sentry/views/projects/redirectDeprecatedProjectRoute';
  23. import RouteNotFound from 'sentry/views/routeNotFound';
  24. import SettingsWrapper from 'sentry/views/settings/components/settingsWrapper';
  25. import {IndexRoute, Route} from './components/route';
  26. const hook = (name: HookName) => HookStore.get(name).map(cb => cb());
  27. // LazyExoticComponent Props get crazy when wrapped in an additional layer
  28. const SafeLazyLoad = errorHandler(LazyLoad) as unknown as React.ComponentType<
  29. typeof LazyLoad
  30. >;
  31. // NOTE: makeLazyloadComponent is exported for use in the sentry.io (getsentry)
  32. // pirvate routing tree.
  33. /**
  34. * Factory function to produce a component that will render the SafeLazyLoad
  35. * _with_ the required props.
  36. */
  37. export function makeLazyloadComponent<C extends React.ComponentType<any>>(
  38. resolve: () => Promise<{default: C}>
  39. ) {
  40. const LazyComponent = lazy<C>(() => retryableImport(resolve));
  41. // XXX: Assign the component to a variable so it has a displayname
  42. function RouteLazyLoad(props: React.ComponentProps<C>) {
  43. // we can use this hook to set the organization as it's
  44. // a child of the organization context
  45. return <SafeLazyLoad {...props} LazyComponent={LazyComponent} />;
  46. }
  47. return RouteLazyLoad;
  48. }
  49. // Shorthand to avoid extra line wrapping
  50. const make = makeLazyloadComponent;
  51. function buildRoutes() {
  52. // Read this to understand where to add new routes, how / why the routing
  53. // tree is structured the way it is, and how the lazy-loading /
  54. // code-splitting works for pages.
  55. //
  56. // ## Formatting
  57. //
  58. // NOTE that there are intentionally NO blank lines within route tree blocks.
  59. // This helps make it easier to navigate within the file by using your
  60. // editors shortcuts to jump between 'paragraphs' of code.
  61. //
  62. // [!!] Do NOT add blank lines within route blocks to preserve this behavior!
  63. //
  64. //
  65. // ## Lazy loading
  66. //
  67. // * The `SafeLazyLoad` component
  68. //
  69. // Most routes are rendered as LazyLoad components (SafeLazyLoad is the
  70. // errorHandler wrapped version). This means the rendered component for the
  71. // route will only be loaded when the route is loaded. This helps us
  72. // "code-split" the app.
  73. //
  74. // ## Hooks
  75. //
  76. // There are a number of `hook()` routes placed within the routing tree to
  77. // allow for additional routes to be augmented into the application via the
  78. // hookStore mechanism.
  79. //
  80. //
  81. // ## The structure
  82. //
  83. // * `experimentalSpaRoutes`
  84. //
  85. // These routes are specifically for the experimental single-page-app mode,
  86. // where Sentry is run separate from Django. These are NOT part of the root
  87. // <App /> component.
  88. //
  89. // Right now these are mainly used for authentication pages. In the future
  90. // they would be used for other pages like registration.
  91. //
  92. // * `rootRoutes`
  93. //
  94. // These routes live directly under the <App /> container, and generally
  95. // are not specific to an organization.
  96. //
  97. // * `settingsRoutes`
  98. //
  99. // This is the route tree for all of `/settings/`. This route tree is
  100. // composed of a few different sub-trees.
  101. //
  102. // - `accountSettingsRoutes` User specific settings
  103. // - `orgSettingsRoutes` Specific to a organization
  104. // - `projectSettingsRoutes` Specific to a project
  105. // - `legacySettingsRedirects` Routes that used to exist in settings
  106. //
  107. // * `organizationRoutes`
  108. //
  109. // This is where a majority of the app routes live. This is wrapped with
  110. // the <OrganizationLayout /> component, which renders the sidebar and
  111. // loads the organiztion into context (though in some cases, there may be
  112. // no organiztion)
  113. //
  114. // When adding new top-level organization routes, be sure the top level
  115. // route includes withOrgPath to support installs that are not using
  116. // customer domains.
  117. //
  118. // Within these routes are a variety of subroutes. They are not all
  119. // listed here as the subroutes will be added and removed, and most are
  120. // self explanatory.
  121. //
  122. // * `legacyRedirectRoutes`
  123. //
  124. // This route tree contains <Redirect /> routes for many old legacy paths.
  125. //
  126. // You may also find <Redirect />'s collocated next to the feature routes
  127. // they have redirects for. A good rule here is to place 'helper' redirects
  128. // next to the routes they redirect to, and place 'legacy route' redirects
  129. // for routes that have completely changed in this tree.
  130. const experimentalSpaRoutes = EXPERIMENTAL_SPA ? (
  131. <Route path="/auth/login/" component={errorHandler(AuthLayout)}>
  132. <IndexRoute component={make(() => import('sentry/views/auth/login'))} />
  133. <Route path=":orgId/" component={make(() => import('sentry/views/auth/login'))} />
  134. </Route>
  135. ) : null;
  136. const rootRoutes = (
  137. <Fragment>
  138. <IndexRoute component={make(() => import('sentry/views/app/root'))} />
  139. {hook('routes:root')}
  140. <Route
  141. path="/accept/:orgId/:memberId/:token/"
  142. component={make(() => import('sentry/views/acceptOrganizationInvite'))}
  143. />
  144. <Route
  145. path="/accept/:memberId/:token/"
  146. component={make(() => import('sentry/views/acceptOrganizationInvite'))}
  147. />
  148. <Route
  149. path="/accept-transfer/"
  150. component={make(() => import('sentry/views/acceptProjectTransfer'))}
  151. />
  152. <Route component={errorHandler(OrganizationContainer)}>
  153. <Route
  154. path="/extensions/external-install/:integrationSlug/:installationId"
  155. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  156. />
  157. <Route
  158. path="/extensions/:integrationSlug/link/"
  159. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  160. />
  161. </Route>
  162. <Route
  163. path="/sentry-apps/:sentryAppSlug/external-install/"
  164. component={make(() => import('sentry/views/sentryAppExternalInstallation'))}
  165. />
  166. <Redirect from="/account/" to="/settings/account/details/" />
  167. <Redirect from="/share/group/:shareId/" to="/share/issue/:shareId/" />
  168. {/* TODO: remove share/issue orgless url */}
  169. <Route
  170. path="/share/issue/:shareId/"
  171. component={make(() => import('sentry/views/sharedGroupDetails'))}
  172. />
  173. <Route
  174. path="/organizations/:orgId/share/issue/:shareId/"
  175. component={make(() => import('sentry/views/sharedGroupDetails'))}
  176. />
  177. {USING_CUSTOMER_DOMAIN && (
  178. <Route
  179. path="/unsubscribe/project/:id/"
  180. component={make(() => import('sentry/views/unsubscribe/project'))}
  181. />
  182. )}
  183. <Route
  184. path="/unsubscribe/:orgId/project/:id/"
  185. component={make(() => import('sentry/views/unsubscribe/project'))}
  186. />
  187. {USING_CUSTOMER_DOMAIN && (
  188. <Route
  189. path="/unsubscribe/issue/:id/"
  190. component={make(() => import('sentry/views/unsubscribe/issue'))}
  191. />
  192. )}
  193. <Route
  194. path="/unsubscribe/:orgId/issue/:id/"
  195. component={make(() => import('sentry/views/unsubscribe/issue'))}
  196. />
  197. <Route
  198. path="/organizations/new/"
  199. component={make(() => import('sentry/views/organizationCreate'))}
  200. />
  201. {USING_CUSTOMER_DOMAIN && (
  202. <Route
  203. path="/data-export/:dataExportId"
  204. component={withDomainRequired(
  205. make(() => import('sentry/views/dataExport/dataDownload'))
  206. )}
  207. key="orgless-data-export-route"
  208. />
  209. )}
  210. <Route
  211. path="/organizations/:orgId/data-export/:dataExportId"
  212. component={withDomainRedirect(
  213. make(() => import('sentry/views/dataExport/dataDownload'))
  214. )}
  215. key="org-data-export"
  216. />
  217. <Route component={errorHandler(OrganizationContainer)}>
  218. {USING_CUSTOMER_DOMAIN && (
  219. <Route
  220. path="/disabled-member/"
  221. component={withDomainRequired(
  222. make(() => import('sentry/views/disabledMember'))
  223. )}
  224. key="orgless-disabled-member-route"
  225. />
  226. )}
  227. <Route
  228. path="/organizations/:orgId/disabled-member/"
  229. component={withDomainRedirect(
  230. make(() => import('sentry/views/disabledMember'))
  231. )}
  232. key="org-disabled-member"
  233. />
  234. </Route>
  235. {USING_CUSTOMER_DOMAIN && (
  236. <Route
  237. path="/restore/"
  238. component={make(() => import('sentry/views/organizationRestore'))}
  239. />
  240. )}
  241. <Route
  242. path="/organizations/:orgId/restore/"
  243. component={make(() => import('sentry/views/organizationRestore'))}
  244. />
  245. {USING_CUSTOMER_DOMAIN && (
  246. <Route
  247. path="/join-request/"
  248. component={withDomainRequired(
  249. make(() => import('sentry/views/organizationJoinRequest'))
  250. )}
  251. key="orgless-join-request"
  252. />
  253. )}
  254. <Route
  255. path="/join-request/:orgId/"
  256. component={withDomainRedirect(
  257. make(() => import('sentry/views/organizationJoinRequest'))
  258. )}
  259. key="org-join-request"
  260. />
  261. <Route
  262. path="/relocation/"
  263. component={make(() => import('sentry/views/relocation'))}
  264. key="orgless-relocation"
  265. >
  266. <IndexRedirect to="get-started/" />
  267. <Route path=":step/" component={make(() => import('sentry/views/relocation'))} />
  268. </Route>
  269. {USING_CUSTOMER_DOMAIN && (
  270. <Route
  271. path="/onboarding/"
  272. component={errorHandler(withDomainRequired(OrganizationContainer))}
  273. key="orgless-onboarding"
  274. >
  275. <IndexRedirect to="welcome/" />
  276. <Route
  277. path=":step/"
  278. component={make(() => import('sentry/views/onboarding'))}
  279. />
  280. </Route>
  281. )}
  282. <Route
  283. path="/onboarding/:orgId/"
  284. component={withDomainRedirect(errorHandler(OrganizationContainer))}
  285. key="org-onboarding"
  286. >
  287. <IndexRedirect to="welcome/" />
  288. <Route path=":step/" component={make(() => import('sentry/views/onboarding'))} />
  289. </Route>
  290. {USING_CUSTOMER_DOMAIN && (
  291. <Route
  292. path="/stories/"
  293. component={make(() => import('sentry/views/stories/index'))}
  294. key="orgless-stories"
  295. />
  296. )}
  297. <Route
  298. path="/organizations/:orgId/stories/"
  299. component={withDomainRedirect(make(() => import('sentry/views/stories/index')))}
  300. key="org-stories"
  301. />
  302. </Fragment>
  303. );
  304. const accountSettingsRoutes = (
  305. <Route
  306. path="account/"
  307. name={t('Account')}
  308. component={make(
  309. () => import('sentry/views/settings/account/accountSettingsLayout')
  310. )}
  311. >
  312. <IndexRedirect to="details/" />
  313. <Route
  314. path="details/"
  315. name={t('Details')}
  316. component={make(() => import('sentry/views/settings/account/accountDetails'))}
  317. />
  318. <Route path="notifications/" name={t('Notifications')}>
  319. <IndexRoute
  320. component={make(
  321. () =>
  322. import(
  323. 'sentry/views/settings/account/notifications/notificationSettingsController'
  324. )
  325. )}
  326. />
  327. <Route
  328. path=":fineTuneType/"
  329. name={t('Fine Tune Alerts')}
  330. component={make(
  331. () =>
  332. import(
  333. 'sentry/views/settings/account/accountNotificationFineTuningController'
  334. )
  335. )}
  336. />
  337. </Route>
  338. <Route
  339. path="emails/"
  340. name={t('Emails')}
  341. component={make(() => import('sentry/views/settings/account/accountEmails'))}
  342. />
  343. <Route
  344. path="authorizations/"
  345. component={make(
  346. () => import('sentry/views/settings/account/accountAuthorizations')
  347. )}
  348. />
  349. <Route path="security/" name={t('Security')}>
  350. <Route
  351. component={make(
  352. () =>
  353. import(
  354. 'sentry/views/settings/account/accountSecurity/accountSecurityWrapper'
  355. )
  356. )}
  357. >
  358. <IndexRoute
  359. component={make(
  360. () => import('sentry/views/settings/account/accountSecurity')
  361. )}
  362. />
  363. <Route
  364. path="session-history/"
  365. name={t('Session History')}
  366. component={make(
  367. () => import('sentry/views/settings/account/accountSecurity/sessionHistory')
  368. )}
  369. />
  370. <Route
  371. path="mfa/:authId/"
  372. name={t('Details')}
  373. component={make(
  374. () =>
  375. import(
  376. 'sentry/views/settings/account/accountSecurity/accountSecurityDetails'
  377. )
  378. )}
  379. />
  380. </Route>
  381. <Route
  382. path="mfa/:authId/enroll/"
  383. name={t('Enroll')}
  384. component={make(
  385. () =>
  386. import(
  387. 'sentry/views/settings/account/accountSecurity/accountSecurityEnroll'
  388. )
  389. )}
  390. />
  391. </Route>
  392. <Route
  393. path="subscriptions/"
  394. name={t('Subscriptions')}
  395. component={make(
  396. () => import('sentry/views/settings/account/accountSubscriptions')
  397. )}
  398. />
  399. <Route
  400. path="identities/"
  401. name={t('Identities')}
  402. component={make(() => import('sentry/views/settings/account/accountIdentities'))}
  403. />
  404. <Route path="api/" name={t('API')}>
  405. <IndexRedirect to="auth-tokens/" />
  406. <Route path="auth-tokens/" name={t('User Auth Tokens')}>
  407. <IndexRoute
  408. component={make(() => import('sentry/views/settings/account/apiTokens'))}
  409. />
  410. <Route
  411. path="new-token/"
  412. name={t('Create New Token')}
  413. component={make(() => import('sentry/views/settings/account/apiNewToken'))}
  414. />
  415. </Route>
  416. <Route path="applications/" name={t('Applications')}>
  417. <IndexRoute
  418. component={make(
  419. () => import('sentry/views/settings/account/apiApplications')
  420. )}
  421. />
  422. <Route
  423. path=":appId/"
  424. name={t('Details')}
  425. component={make(
  426. () => import('sentry/views/settings/account/apiApplications/details')
  427. )}
  428. />
  429. </Route>
  430. {hook('routes:api')}
  431. </Route>
  432. <Route
  433. path="close-account/"
  434. name={t('Close Account')}
  435. component={make(() => import('sentry/views/settings/account/accountClose'))}
  436. />
  437. </Route>
  438. );
  439. const projectSettingsRoutes = (
  440. <Route
  441. path="projects/:projectId/"
  442. name={t('Project')}
  443. component={make(
  444. () => import('sentry/views/settings/project/projectSettingsLayout')
  445. )}
  446. >
  447. <IndexRoute
  448. name={t('General')}
  449. component={make(() => import('sentry/views/settings/projectGeneralSettings'))}
  450. />
  451. <Redirect from="install/" to="/projects/:projectId/getting-started/" />
  452. <Route
  453. path="teams/"
  454. name={t('Teams')}
  455. component={make(() => import('sentry/views/settings/project/projectTeams'))}
  456. />
  457. <Route
  458. path="alerts/"
  459. name={t('Alerts')}
  460. component={make(() => import('sentry/views/settings/projectAlerts'))}
  461. >
  462. <IndexRoute
  463. component={make(() => import('sentry/views/settings/projectAlerts/settings'))}
  464. />
  465. <Redirect from="new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  466. <Redirect from="rules/" to="/organizations/:orgId/alerts/rules/" />
  467. <Redirect from="rules/new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  468. <Redirect
  469. from="metric-rules/new/"
  470. to="/organizations/:orgId/alerts/:projectId/new/"
  471. />
  472. <Redirect
  473. from="rules/:ruleId/"
  474. to="/organizations/:orgId/alerts/rules/:projectId/:ruleId/"
  475. />
  476. <Redirect
  477. from="metric-rules/:ruleId/"
  478. to="/organizations/:orgId/alerts/metric-rules/:projectId/:ruleId/"
  479. />
  480. </Route>
  481. <Route
  482. path="environments/"
  483. name={t('Environments')}
  484. component={make(
  485. () => import('sentry/views/settings/project/projectEnvironments')
  486. )}
  487. >
  488. <IndexRoute />
  489. <Route path="hidden/" />
  490. </Route>
  491. <Route
  492. path="tags/"
  493. name={t('Tags & Context')}
  494. component={make(() => import('sentry/views/settings/projectTags'))}
  495. />
  496. <Redirect from="issue-tracking/" to="/settings/:orgId/:projectId/plugins/" />
  497. <Route
  498. path="release-tracking/"
  499. name={t('Release Tracking')}
  500. component={make(
  501. () => import('sentry/views/settings/project/projectReleaseTracking')
  502. )}
  503. />
  504. <Route
  505. path="ownership/"
  506. name={t('Ownership Rules')}
  507. component={make(() => import('sentry/views/settings/project/projectOwnership'))}
  508. />
  509. <Route
  510. path="data-forwarding/"
  511. name={t('Data Forwarding')}
  512. component={make(() => import('sentry/views/settings/projectDataForwarding'))}
  513. />
  514. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  515. <IndexRoute
  516. component={make(
  517. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  518. )}
  519. />
  520. <Route
  521. path="advanced-data-scrubbing/:scrubbingId/"
  522. component={make(
  523. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  524. )}
  525. />
  526. </Route>
  527. <Route
  528. path="debug-symbols/"
  529. name={t('Debug Information Files')}
  530. component={make(() => import('sentry/views/settings/projectDebugFiles'))}
  531. />
  532. <Route
  533. path="proguard/"
  534. name={t('ProGuard Mappings')}
  535. component={make(() => import('sentry/views/settings/projectProguard'))}
  536. />
  537. <Route
  538. path="performance/"
  539. name={t('Performance')}
  540. component={make(() => import('sentry/views/settings/projectPerformance'))}
  541. />
  542. <Route path="metrics/" name={t('Metrics')}>
  543. <IndexRoute
  544. component={make(() => import('sentry/views/settings/projectMetrics'))}
  545. />
  546. <Route
  547. name={t('Metrics Details')}
  548. path=":mri/"
  549. component={make(
  550. () => import('sentry/views/settings/projectMetrics/projectMetricsDetails')
  551. )}
  552. />
  553. </Route>
  554. <Route
  555. path="replays/"
  556. name={t('Replays')}
  557. component={make(() => import('sentry/views/settings/project/projectReplays'))}
  558. />
  559. <Route
  560. path="user-feedback-processing/"
  561. name={t('User Feedback')}
  562. component={make(
  563. () => import('sentry/views/settings/project/projectUserFeedbackProcessing')
  564. )}
  565. />
  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. {!USING_CUSTOMER_DOMAIN && (
  707. <IndexRoute
  708. name={t('General')}
  709. component={make(
  710. () => import('sentry/views/settings/organizationGeneralSettings')
  711. )}
  712. />
  713. )}
  714. {USING_CUSTOMER_DOMAIN && (
  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. {USING_CUSTOMER_DOMAIN && (
  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 projectsRoutes = (
  1060. <Route
  1061. path="/projects/"
  1062. component={make(() => import('sentry/views/projects/'))}
  1063. withOrgPath
  1064. >
  1065. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  1066. <Route
  1067. path="new/"
  1068. component={make(() => import('sentry/views/projectInstall/newProject'))}
  1069. />
  1070. <Route
  1071. path=":projectId/"
  1072. component={make(() => import('sentry/views/projectDetail'))}
  1073. />
  1074. <Route
  1075. path=":projectId/events/:eventId/"
  1076. component={errorHandler(ProjectEventRedirect)}
  1077. />
  1078. <Route
  1079. path=":projectId/getting-started/"
  1080. component={make(
  1081. () => import('sentry/views/projectInstall/platformOrIntegration')
  1082. )}
  1083. />
  1084. </Route>
  1085. );
  1086. const dashboardRoutes = (
  1087. <Fragment>
  1088. <Fragment>
  1089. {USING_CUSTOMER_DOMAIN && (
  1090. <Route
  1091. path="/dashboards/"
  1092. component={withDomainRequired(make(() => import('sentry/views/dashboards')))}
  1093. key="orgless-dashboards-route"
  1094. >
  1095. <IndexRoute
  1096. component={make(() => import('sentry/views/dashboards/manage'))}
  1097. />
  1098. </Route>
  1099. )}
  1100. <Route
  1101. path="/organizations/:orgId/dashboards/"
  1102. component={withDomainRedirect(make(() => import('sentry/views/dashboards')))}
  1103. key="org-dashboards"
  1104. >
  1105. <IndexRoute component={make(() => import('sentry/views/dashboards/manage'))} />
  1106. </Route>
  1107. </Fragment>
  1108. <Fragment>
  1109. {USING_CUSTOMER_DOMAIN && (
  1110. <Route
  1111. path="/dashboards/new/"
  1112. component={withDomainRequired(
  1113. make(() => import('sentry/views/dashboards/create'))
  1114. )}
  1115. key="orgless-dashboards-new-route"
  1116. >
  1117. <Route
  1118. path="widget/:widgetIndex/edit/"
  1119. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1120. />
  1121. <Route
  1122. path="widget/new/"
  1123. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1124. />
  1125. </Route>
  1126. )}
  1127. <Route
  1128. path="/organizations/:orgId/dashboards/new/"
  1129. component={withDomainRedirect(
  1130. make(() => import('sentry/views/dashboards/create'))
  1131. )}
  1132. key="org-dashboards-new"
  1133. >
  1134. <Route
  1135. path="widget/:widgetIndex/edit/"
  1136. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1137. />
  1138. <Route
  1139. path="widget/new/"
  1140. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1141. />
  1142. </Route>
  1143. </Fragment>
  1144. <Fragment>
  1145. {USING_CUSTOMER_DOMAIN && (
  1146. <Route
  1147. path="/dashboards/new/:templateId"
  1148. component={withDomainRequired(
  1149. make(() => import('sentry/views/dashboards/create'))
  1150. )}
  1151. key="orgless-dashboards-new-template-route"
  1152. >
  1153. <Route
  1154. path="widget/:widgetId/"
  1155. component={make(() => import('sentry/views/dashboards/create'))}
  1156. />
  1157. </Route>
  1158. )}
  1159. <Route
  1160. path="/organizations/:orgId/dashboards/new/:templateId"
  1161. component={withDomainRedirect(
  1162. make(() => import('sentry/views/dashboards/create'))
  1163. )}
  1164. key="org-dashboards-new-template"
  1165. >
  1166. <Route
  1167. path="widget/:widgetId/"
  1168. component={make(() => import('sentry/views/dashboards/create'))}
  1169. />
  1170. </Route>
  1171. </Fragment>
  1172. <Redirect
  1173. from="/organizations/:orgId/dashboards/:dashboardId/"
  1174. to="/organizations/:orgId/dashboard/:dashboardId/"
  1175. />
  1176. {USING_CUSTOMER_DOMAIN && (
  1177. <Redirect from="/dashboards/:dashboardId/" to="/dashboard/:dashboardId/" />
  1178. )}
  1179. <Route
  1180. path="/dashboard/:dashboardId/"
  1181. component={make(() => import('sentry/views/dashboards/view'))}
  1182. withOrgPath
  1183. >
  1184. <Route
  1185. path="widget/:widgetIndex/edit/"
  1186. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1187. />
  1188. <Route
  1189. path="widget/new/"
  1190. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1191. />
  1192. <Route
  1193. path="widget/:widgetId/"
  1194. component={make(() => import('sentry/views/dashboards/view'))}
  1195. />
  1196. </Route>
  1197. </Fragment>
  1198. );
  1199. const alertChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1200. // ALERT CHILD ROUTES
  1201. return (
  1202. <Fragment>
  1203. <IndexRoute
  1204. component={make(() => import('sentry/views/alerts/list/incidents'))}
  1205. />
  1206. <Route path="rules/">
  1207. <IndexRoute
  1208. component={make(
  1209. () => import('sentry/views/alerts/list/rules/alertRulesList')
  1210. )}
  1211. />
  1212. <Route
  1213. path="details/:ruleId/"
  1214. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  1215. />
  1216. <Route
  1217. path=":projectId/"
  1218. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1219. >
  1220. <IndexRedirect
  1221. to={
  1222. forCustomerDomain
  1223. ? '/alerts/rules/'
  1224. : '/organizations/:orgId/alerts/rules/'
  1225. }
  1226. />
  1227. <Route
  1228. path=":ruleId/"
  1229. component={make(() => import('sentry/views/alerts/edit'))}
  1230. />
  1231. </Route>
  1232. <Route path=":projectId/:ruleId/details/">
  1233. <IndexRoute
  1234. component={make(
  1235. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  1236. )}
  1237. />
  1238. </Route>
  1239. </Route>
  1240. <Route path="metric-rules/">
  1241. <IndexRedirect
  1242. to={
  1243. forCustomerDomain ? '/alerts/rules/' : '/organizations/:orgId/alerts/rules/'
  1244. }
  1245. />
  1246. <Route
  1247. path=":projectId/"
  1248. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1249. >
  1250. <IndexRedirect
  1251. to={
  1252. forCustomerDomain
  1253. ? '/alerts/rules/'
  1254. : '/organizations/:orgId/alerts/rules/'
  1255. }
  1256. />
  1257. <Route
  1258. path=":ruleId/"
  1259. component={make(() => import('sentry/views/alerts/edit'))}
  1260. />
  1261. </Route>
  1262. </Route>
  1263. <Route
  1264. path="wizard/"
  1265. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1266. >
  1267. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  1268. </Route>
  1269. <Route
  1270. path="new/"
  1271. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1272. >
  1273. <IndexRedirect
  1274. to={
  1275. forCustomerDomain
  1276. ? '/alerts/wizard/'
  1277. : '/organizations/:orgId/alerts/wizard/'
  1278. }
  1279. />
  1280. <Route
  1281. path=":alertType/"
  1282. component={make(() => import('sentry/views/alerts/create'))}
  1283. />
  1284. </Route>
  1285. <Route
  1286. path=":alertId/"
  1287. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1288. />
  1289. <Route
  1290. path=":projectId/"
  1291. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1292. >
  1293. <Route
  1294. path="new/"
  1295. component={make(() => import('sentry/views/alerts/create'))}
  1296. />
  1297. <Route
  1298. path="wizard/"
  1299. component={make(() => import('sentry/views/alerts/wizard'))}
  1300. />
  1301. </Route>
  1302. </Fragment>
  1303. );
  1304. };
  1305. // ALERT ROUTES
  1306. const alertRoutes = (
  1307. <Fragment>
  1308. {USING_CUSTOMER_DOMAIN && (
  1309. <Route
  1310. path="/alerts/"
  1311. component={withDomainRequired(make(() => import('sentry/views/alerts')))}
  1312. key="orgless-alerts-route"
  1313. >
  1314. {alertChildRoutes({forCustomerDomain: true})}
  1315. </Route>
  1316. )}
  1317. <Route
  1318. path="/organizations/:orgId/alerts/"
  1319. component={withDomainRedirect(make(() => import('sentry/views/alerts')))}
  1320. key="org-alerts"
  1321. >
  1322. {alertChildRoutes({forCustomerDomain: false})}
  1323. </Route>
  1324. </Fragment>
  1325. );
  1326. const cronsRoutes = (
  1327. <Route
  1328. path="/crons/"
  1329. component={make(() => import('sentry/views/monitors'))}
  1330. withOrgPath
  1331. >
  1332. <IndexRoute component={make(() => import('sentry/views/monitors/overview'))} />
  1333. <Route
  1334. path="create/"
  1335. component={make(() => import('sentry/views/monitors/create'))}
  1336. />
  1337. <Redirect from=":monitorSlug/" to="/crons/" />
  1338. <Redirect from=":monitorSlug/edit/" to="/crons/" />
  1339. <Route
  1340. path=":projectId/:monitorSlug/"
  1341. component={make(() => import('sentry/views/monitors/details'))}
  1342. />
  1343. <Route
  1344. path=":projectId/:monitorSlug/edit/"
  1345. component={make(() => import('sentry/views/monitors/edit'))}
  1346. />
  1347. </Route>
  1348. );
  1349. const replayRoutes = (
  1350. <Route
  1351. path="/replays/"
  1352. component={make(() => import('sentry/views/replays/index'))}
  1353. withOrgPath
  1354. >
  1355. <IndexRoute component={make(() => import('sentry/views/replays/list'))} />
  1356. <Route
  1357. path="selectors/"
  1358. component={make(
  1359. () => import('sentry/views/replays/deadRageClick/deadRageClickList')
  1360. )}
  1361. />
  1362. <Route
  1363. path=":replaySlug/"
  1364. component={make(() => import('sentry/views/replays/details'))}
  1365. />
  1366. </Route>
  1367. );
  1368. const releasesRoutes = (
  1369. <Fragment>
  1370. <Route path="/releases/" withOrgPath>
  1371. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1372. <Route
  1373. path=":release/"
  1374. component={make(() => import('sentry/views/releases/detail'))}
  1375. >
  1376. <IndexRoute
  1377. component={make(() => import('sentry/views/releases/detail/overview'))}
  1378. />
  1379. <Route
  1380. path="commits/"
  1381. component={make(
  1382. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1383. )}
  1384. />
  1385. <Route
  1386. path="files-changed/"
  1387. component={make(
  1388. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1389. )}
  1390. />
  1391. </Route>
  1392. </Route>
  1393. <Redirect
  1394. from="/releases/new-events/"
  1395. to="/organizations/:orgId/releases/:release/"
  1396. />
  1397. <Redirect
  1398. from="/releases/all-events/"
  1399. to="/organizations/:orgId/releases/:release/"
  1400. />
  1401. </Fragment>
  1402. );
  1403. const releaseThresholdRoutes = (
  1404. <Route path="/release-thresholds/" withOrgPath>
  1405. <IndexRoute
  1406. component={make(() => import('sentry/views/releases/thresholdsList'))}
  1407. />
  1408. </Route>
  1409. );
  1410. const activityRoutes = (
  1411. <Route
  1412. path="/activity/"
  1413. component={make(() => import('sentry/views/organizationActivity'))}
  1414. withOrgPath
  1415. />
  1416. );
  1417. const statsRoutes = (
  1418. <Fragment>
  1419. <Route path="/stats/" withOrgPath>
  1420. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1421. <Route
  1422. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1423. >
  1424. <Route
  1425. path="issues/"
  1426. component={make(
  1427. () => import('sentry/views/organizationStats/teamInsights/issues')
  1428. )}
  1429. />
  1430. <Route
  1431. path="health/"
  1432. component={make(
  1433. () => import('sentry/views/organizationStats/teamInsights/health')
  1434. )}
  1435. />
  1436. </Route>
  1437. </Route>
  1438. <Redirect
  1439. from="/organizations/:orgId/stats/team/"
  1440. to="/organizations/:orgId/stats/issues/"
  1441. />
  1442. </Fragment>
  1443. );
  1444. // TODO(mark) Long term this /queries route should go away and /discover
  1445. // should be the canonical route for discover2. We have a redirect right now
  1446. // as /discover was for discover 1 and most of the application is linking to
  1447. // /discover/queries and not /discover
  1448. const discoverRoutes = (
  1449. <Route
  1450. path="/discover/"
  1451. component={make(() => import('sentry/views/discover'))}
  1452. withOrgPath
  1453. >
  1454. <IndexRedirect to="queries/" />
  1455. <Route
  1456. path="homepage/"
  1457. component={make(() => import('sentry/views/discover/homepage'))}
  1458. />
  1459. <Route
  1460. path="queries/"
  1461. component={make(() => import('sentry/views/discover/landing'))}
  1462. />
  1463. <Route
  1464. path="results/"
  1465. component={make(() => import('sentry/views/discover/results'))}
  1466. />
  1467. <Route
  1468. path=":eventSlug/"
  1469. component={make(() => import('sentry/views/discover/eventDetails'))}
  1470. />
  1471. </Route>
  1472. );
  1473. const aiMonitoringRoutes = (
  1474. <Route path="/ai-monitoring/" withOrgPath>
  1475. <IndexRoute component={make(() => import('sentry/views/aiMonitoring/landing'))} />
  1476. <Route
  1477. path="pipeline-type/:groupId/"
  1478. component={make(
  1479. () => import('sentry/views/aiMonitoring/aiMonitoringDetailsPage')
  1480. )}
  1481. />
  1482. </Route>
  1483. );
  1484. const performanceRoutes = (
  1485. <Route
  1486. path="/performance/"
  1487. component={make(() => import('sentry/views/performance'))}
  1488. withOrgPath
  1489. >
  1490. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1491. <Route
  1492. path="trends/"
  1493. component={make(() => import('sentry/views/performance/trends'))}
  1494. />
  1495. <Route path="database/">
  1496. <IndexRoute
  1497. component={make(
  1498. () => import('sentry/views/performance/database/databaseLandingPage')
  1499. )}
  1500. />
  1501. <Route
  1502. path="spans/span/:groupId/"
  1503. component={make(
  1504. () => import('sentry/views/performance/database/databaseSpanSummaryPage')
  1505. )}
  1506. />
  1507. </Route>
  1508. <Route path="http/">
  1509. <IndexRoute
  1510. component={make(() => import('sentry/views/performance/http/httpLandingPage'))}
  1511. />
  1512. <Route
  1513. path="domains/"
  1514. component={make(
  1515. () => import('sentry/views/performance/http/httpDomainSummaryPage')
  1516. )}
  1517. />
  1518. </Route>
  1519. <Route path="cache/">
  1520. <IndexRoute
  1521. component={make(
  1522. () => import('sentry/views/performance/cache/cacheLandingPage')
  1523. )}
  1524. />
  1525. </Route>
  1526. <Route path="browser/">
  1527. <Route path="pageloads/">
  1528. <IndexRoute
  1529. component={make(
  1530. () =>
  1531. import('sentry/views/performance/browser/webVitals/webVitalsLandingPage')
  1532. )}
  1533. />
  1534. <Route
  1535. path="overview/"
  1536. component={make(
  1537. () => import('sentry/views/performance/browser/webVitals/pageOverview')
  1538. )}
  1539. />
  1540. </Route>
  1541. <Route path="resources/">
  1542. <IndexRoute
  1543. component={make(
  1544. () => import('sentry/views/performance/browser/resources/index')
  1545. )}
  1546. />
  1547. <Route
  1548. path="spans/span/:groupId/"
  1549. component={make(
  1550. () =>
  1551. import(
  1552. 'sentry/views/performance/browser/resources/resourceSummaryPage/index'
  1553. )
  1554. )}
  1555. />
  1556. </Route>
  1557. </Route>
  1558. <Route path="queues/">
  1559. <IndexRoute
  1560. component={make(
  1561. () => import('sentry/views/performance/queues/queuesLandingPage')
  1562. )}
  1563. />
  1564. <Route
  1565. path="destination/"
  1566. component={make(
  1567. () =>
  1568. import(
  1569. 'sentry/views/performance/queues/destinationSummary/destinationSummaryPage'
  1570. )
  1571. )}
  1572. />
  1573. </Route>
  1574. <Route path="mobile/">
  1575. <Route path="screens/">
  1576. <IndexRoute
  1577. component={make(() => import('sentry/views/performance/mobile/screenload'))}
  1578. />
  1579. <Route
  1580. path="spans/"
  1581. component={make(
  1582. () => import('sentry/views/performance/mobile/screenload/screenLoadSpans')
  1583. )}
  1584. />
  1585. </Route>
  1586. <Route path="app-startup/">
  1587. <IndexRoute
  1588. component={make(() => import('sentry/views/performance/mobile/appStarts'))}
  1589. />
  1590. <Route
  1591. path="spans/"
  1592. component={make(
  1593. () => import('sentry/views/performance/mobile/appStarts/screenSummary')
  1594. )}
  1595. />
  1596. </Route>
  1597. <Route path="ui/">
  1598. <IndexRoute
  1599. component={make(() => import('sentry/views/performance/mobile/ui'))}
  1600. />
  1601. </Route>
  1602. </Route>
  1603. <Route path="traces/">
  1604. <IndexRoute component={make(() => import('sentry/views/performance/traces'))} />
  1605. </Route>
  1606. <Route path="summary/">
  1607. <IndexRoute
  1608. component={make(
  1609. () =>
  1610. import('sentry/views/performance/transactionSummary/transactionOverview')
  1611. )}
  1612. />
  1613. <Route
  1614. path="replays/"
  1615. component={make(
  1616. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1617. )}
  1618. />
  1619. <Route
  1620. path="vitals/"
  1621. component={make(
  1622. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1623. )}
  1624. />
  1625. <Route
  1626. path="tags/"
  1627. component={make(
  1628. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1629. )}
  1630. />
  1631. <Route
  1632. path="events/"
  1633. component={make(
  1634. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1635. )}
  1636. />
  1637. <Route
  1638. path="anomalies/"
  1639. component={make(
  1640. () =>
  1641. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1642. )}
  1643. />
  1644. <Route
  1645. path="profiles/"
  1646. component={make(
  1647. () =>
  1648. import('sentry/views/performance/transactionSummary/transactionProfiles')
  1649. )}
  1650. />
  1651. <Route
  1652. path="aggregateWaterfall/"
  1653. component={make(
  1654. () =>
  1655. import('sentry/views/performance/transactionSummary/aggregateSpanWaterfall')
  1656. )}
  1657. />
  1658. <Route path="spans/">
  1659. <IndexRoute
  1660. component={make(
  1661. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1662. )}
  1663. />
  1664. <Route
  1665. path=":spanSlug/"
  1666. component={make(
  1667. () =>
  1668. import(
  1669. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1670. )
  1671. )}
  1672. />
  1673. </Route>
  1674. </Route>
  1675. <Route
  1676. path="vitaldetail/"
  1677. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1678. />
  1679. <Route
  1680. path="trace/:traceSlug/"
  1681. component={make(() => import('sentry/views/performance/traceDetails'))}
  1682. />
  1683. <Route
  1684. path=":eventSlug/"
  1685. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1686. />
  1687. </Route>
  1688. );
  1689. const starfishRoutes = (
  1690. <Route
  1691. path="/starfish/"
  1692. component={make(() => import('sentry/views/starfish'))}
  1693. withOrgPath
  1694. >
  1695. <Redirect from="database/" to="/performance/database" />
  1696. <Route path="appStartup/">
  1697. <IndexRoute
  1698. component={make(() => import('sentry/views/performance/mobile/appStarts'))}
  1699. />
  1700. <Route
  1701. path="spans/"
  1702. component={make(
  1703. () => import('sentry/views/performance/mobile/appStarts/screenSummary')
  1704. )}
  1705. />
  1706. </Route>
  1707. </Route>
  1708. );
  1709. const userFeedbackRoutes = (
  1710. <Route
  1711. path="/user-feedback/"
  1712. component={make(() => import('sentry/views/userFeedback'))}
  1713. withOrgPath
  1714. />
  1715. );
  1716. const feedbackv2Routes = (
  1717. <Route
  1718. path="/feedback/"
  1719. component={make(() => import('sentry/views/feedback/index'))}
  1720. withOrgPath
  1721. >
  1722. <IndexRoute
  1723. component={make(() => import('sentry/views/feedback/feedbackListPage'))}
  1724. />
  1725. </Route>
  1726. );
  1727. const issueListRoutes = (
  1728. <Route
  1729. path="/issues/(searches/:searchId/)"
  1730. component={errorHandler(IssueListContainer)}
  1731. withOrgPath
  1732. >
  1733. <IndexRoute component={errorHandler(IssueListOverview)} />
  1734. </Route>
  1735. );
  1736. // Once org issues is complete, these routes can be nested under
  1737. // /organizations/:orgId/issues
  1738. const issueTabs = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1739. const hoc = forCustomerDomain ? withDomainRequired : x => x;
  1740. return (
  1741. <Fragment>
  1742. <IndexRoute
  1743. component={hoc(
  1744. make(() => import('sentry/views/issueDetails/groupEventDetails'))
  1745. )}
  1746. />
  1747. <Route
  1748. path={TabPaths[Tab.REPLAYS]}
  1749. component={hoc(make(() => import('sentry/views/issueDetails/groupReplays')))}
  1750. />
  1751. <Route
  1752. path={TabPaths[Tab.ACTIVITY]}
  1753. component={hoc(make(() => import('sentry/views/issueDetails/groupActivity')))}
  1754. />
  1755. <Route
  1756. path={TabPaths[Tab.EVENTS]}
  1757. component={hoc(make(() => import('sentry/views/issueDetails/groupEvents')))}
  1758. />
  1759. <Route
  1760. path={TabPaths[Tab.TAGS]}
  1761. component={hoc(make(() => import('sentry/views/issueDetails/groupTags')))}
  1762. />
  1763. <Route
  1764. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1765. component={make(() => import('sentry/views/issueDetails/groupTagValues'))}
  1766. />
  1767. <Route
  1768. path={TabPaths[Tab.USER_FEEDBACK]}
  1769. component={hoc(
  1770. make(() => import('sentry/views/issueDetails/groupUserFeedback'))
  1771. )}
  1772. />
  1773. <Route
  1774. path={TabPaths[Tab.ATTACHMENTS]}
  1775. component={hoc(
  1776. make(() => import('sentry/views/issueDetails/groupEventAttachments'))
  1777. )}
  1778. />
  1779. <Route
  1780. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1781. component={hoc(
  1782. make(() => import('sentry/views/issueDetails/groupSimilarIssues'))
  1783. )}
  1784. />
  1785. <Route
  1786. path={TabPaths[Tab.MERGED]}
  1787. component={hoc(make(() => import('sentry/views/issueDetails/groupMerged')))}
  1788. />
  1789. </Fragment>
  1790. );
  1791. };
  1792. const issueDetailsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => (
  1793. <Fragment>
  1794. {issueTabs({forCustomerDomain})}
  1795. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  1796. {issueTabs({forCustomerDomain})}
  1797. </Route>
  1798. </Fragment>
  1799. );
  1800. const issueDetailsRoutes = (
  1801. <Fragment>
  1802. <Route
  1803. path="/organizations/:orgId/issues/:groupId/"
  1804. component={withDomainRedirect(
  1805. make(() => import('sentry/views/issueDetails/groupDetails'))
  1806. )}
  1807. key="org-issues-group-id"
  1808. >
  1809. {issueDetailsChildRoutes({forCustomerDomain: false})}
  1810. </Route>
  1811. {USING_CUSTOMER_DOMAIN && (
  1812. <Route
  1813. path="/issues/:groupId/"
  1814. component={withDomainRequired(
  1815. make(() => import('sentry/views/issueDetails/groupDetails'))
  1816. )}
  1817. key="orgless-issues-group-id-route"
  1818. >
  1819. {issueDetailsChildRoutes({forCustomerDomain: true})}
  1820. </Route>
  1821. )}
  1822. </Fragment>
  1823. );
  1824. // These are the "manage" pages. For sentry.io, these are _different_ from
  1825. // the SaaS admin routes in getsentry.
  1826. const adminManageRoutes = (
  1827. <Route
  1828. path="/manage/"
  1829. component={make(() => import('sentry/views/admin/adminLayout'))}
  1830. >
  1831. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1832. <Route
  1833. path="buffer/"
  1834. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1835. />
  1836. <Route
  1837. path="relays/"
  1838. component={make(() => import('sentry/views/admin/adminRelays'))}
  1839. />
  1840. <Route
  1841. path="organizations/"
  1842. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1843. />
  1844. <Route
  1845. path="projects/"
  1846. component={make(() => import('sentry/views/admin/adminProjects'))}
  1847. />
  1848. <Route
  1849. path="queue/"
  1850. component={make(() => import('sentry/views/admin/adminQueue'))}
  1851. />
  1852. <Route
  1853. path="quotas/"
  1854. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1855. />
  1856. <Route
  1857. path="settings/"
  1858. component={make(() => import('sentry/views/admin/adminSettings'))}
  1859. />
  1860. <Route path="users/">
  1861. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1862. <Route
  1863. path=":id"
  1864. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1865. />
  1866. </Route>
  1867. <Route
  1868. path="status/mail/"
  1869. component={make(() => import('sentry/views/admin/adminMail'))}
  1870. />
  1871. <Route
  1872. path="status/environment/"
  1873. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1874. />
  1875. <Route
  1876. path="status/packages/"
  1877. component={make(() => import('sentry/views/admin/adminPackages'))}
  1878. />
  1879. <Route
  1880. path="status/warnings/"
  1881. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1882. />
  1883. </Route>
  1884. );
  1885. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1886. // me why we need the OrganizationRoot root container.
  1887. const legacyOrganizationRootRoutes = (
  1888. <Route component={errorHandler(OrganizationRoot)}>
  1889. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  1890. <Route path="/organizations/:orgId/">
  1891. {hook('routes:organization')}
  1892. <IndexRedirect to="/organizations/:orgId/issues/" />
  1893. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  1894. <Redirect
  1895. from="/organizations/:orgId/teams/your-teams/"
  1896. to="/settings/:orgId/teams/"
  1897. />
  1898. <Redirect
  1899. from="/organizations/:orgId/teams/all-teams/"
  1900. to="/settings/:orgId/teams/"
  1901. />
  1902. <Redirect
  1903. from="/organizations/:orgId/teams/:teamId/"
  1904. to="/settings/:orgId/teams/:teamId/"
  1905. />
  1906. <Redirect
  1907. from="/organizations/:orgId/teams/:teamId/members/"
  1908. to="/settings/:orgId/teams/:teamId/members/"
  1909. />
  1910. <Redirect
  1911. from="/organizations/:orgId/teams/:teamId/projects/"
  1912. to="/settings/:orgId/teams/:teamId/projects/"
  1913. />
  1914. <Redirect
  1915. from="/organizations/:orgId/teams/:teamId/settings/"
  1916. to="/settings/:orgId/teams/:teamId/settings/"
  1917. />
  1918. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  1919. <Redirect
  1920. from="/organizations/:orgId/api-keys/"
  1921. to="/settings/:orgId/api-keys/"
  1922. />
  1923. <Redirect
  1924. from="/organizations/:orgId/api-keys/:apiKey/"
  1925. to="/settings/:orgId/api-keys/:apiKey/"
  1926. />
  1927. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  1928. <Redirect
  1929. from="/organizations/:orgId/members/:memberId/"
  1930. to="/settings/:orgId/members/:memberId/"
  1931. />
  1932. <Redirect
  1933. from="/organizations/:orgId/rate-limits/"
  1934. to="/settings/:orgId/rate-limits/"
  1935. />
  1936. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  1937. </Route>
  1938. </Route>
  1939. );
  1940. const gettingStartedRoutes = (
  1941. <Fragment>
  1942. {USING_CUSTOMER_DOMAIN && (
  1943. <Fragment>
  1944. <Redirect
  1945. from="/getting-started/:projectId/"
  1946. to="/projects/:projectId/getting-started/"
  1947. />
  1948. <Redirect
  1949. from="/getting-started/:projectId/:platform/"
  1950. to="/projects/:projectId/getting-started/"
  1951. />
  1952. </Fragment>
  1953. )}
  1954. <Redirect
  1955. from="/:orgId/:projectId/getting-started/"
  1956. to="/organizations/:orgId/projects/:projectId/getting-started/"
  1957. />
  1958. <Redirect
  1959. from="/:orgId/:projectId/getting-started/:platform/"
  1960. to="/organizations/:orgId/projects/:projectId/getting-started/"
  1961. />
  1962. </Fragment>
  1963. );
  1964. const profilingRoutes = (
  1965. <Route
  1966. path="/profiling/"
  1967. component={make(() => import('sentry/views/profiling'))}
  1968. withOrgPath
  1969. >
  1970. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  1971. <Route
  1972. path="summary/:projectId/"
  1973. component={make(() => import('sentry/views/profiling/profileSummary'))}
  1974. />
  1975. <Route
  1976. path="profile/:projectId/differential-flamegraph/"
  1977. component={make(() => import('sentry/views/profiling/differentialFlamegraph'))}
  1978. />
  1979. <Route
  1980. path="profile/:projectId/:eventId/"
  1981. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  1982. >
  1983. <Route
  1984. path="flamegraph/"
  1985. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  1986. />
  1987. </Route>
  1988. </Route>
  1989. );
  1990. const metricsRoutes = (
  1991. <Fragment>
  1992. <Route
  1993. path="/metrics/"
  1994. component={make(() => import('sentry/views/metrics'))}
  1995. withOrgPath
  1996. >
  1997. <IndexRoute component={make(() => import('sentry/views/metrics/metrics'))} />
  1998. </Route>
  1999. {/* TODO(ddm): fade this out */}
  2000. <Redirect from="/ddm/" to="/metrics/" />
  2001. </Fragment>
  2002. );
  2003. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  2004. // canonical URLs.
  2005. //
  2006. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  2007. // or do these need to be nested into the OrganizationLayout tree?
  2008. const legacyOrgRedirects = (
  2009. <Route path="/:orgId/:projectId/">
  2010. <IndexRoute
  2011. component={errorHandler(
  2012. redirectDeprecatedProjectRoute(
  2013. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2014. )
  2015. )}
  2016. />
  2017. <Route
  2018. path="issues/"
  2019. component={errorHandler(
  2020. redirectDeprecatedProjectRoute(
  2021. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2022. )
  2023. )}
  2024. />
  2025. <Route
  2026. path="dashboard/"
  2027. component={errorHandler(
  2028. redirectDeprecatedProjectRoute(
  2029. ({orgId, projectId}) =>
  2030. `/organizations/${orgId}/dashboards/?project=${projectId}`
  2031. )
  2032. )}
  2033. />
  2034. <Route
  2035. path="user-feedback/"
  2036. component={errorHandler(
  2037. redirectDeprecatedProjectRoute(
  2038. ({orgId, projectId}) =>
  2039. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  2040. )
  2041. )}
  2042. />
  2043. <Route
  2044. path="releases/"
  2045. component={errorHandler(
  2046. redirectDeprecatedProjectRoute(
  2047. ({orgId, projectId}) =>
  2048. `/organizations/${orgId}/releases/?project=${projectId}`
  2049. )
  2050. )}
  2051. />
  2052. <Route
  2053. path="releases/:version/"
  2054. component={errorHandler(
  2055. redirectDeprecatedProjectRoute(
  2056. ({orgId, projectId, router}) =>
  2057. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  2058. )
  2059. )}
  2060. />
  2061. <Route
  2062. path="releases/:version/new-events/"
  2063. component={errorHandler(
  2064. redirectDeprecatedProjectRoute(
  2065. ({orgId, projectId, router}) =>
  2066. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  2067. )
  2068. )}
  2069. />
  2070. <Route
  2071. path="releases/:version/all-events/"
  2072. component={errorHandler(
  2073. redirectDeprecatedProjectRoute(
  2074. ({orgId, projectId, router}) =>
  2075. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  2076. )
  2077. )}
  2078. />
  2079. <Route
  2080. path="releases/:version/commits/"
  2081. component={errorHandler(
  2082. redirectDeprecatedProjectRoute(
  2083. ({orgId, projectId, router}) =>
  2084. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  2085. )
  2086. )}
  2087. />
  2088. </Route>
  2089. );
  2090. const organizationRoutes = (
  2091. <Route component={errorHandler(OrganizationLayout)}>
  2092. {settingsRoutes}
  2093. {projectsRoutes}
  2094. {dashboardRoutes}
  2095. {userFeedbackRoutes}
  2096. {feedbackv2Routes}
  2097. {issueListRoutes}
  2098. {issueDetailsRoutes}
  2099. {alertRoutes}
  2100. {cronsRoutes}
  2101. {replayRoutes}
  2102. {releasesRoutes}
  2103. {releaseThresholdRoutes}
  2104. {activityRoutes}
  2105. {statsRoutes}
  2106. {discoverRoutes}
  2107. {performanceRoutes}
  2108. {aiMonitoringRoutes}
  2109. {starfishRoutes}
  2110. {profilingRoutes}
  2111. {metricsRoutes}
  2112. {gettingStartedRoutes}
  2113. {adminManageRoutes}
  2114. {legacyOrganizationRootRoutes}
  2115. {legacyOrgRedirects}
  2116. </Route>
  2117. );
  2118. const legacyRedirectRoutes = (
  2119. <Route path="/:orgId/">
  2120. <IndexRedirect to="/organizations/:orgId/" />
  2121. <Route path=":projectId/settings/">
  2122. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2123. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2124. <Redirect
  2125. from="alerts/rules/"
  2126. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2127. />
  2128. <Redirect
  2129. from="alerts/rules/new/"
  2130. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2131. />
  2132. <Redirect
  2133. from="alerts/rules/:ruleId/"
  2134. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2135. />
  2136. <Redirect
  2137. from="environments/"
  2138. to="/settings/:orgId/projects/:projectId/environments/"
  2139. />
  2140. <Redirect
  2141. from="environments/hidden/"
  2142. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2143. />
  2144. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2145. <Redirect
  2146. from="issue-tracking/"
  2147. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2148. />
  2149. <Redirect
  2150. from="release-tracking/"
  2151. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2152. />
  2153. <Redirect
  2154. from="ownership/"
  2155. to="/settings/:orgId/projects/:projectId/ownership/"
  2156. />
  2157. <Redirect
  2158. from="data-forwarding/"
  2159. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2160. />
  2161. <Redirect
  2162. from="debug-symbols/"
  2163. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2164. />
  2165. <Redirect
  2166. from="processing-issues/"
  2167. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2168. />
  2169. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2170. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2171. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2172. <Redirect
  2173. from="keys/:keyId/"
  2174. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2175. />
  2176. <Redirect
  2177. from="user-feedback/"
  2178. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2179. />
  2180. <Redirect
  2181. from="security-headers/"
  2182. to="/settings/:orgId/projects/:projectId/security-headers/"
  2183. />
  2184. <Redirect
  2185. from="security-headers/csp/"
  2186. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2187. />
  2188. <Redirect
  2189. from="security-headers/expect-ct/"
  2190. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2191. />
  2192. <Redirect
  2193. from="security-headers/hpkp/"
  2194. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2195. />
  2196. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2197. <Redirect
  2198. from="plugins/:pluginId/"
  2199. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2200. />
  2201. <Redirect
  2202. from="integrations/:providerKey/"
  2203. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2204. />
  2205. </Route>
  2206. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2207. <Redirect
  2208. from=":projectId/issues/:groupId/"
  2209. to="/organizations/:orgId/issues/:groupId/"
  2210. />
  2211. <Redirect
  2212. from=":projectId/issues/:groupId/events/"
  2213. to="/organizations/:orgId/issues/:groupId/events/"
  2214. />
  2215. <Redirect
  2216. from=":projectId/issues/:groupId/events/:eventId/"
  2217. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2218. />
  2219. <Redirect
  2220. from=":projectId/issues/:groupId/tags/"
  2221. to="/organizations/:orgId/issues/:groupId/tags/"
  2222. />
  2223. <Redirect
  2224. from=":projectId/issues/:groupId/tags/:tagKey/"
  2225. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2226. />
  2227. <Redirect
  2228. from=":projectId/issues/:groupId/feedback/"
  2229. to="/organizations/:orgId/issues/:groupId/feedback/"
  2230. />
  2231. <Redirect
  2232. from=":projectId/issues/:groupId/similar/"
  2233. to="/organizations/:orgId/issues/:groupId/similar/"
  2234. />
  2235. <Redirect
  2236. from=":projectId/issues/:groupId/merged/"
  2237. to="/organizations/:orgId/issues/:groupId/merged/"
  2238. />
  2239. <Route
  2240. path=":projectId/events/:eventId/"
  2241. component={errorHandler(ProjectEventRedirect)}
  2242. />
  2243. </Route>
  2244. );
  2245. const appRoutes = (
  2246. <Route>
  2247. {experimentalSpaRoutes}
  2248. <Route path="/" component={errorHandler(App)}>
  2249. {rootRoutes}
  2250. {organizationRoutes}
  2251. {legacyRedirectRoutes}
  2252. <Route path="*" component={errorHandler(RouteNotFound)} />
  2253. </Route>
  2254. </Route>
  2255. );
  2256. return appRoutes;
  2257. }
  2258. // We load routes both when initializing the SDK (for routing integrations) and
  2259. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2260. export const routes = memoize(buildRoutes);
  2261. // Exported for use in tests.
  2262. export {buildRoutes};
  2263. function NoOp({children}: {children: JSX.Element}) {
  2264. return children;
  2265. }