routes.tsx 72 KB

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