routes.tsx 78 KB

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