routes.tsx 70 KB

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