routes.tsx 78 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458
  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 IssueListOverview from 'sentry/views/issueList/overview';
  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="replays/"
  554. name={t('Replays')}
  555. component={make(() => import('sentry/views/settings/project/projectReplays'))}
  556. />
  557. <Route
  558. path="toolbar/"
  559. name={t('Developer Toolbar')}
  560. component={make(() => import('sentry/views/settings/project/projectToolbar'))}
  561. />
  562. <Route path="source-maps/" name={t('Source Maps')}>
  563. <IndexRoute
  564. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  565. />
  566. <Route
  567. name={t('Source Map Uploads')}
  568. path=":bundleId/"
  569. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  570. />
  571. <Redirect from="source-maps/artifact-bundles/" to="source-maps/" />
  572. <Redirect from="source-maps/release-bundles/" to="source-maps/" />
  573. </Route>
  574. <Route
  575. path="filters/"
  576. name={t('Inbound Filters')}
  577. component={make(() => import('sentry/views/settings/project/projectFilters'))}
  578. >
  579. <IndexRedirect to="data-filters/" />
  580. <Route path=":filterType/" />
  581. </Route>
  582. <Redirect from="dynamic-sampling/" to="performance/" />
  583. <Route
  584. path="issue-grouping/"
  585. name={t('Issue Grouping')}
  586. component={make(() => import('sentry/views/settings/projectIssueGrouping'))}
  587. />
  588. <Route
  589. path="hooks/"
  590. name={t('Service Hooks')}
  591. component={make(
  592. () => import('sentry/views/settings/project/projectServiceHooks')
  593. )}
  594. />
  595. <Route
  596. path="hooks/new/"
  597. name={t('Create Service Hook')}
  598. component={make(
  599. () => import('sentry/views/settings/project/projectCreateServiceHook')
  600. )}
  601. />
  602. <Route
  603. path="hooks/:hookId/"
  604. name={t('Service Hook Details')}
  605. component={make(
  606. () => import('sentry/views/settings/project/projectServiceHookDetails')
  607. )}
  608. />
  609. <Route path="keys/" name={t('Client Keys')}>
  610. <IndexRoute
  611. component={make(() => import('sentry/views/settings/project/projectKeys/list'))}
  612. />
  613. <Route
  614. path=":keyId/"
  615. name={t('Details')}
  616. component={make(
  617. () => import('sentry/views/settings/project/projectKeys/details')
  618. )}
  619. />
  620. </Route>
  621. <Route
  622. path="loader-script/"
  623. name={t('Loader Script')}
  624. component={make(() => import('sentry/views/settings/project/loaderScript'))}
  625. />
  626. <Redirect
  627. from="csp/"
  628. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  629. />
  630. <Route path="security-headers/" name={t('Security Headers')}>
  631. <IndexRoute
  632. component={make(() => import('sentry/views/settings/projectSecurityHeaders'))}
  633. />
  634. <Route
  635. path="csp/"
  636. name={t('Content Security Policy')}
  637. component={make(
  638. () => import('sentry/views/settings/projectSecurityHeaders/csp')
  639. )}
  640. />
  641. <Route
  642. path="expect-ct/"
  643. name={t('Certificate Transparency')}
  644. component={make(
  645. () => import('sentry/views/settings/projectSecurityHeaders/expectCt')
  646. )}
  647. />
  648. <Route
  649. path="hpkp/"
  650. name={t('HPKP')}
  651. component={make(
  652. () => import('sentry/views/settings/projectSecurityHeaders/hpkp')
  653. )}
  654. />
  655. </Route>
  656. <Route path="plugins/" name={t('Legacy Integrations')}>
  657. <IndexRoute
  658. component={make(() => import('sentry/views/settings/projectPlugins'))}
  659. />
  660. <Route
  661. path=":pluginId/"
  662. name={t('Integration Details')}
  663. component={make(() => import('sentry/views/settings/projectPlugins/details'))}
  664. />
  665. </Route>
  666. </Route>
  667. );
  668. const orgSettingsRoutes = (
  669. <Route
  670. component={make(
  671. () => import('sentry/views/settings/organization/organizationSettingsLayout')
  672. )}
  673. >
  674. {hook('routes:settings')}
  675. {!USING_CUSTOMER_DOMAIN && (
  676. <IndexRoute
  677. name={t('General')}
  678. component={make(
  679. () => import('sentry/views/settings/organizationGeneralSettings')
  680. )}
  681. />
  682. )}
  683. <Route
  684. path="organization/"
  685. name={t('General')}
  686. component={make(
  687. () => import('sentry/views/settings/organizationGeneralSettings')
  688. )}
  689. />
  690. <Route
  691. path="projects/"
  692. name={t('Projects')}
  693. component={make(() => import('sentry/views/settings/organizationProjects'))}
  694. />
  695. <Route path="api-keys/" name={t('API Key')}>
  696. <IndexRoute
  697. component={make(() => import('sentry/views/settings/organizationApiKeys'))}
  698. />
  699. <Route
  700. path=":apiKey/"
  701. name={t('Details')}
  702. component={make(
  703. () =>
  704. import(
  705. 'sentry/views/settings/organizationApiKeys/organizationApiKeyDetails'
  706. )
  707. )}
  708. />
  709. </Route>
  710. <Route
  711. path="audit-log/"
  712. name={t('Audit Log')}
  713. component={make(() => import('sentry/views/settings/organizationAuditLog'))}
  714. />
  715. <Route
  716. path="auth/"
  717. name={t('Auth Providers')}
  718. component={make(() => import('sentry/views/settings/organizationAuth'))}
  719. />
  720. <Redirect from="members/requests" to="members/" />
  721. <Route path="members/" name={t('Members')}>
  722. <IndexRoute
  723. component={make(
  724. () =>
  725. import('sentry/views/settings/organizationMembers/organizationMembersList')
  726. )}
  727. />
  728. <Route
  729. path=":memberId/"
  730. name={t('Details')}
  731. component={make(
  732. () =>
  733. import('sentry/views/settings/organizationMembers/organizationMemberDetail')
  734. )}
  735. />
  736. </Route>
  737. <Route
  738. path="rate-limits/"
  739. name={t('Rate Limits')}
  740. component={make(() => import('sentry/views/settings/organizationRateLimits'))}
  741. />
  742. <Route
  743. path="relay/"
  744. name={t('Relay')}
  745. component={make(() => import('sentry/views/settings/organizationRelay'))}
  746. />
  747. <Route
  748. path="repos/"
  749. name={t('Repositories')}
  750. component={make(() => import('sentry/views/settings/organizationRepositories'))}
  751. />
  752. <Route
  753. path="settings/"
  754. component={make(
  755. () => import('sentry/views/settings/organizationGeneralSettings')
  756. )}
  757. />
  758. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  759. <IndexRoute
  760. component={make(
  761. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  762. )}
  763. />
  764. <Route
  765. path="advanced-data-scrubbing/:scrubbingId/"
  766. component={make(
  767. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  768. )}
  769. />
  770. </Route>
  771. <Route path="teams/" name={t('Teams')}>
  772. <IndexRoute
  773. component={make(() => import('sentry/views/settings/organizationTeams'))}
  774. />
  775. <Route
  776. path=":teamId/"
  777. name={t('Team')}
  778. component={make(
  779. () => import('sentry/views/settings/organizationTeams/teamDetails')
  780. )}
  781. >
  782. <IndexRedirect to="members/" />
  783. <Route
  784. path="members/"
  785. name={t('Members')}
  786. component={make(
  787. () => import('sentry/views/settings/organizationTeams/teamMembers')
  788. )}
  789. />
  790. <Route
  791. path="notifications/"
  792. name={t('Notifications')}
  793. component={make(
  794. () => import('sentry/views/settings/organizationTeams/teamNotifications')
  795. )}
  796. />
  797. <Route
  798. path="projects/"
  799. name={t('Projects')}
  800. component={make(
  801. () => import('sentry/views/settings/organizationTeams/teamProjects')
  802. )}
  803. />
  804. <Route
  805. path="settings/"
  806. name={t('Settings')}
  807. component={make(
  808. () => import('sentry/views/settings/organizationTeams/teamSettings')
  809. )}
  810. />
  811. </Route>
  812. </Route>
  813. <Redirect from="plugins/" to="integrations/" />
  814. <Route path="plugins/" name={t('Integrations')}>
  815. <Route
  816. path=":integrationSlug/"
  817. name={t('Integration Details')}
  818. component={make(
  819. () =>
  820. import('sentry/views/settings/organizationIntegrations/pluginDetailedView')
  821. )}
  822. />
  823. </Route>
  824. <Redirect from="sentry-apps/" to="integrations/" />
  825. <Route path="sentry-apps/" name={t('Integrations')}>
  826. <Route
  827. path=":integrationSlug"
  828. name={t('Details')}
  829. component={make(
  830. () =>
  831. import(
  832. 'sentry/views/settings/organizationIntegrations/sentryAppDetailedView'
  833. )
  834. )}
  835. />
  836. </Route>
  837. <Redirect from="document-integrations/" to="integrations/" />
  838. <Route path="document-integrations/" name={t('Integrations')}>
  839. <Route
  840. path=":integrationSlug"
  841. name={t('Details')}
  842. component={make(
  843. () =>
  844. import(
  845. 'sentry/views/settings/organizationIntegrations/docIntegrationDetailedView'
  846. )
  847. )}
  848. />
  849. </Route>
  850. <Route path="integrations/" name={t('Integrations')}>
  851. <IndexRoute
  852. component={make(
  853. () =>
  854. import(
  855. 'sentry/views/settings/organizationIntegrations/integrationListDirectory'
  856. )
  857. )}
  858. />
  859. <Route
  860. path=":integrationSlug"
  861. name={t('Integration Details')}
  862. component={make(
  863. () =>
  864. import(
  865. 'sentry/views/settings/organizationIntegrations/integrationDetailedView'
  866. )
  867. )}
  868. />
  869. <Route
  870. path=":providerKey/:integrationId/"
  871. name={t('Configure Integration')}
  872. component={make(
  873. () =>
  874. import(
  875. 'sentry/views/settings/organizationIntegrations/configureIntegration'
  876. )
  877. )}
  878. />
  879. </Route>
  880. <Route path="developer-settings/" name={t('Custom Integrations')}>
  881. <IndexRoute
  882. component={make(
  883. () => import('sentry/views/settings/organizationDeveloperSettings')
  884. )}
  885. />
  886. <Route
  887. path="new-public/"
  888. name={t('Create Integration')}
  889. component={make(
  890. () =>
  891. import(
  892. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  893. )
  894. )}
  895. />
  896. <Route
  897. path="new-internal/"
  898. name={t('Create Integration')}
  899. component={make(
  900. () =>
  901. import(
  902. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  903. )
  904. )}
  905. />
  906. <Route
  907. path=":appSlug/"
  908. name={t('Edit Integration')}
  909. component={make(
  910. () =>
  911. import(
  912. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  913. )
  914. )}
  915. />
  916. <Route
  917. path=":appSlug/dashboard/"
  918. name={t('Integration Dashboard')}
  919. component={make(
  920. () =>
  921. import(
  922. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  923. )
  924. )}
  925. />
  926. </Route>
  927. <Route path="auth-tokens/" name={t('Auth Tokens')}>
  928. <IndexRoute
  929. component={make(() => import('sentry/views/settings/organizationAuthTokens'))}
  930. />
  931. <Route
  932. path="new-token/"
  933. name={t('Create New Auth Token')}
  934. component={make(
  935. () => import('sentry/views/settings/organizationAuthTokens/newAuthToken')
  936. )}
  937. />
  938. <Route
  939. path=":tokenId/"
  940. name={t('Edit Auth Token')}
  941. component={make(
  942. () => import('sentry/views/settings/organizationAuthTokens/authTokenDetails')
  943. )}
  944. />
  945. </Route>
  946. <Route
  947. path="early-features/"
  948. name={t('Early Features')}
  949. component={make(() => import('sentry/views/settings/earlyFeatures'))}
  950. />
  951. <Route
  952. path="dynamic-sampling/"
  953. name={t('Dynamic Sampling')}
  954. component={make(() => import('sentry/views/settings/dynamicSampling'))}
  955. />
  956. </Route>
  957. );
  958. const legacySettingsRedirects = (
  959. <Fragment>
  960. <Redirect from=":projectId/" to="projects/:projectId/" />
  961. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  962. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  963. <Redirect
  964. from=":projectId/alerts/rules/:ruleId/"
  965. to="projects/:projectId/alerts/rules/:ruleId/"
  966. />
  967. </Fragment>
  968. );
  969. const settingsRoutes = (
  970. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  971. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  972. {accountSettingsRoutes}
  973. <Fragment>
  974. {USING_CUSTOMER_DOMAIN && (
  975. <Route
  976. name={t('Organization')}
  977. component={withDomainRequired(NoOp)}
  978. key="orgless-settings-route"
  979. >
  980. {orgSettingsRoutes}
  981. {projectSettingsRoutes}
  982. </Route>
  983. )}
  984. <Route
  985. path=":orgId/"
  986. name={t('Organization')}
  987. component={withDomainRedirect(NoOp)}
  988. key="org-settings"
  989. >
  990. {orgSettingsRoutes}
  991. {projectSettingsRoutes}
  992. {legacySettingsRedirects}
  993. </Route>
  994. </Fragment>
  995. </Route>
  996. );
  997. const projectsRoutes = (
  998. <Route
  999. path="/projects/"
  1000. component={make(() => import('sentry/views/projects/'))}
  1001. withOrgPath
  1002. >
  1003. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  1004. <Route
  1005. path="new/"
  1006. component={make(() => import('sentry/views/projectInstall/newProject'))}
  1007. />
  1008. <Route
  1009. path=":projectId/"
  1010. component={make(() => import('sentry/views/projectDetail'))}
  1011. />
  1012. <Route
  1013. path=":projectId/events/:eventId/"
  1014. component={errorHandler(ProjectEventRedirect)}
  1015. />
  1016. <Route
  1017. path=":projectId/getting-started/"
  1018. component={make(
  1019. () => import('sentry/views/projectInstall/platformOrIntegration')
  1020. )}
  1021. />
  1022. </Route>
  1023. );
  1024. const dashboardRoutes = (
  1025. <Fragment>
  1026. <Fragment>
  1027. {USING_CUSTOMER_DOMAIN && (
  1028. <Route
  1029. path="/dashboards/"
  1030. component={withDomainRequired(make(() => import('sentry/views/dashboards')))}
  1031. key="orgless-dashboards-route"
  1032. >
  1033. <IndexRoute
  1034. component={make(() => import('sentry/views/dashboards/manage'))}
  1035. />
  1036. </Route>
  1037. )}
  1038. <Route
  1039. path="/organizations/:orgId/dashboards/"
  1040. component={withDomainRedirect(make(() => import('sentry/views/dashboards')))}
  1041. key="org-dashboards"
  1042. >
  1043. <IndexRoute component={make(() => import('sentry/views/dashboards/manage'))} />
  1044. </Route>
  1045. </Fragment>
  1046. <Fragment>
  1047. {USING_CUSTOMER_DOMAIN && (
  1048. <Route
  1049. path="/dashboards/new/"
  1050. component={withDomainRequired(
  1051. make(() => import('sentry/views/dashboards/create'))
  1052. )}
  1053. key="orgless-dashboards-new-route"
  1054. >
  1055. {/* New widget builder routes */}
  1056. <Route
  1057. path="widget-builder/widget/:widgetIndex/edit/"
  1058. component={make(() => import('sentry/views/dashboards/view'))}
  1059. />
  1060. <Route
  1061. path="widget-builder/widget/new/"
  1062. component={make(() => import('sentry/views/dashboards/view'))}
  1063. />
  1064. {/* Old widget builder routes */}
  1065. <Route
  1066. path="widget/:widgetIndex/edit/"
  1067. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1068. />
  1069. <Route
  1070. path="widget/new/"
  1071. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1072. />
  1073. </Route>
  1074. )}
  1075. <Route
  1076. path="/organizations/:orgId/dashboards/new/"
  1077. component={withDomainRedirect(
  1078. make(() => import('sentry/views/dashboards/create'))
  1079. )}
  1080. key="org-dashboards-new"
  1081. >
  1082. {/* New widget builder routes */}
  1083. <Route
  1084. path="widget-builder/widget/:widgetIndex/edit/"
  1085. component={make(() => import('sentry/views/dashboards/view'))}
  1086. />
  1087. <Route
  1088. path="widget-builder/widget/new/"
  1089. component={make(() => import('sentry/views/dashboards/view'))}
  1090. />
  1091. {/* Old widget builder routes */}
  1092. <Route
  1093. path="widget/:widgetIndex/edit/"
  1094. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1095. />
  1096. <Route
  1097. path="widget/new/"
  1098. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1099. />
  1100. </Route>
  1101. </Fragment>
  1102. <Fragment>
  1103. {USING_CUSTOMER_DOMAIN && (
  1104. <Route
  1105. path="/dashboards/new/:templateId"
  1106. component={withDomainRequired(
  1107. make(() => import('sentry/views/dashboards/create'))
  1108. )}
  1109. key="orgless-dashboards-new-template-route"
  1110. >
  1111. <Route
  1112. path="widget/:widgetId/"
  1113. component={make(() => import('sentry/views/dashboards/create'))}
  1114. />
  1115. </Route>
  1116. )}
  1117. <Route
  1118. path="/organizations/:orgId/dashboards/new/:templateId"
  1119. component={withDomainRedirect(
  1120. make(() => import('sentry/views/dashboards/create'))
  1121. )}
  1122. key="org-dashboards-new-template"
  1123. >
  1124. <Route
  1125. path="widget/:widgetId/"
  1126. component={make(() => import('sentry/views/dashboards/create'))}
  1127. />
  1128. </Route>
  1129. </Fragment>
  1130. <Redirect
  1131. from="/organizations/:orgId/dashboards/:dashboardId/"
  1132. to="/organizations/:orgId/dashboard/:dashboardId/"
  1133. />
  1134. {USING_CUSTOMER_DOMAIN && (
  1135. <Redirect from="/dashboards/:dashboardId/" to="/dashboard/:dashboardId/" />
  1136. )}
  1137. <Route
  1138. path="/dashboard/:dashboardId/"
  1139. component={make(() => import('sentry/views/dashboards/view'))}
  1140. withOrgPath
  1141. >
  1142. {/* New widget builder routes */}
  1143. <Route
  1144. path="widget-builder/widget/:widgetIndex/edit/"
  1145. component={make(() => import('sentry/views/dashboards/view'))}
  1146. />
  1147. <Route
  1148. path="widget-builder/widget/new/"
  1149. component={make(() => import('sentry/views/dashboards/view'))}
  1150. />
  1151. {/* Old widget builder routes */}
  1152. <Route
  1153. path="widget/:widgetIndex/edit/"
  1154. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1155. />
  1156. <Route
  1157. path="widget/new/"
  1158. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1159. />
  1160. <Route
  1161. path="widget/:widgetId/"
  1162. component={make(() => import('sentry/views/dashboards/view'))}
  1163. />
  1164. </Route>
  1165. </Fragment>
  1166. );
  1167. const alertChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1168. // ALERT CHILD ROUTES
  1169. return (
  1170. <Fragment>
  1171. <IndexRoute
  1172. component={make(() => import('sentry/views/alerts/list/incidents'))}
  1173. />
  1174. <Route path="rules/">
  1175. <IndexRoute
  1176. component={make(
  1177. () => import('sentry/views/alerts/list/rules/alertRulesList')
  1178. )}
  1179. />
  1180. <Route
  1181. path="details/:ruleId/"
  1182. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  1183. />
  1184. <Route
  1185. path=":projectId/"
  1186. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1187. >
  1188. <IndexRedirect
  1189. to={
  1190. forCustomerDomain
  1191. ? '/alerts/rules/'
  1192. : '/organizations/:orgId/alerts/rules/'
  1193. }
  1194. />
  1195. <Route
  1196. path=":ruleId/"
  1197. component={make(() => import('sentry/views/alerts/edit'))}
  1198. />
  1199. </Route>
  1200. <Route path=":projectId/:ruleId/details/">
  1201. <IndexRoute
  1202. component={make(
  1203. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  1204. )}
  1205. />
  1206. </Route>
  1207. <Route
  1208. path="uptime/"
  1209. component={make(() => import('sentry/views/alerts/rules/uptime'))}
  1210. >
  1211. <Route
  1212. path=":projectId/:uptimeRuleId/details/"
  1213. component={make(() => import('sentry/views/alerts/rules/uptime/details'))}
  1214. />
  1215. </Route>
  1216. </Route>
  1217. <Route path="metric-rules/">
  1218. <IndexRedirect
  1219. to={
  1220. forCustomerDomain ? '/alerts/rules/' : '/organizations/:orgId/alerts/rules/'
  1221. }
  1222. />
  1223. <Route
  1224. path=":projectId/"
  1225. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1226. >
  1227. <IndexRedirect
  1228. to={
  1229. forCustomerDomain
  1230. ? '/alerts/rules/'
  1231. : '/organizations/:orgId/alerts/rules/'
  1232. }
  1233. />
  1234. <Route
  1235. path=":ruleId/"
  1236. component={make(() => import('sentry/views/alerts/edit'))}
  1237. />
  1238. </Route>
  1239. </Route>
  1240. <Route path="uptime-rules/">
  1241. <Route
  1242. path=":projectId/"
  1243. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1244. >
  1245. <Route
  1246. path=":ruleId/"
  1247. component={make(() => import('sentry/views/alerts/edit'))}
  1248. />
  1249. </Route>
  1250. </Route>
  1251. <Route
  1252. path="wizard/"
  1253. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1254. >
  1255. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  1256. </Route>
  1257. <Route
  1258. path="new/"
  1259. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1260. >
  1261. <IndexRedirect
  1262. to={
  1263. forCustomerDomain
  1264. ? '/alerts/wizard/'
  1265. : '/organizations/:orgId/alerts/wizard/'
  1266. }
  1267. />
  1268. <Route
  1269. path=":alertType/"
  1270. component={make(() => import('sentry/views/alerts/create'))}
  1271. />
  1272. </Route>
  1273. <Route
  1274. path=":alertId/"
  1275. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1276. />
  1277. <Route
  1278. path=":projectId/"
  1279. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1280. >
  1281. <Route
  1282. path="new/"
  1283. component={make(() => import('sentry/views/alerts/create'))}
  1284. />
  1285. <Route
  1286. path="wizard/"
  1287. component={make(() => import('sentry/views/alerts/wizard'))}
  1288. />
  1289. </Route>
  1290. </Fragment>
  1291. );
  1292. };
  1293. // ALERT ROUTES
  1294. const alertRoutes = (
  1295. <Fragment>
  1296. {USING_CUSTOMER_DOMAIN && (
  1297. <Route
  1298. path="/alerts/"
  1299. component={withDomainRequired(make(() => import('sentry/views/alerts')))}
  1300. key="orgless-alerts-route"
  1301. >
  1302. {alertChildRoutes({forCustomerDomain: true})}
  1303. </Route>
  1304. )}
  1305. <Route
  1306. path="/organizations/:orgId/alerts/"
  1307. component={withDomainRedirect(make(() => import('sentry/views/alerts')))}
  1308. key="org-alerts"
  1309. >
  1310. {alertChildRoutes({forCustomerDomain: false})}
  1311. </Route>
  1312. </Fragment>
  1313. );
  1314. const cronsRoutes = (
  1315. <Route
  1316. path="/crons/"
  1317. component={make(() => import('sentry/views/monitors'))}
  1318. withOrgPath
  1319. >
  1320. <IndexRoute component={make(() => import('sentry/views/monitors/overview'))} />
  1321. <Route
  1322. path="create/"
  1323. component={make(() => import('sentry/views/monitors/create'))}
  1324. />
  1325. <Redirect from=":monitorSlug/" to="/crons/" />
  1326. <Redirect from=":monitorSlug/edit/" to="/crons/" />
  1327. <Route
  1328. path=":projectId/:monitorSlug/"
  1329. component={make(() => import('sentry/views/monitors/details'))}
  1330. />
  1331. <Route
  1332. path=":projectId/:monitorSlug/edit/"
  1333. component={make(() => import('sentry/views/monitors/edit'))}
  1334. />
  1335. </Route>
  1336. );
  1337. const replayRoutes = (
  1338. <Route
  1339. path="/replays/"
  1340. component={make(() => import('sentry/views/replays/index'))}
  1341. withOrgPath
  1342. >
  1343. <IndexRoute component={make(() => import('sentry/views/replays/list'))} />
  1344. <Route
  1345. path="selectors/"
  1346. component={make(
  1347. () => import('sentry/views/replays/deadRageClick/deadRageClickList')
  1348. )}
  1349. />
  1350. <Route
  1351. path=":replaySlug/"
  1352. component={make(() => import('sentry/views/replays/details'))}
  1353. />
  1354. </Route>
  1355. );
  1356. const releasesRoutes = (
  1357. <Fragment>
  1358. <Route path="/releases/" withOrgPath>
  1359. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1360. <Route
  1361. path=":release/"
  1362. component={make(() => import('sentry/views/releases/detail'))}
  1363. >
  1364. <IndexRoute
  1365. component={make(() => import('sentry/views/releases/detail/overview'))}
  1366. />
  1367. <Route
  1368. path="commits/"
  1369. component={make(
  1370. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1371. )}
  1372. />
  1373. <Route
  1374. path="files-changed/"
  1375. component={make(
  1376. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1377. )}
  1378. />
  1379. </Route>
  1380. </Route>
  1381. <Redirect
  1382. from="/releases/new-events/"
  1383. to="/organizations/:orgId/releases/:release/"
  1384. />
  1385. <Redirect
  1386. from="/releases/all-events/"
  1387. to="/organizations/:orgId/releases/:release/"
  1388. />
  1389. </Fragment>
  1390. );
  1391. const statsRoutes = (
  1392. <Fragment>
  1393. <Route path="/stats/" withOrgPath>
  1394. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1395. <Route
  1396. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1397. >
  1398. <Route
  1399. path="issues/"
  1400. component={make(
  1401. () => import('sentry/views/organizationStats/teamInsights/issues')
  1402. )}
  1403. />
  1404. <Route
  1405. path="health/"
  1406. component={make(
  1407. () => import('sentry/views/organizationStats/teamInsights/health')
  1408. )}
  1409. />
  1410. </Route>
  1411. </Route>
  1412. <Redirect
  1413. from="/organizations/:orgId/stats/team/"
  1414. to="/organizations/:orgId/stats/issues/"
  1415. />
  1416. </Fragment>
  1417. );
  1418. // TODO(mark) Long term this /queries route should go away and /discover
  1419. // should be the canonical route for discover2. We have a redirect right now
  1420. // as /discover was for discover 1 and most of the application is linking to
  1421. // /discover/queries and not /discover
  1422. const discoverRoutes = (
  1423. <Route
  1424. path="/discover/"
  1425. component={make(() => import('sentry/views/discover'))}
  1426. withOrgPath
  1427. >
  1428. <IndexRedirect to="queries/" />
  1429. <Route
  1430. path="homepage/"
  1431. component={make(() => import('sentry/views/discover/homepage'))}
  1432. />
  1433. <Route
  1434. path="queries/"
  1435. component={make(() => import('sentry/views/discover/landing'))}
  1436. />
  1437. <Route
  1438. path="results/"
  1439. component={make(() => import('sentry/views/discover/results'))}
  1440. />
  1441. <Route
  1442. path=":eventSlug/"
  1443. component={make(() => import('sentry/views/discover/eventDetails'))}
  1444. />
  1445. </Route>
  1446. );
  1447. const llmMonitoringRedirects = USING_CUSTOMER_DOMAIN ? (
  1448. <Redirect
  1449. from="/llm-monitoring/"
  1450. to={`/${INSIGHTS_BASE_URL}/${MODULE_BASE_URLS[ModuleName.AI]}/`}
  1451. />
  1452. ) : (
  1453. <Redirect
  1454. from="/organizations/:orgId/llm-monitoring/"
  1455. to={`/organizations/:orgId/${INSIGHTS_BASE_URL}/${MODULE_BASE_URLS[ModuleName.AI]}/`}
  1456. />
  1457. );
  1458. const moduleUrlToModule: Record<keyof typeof MODULE_BASE_URLS, ModuleName> = {
  1459. 'mobile-screens': ModuleName.MOBILE_SCREENS,
  1460. 'mobile-ui': ModuleName.MOBILE_UI,
  1461. 'screen-rendering': ModuleName.SCREEN_RENDERING,
  1462. ai: ModuleName.AI,
  1463. app_start: ModuleName.APP_START,
  1464. cache: ModuleName.CACHE,
  1465. db: ModuleName.DB,
  1466. http: ModuleName.HTTP,
  1467. queue: ModuleName.QUEUE,
  1468. resource: ModuleName.RESOURCE,
  1469. screen_load: ModuleName.SCREEN_LOAD,
  1470. other: ModuleName.OTHER,
  1471. vital: ModuleName.VITAL,
  1472. };
  1473. const insightsRedirects = Object.values(MODULE_BASE_URLS)
  1474. .map(
  1475. moduleBaseURL =>
  1476. moduleBaseURL && (
  1477. <Redirect
  1478. key={moduleBaseURL}
  1479. from={`${moduleBaseURL}/*`}
  1480. to={`/${DOMAIN_VIEW_BASE_URL}/${getModuleView(moduleUrlToModule[moduleBaseURL])}${moduleBaseURL}/:splat`}
  1481. />
  1482. )
  1483. )
  1484. .filter(Boolean);
  1485. const transactionSummaryRoutes = (
  1486. <Route path="summary/">
  1487. <IndexRoute
  1488. component={make(
  1489. () => import('sentry/views/performance/transactionSummary/transactionOverview')
  1490. )}
  1491. />
  1492. <Route
  1493. path="replays/"
  1494. component={make(
  1495. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1496. )}
  1497. />
  1498. <Route
  1499. path="vitals/"
  1500. component={make(
  1501. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1502. )}
  1503. />
  1504. <Route
  1505. path="tags/"
  1506. component={make(
  1507. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1508. )}
  1509. />
  1510. <Route
  1511. path="events/"
  1512. component={make(
  1513. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1514. )}
  1515. />
  1516. <Route
  1517. path="profiles/"
  1518. component={make(
  1519. () => import('sentry/views/performance/transactionSummary/transactionProfiles')
  1520. )}
  1521. />
  1522. <Route
  1523. path="aggregateWaterfall/"
  1524. component={make(
  1525. () =>
  1526. import('sentry/views/performance/transactionSummary/aggregateSpanWaterfall')
  1527. )}
  1528. />
  1529. <Route path="spans/">
  1530. <IndexRoute
  1531. component={make(
  1532. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1533. )}
  1534. />
  1535. <Route
  1536. path=":spanSlug/"
  1537. component={make(
  1538. () =>
  1539. import(
  1540. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1541. )
  1542. )}
  1543. />
  1544. </Route>
  1545. </Route>
  1546. );
  1547. const domainViewRoutes = (
  1548. <Route path={`/${DOMAIN_VIEW_BASE_URL}/`} withOrgPath>
  1549. <Route path={`${FRONTEND_LANDING_SUB_PATH}/`}>
  1550. <IndexRoute
  1551. component={make(
  1552. () => import('sentry/views/insights/pages/frontend/frontendOverviewPage')
  1553. )}
  1554. />
  1555. {transactionSummaryRoutes}
  1556. <Route
  1557. path="trace/:traceSlug/"
  1558. component={make(() => import('sentry/views/performance/traceDetails'))}
  1559. />
  1560. <Route
  1561. path="trends/"
  1562. component={make(() => import('sentry/views/performance/trends'))}
  1563. />
  1564. <Route path={`${MODULE_BASE_URLS[ModuleName.HTTP]}/`}>
  1565. <IndexRoute
  1566. component={make(
  1567. () => import('sentry/views/insights/http/views/httpLandingPage')
  1568. )}
  1569. />
  1570. <Route
  1571. path="domains/"
  1572. component={make(
  1573. () => import('sentry/views/insights/http/views/httpDomainSummaryPage')
  1574. )}
  1575. />
  1576. </Route>
  1577. <Route path={`${MODULE_BASE_URLS[ModuleName.VITAL]}/`}>
  1578. <IndexRoute
  1579. component={make(
  1580. () =>
  1581. import(
  1582. 'sentry/views/insights/browser/webVitals/views/webVitalsLandingPage'
  1583. )
  1584. )}
  1585. />
  1586. <Route
  1587. path="overview/"
  1588. component={make(
  1589. () => import('sentry/views/insights/browser/webVitals/views/pageOverview')
  1590. )}
  1591. />
  1592. </Route>
  1593. <Route path={`${MODULE_BASE_URLS[ModuleName.RESOURCE]}/`}>
  1594. <IndexRoute
  1595. component={make(
  1596. () =>
  1597. import(
  1598. 'sentry/views/insights/browser/resources/views/resourcesLandingPage'
  1599. )
  1600. )}
  1601. />
  1602. <Route
  1603. path="spans/span/:groupId/"
  1604. component={make(
  1605. () =>
  1606. import(
  1607. 'sentry/views/insights/browser/resources/views/resourceSummaryPage'
  1608. )
  1609. )}
  1610. />
  1611. </Route>
  1612. </Route>
  1613. <Route path={`${BACKEND_LANDING_SUB_PATH}/`}>
  1614. <IndexRoute
  1615. component={make(
  1616. () => import('sentry/views/insights/pages/backend/backendOverviewPage')
  1617. )}
  1618. />
  1619. {transactionSummaryRoutes}
  1620. <Route
  1621. path="trace/:traceSlug/"
  1622. component={make(() => import('sentry/views/performance/traceDetails'))}
  1623. />
  1624. <Route
  1625. path="trends/"
  1626. component={make(() => import('sentry/views/performance/trends'))}
  1627. />
  1628. <Route path={`${MODULE_BASE_URLS[ModuleName.DB]}/`}>
  1629. <IndexRoute
  1630. component={make(
  1631. () => import('sentry/views/insights/database/views/databaseLandingPage')
  1632. )}
  1633. />
  1634. <Route
  1635. path="spans/span/:groupId/"
  1636. component={make(
  1637. () => import('sentry/views/insights/database/views/databaseSpanSummaryPage')
  1638. )}
  1639. />
  1640. </Route>
  1641. <Route path={`${MODULE_BASE_URLS[ModuleName.HTTP]}/`}>
  1642. <IndexRoute
  1643. component={make(
  1644. () => import('sentry/views/insights/http/views/httpLandingPage')
  1645. )}
  1646. />
  1647. <Route
  1648. path="domains/"
  1649. component={make(
  1650. () => import('sentry/views/insights/http/views/httpDomainSummaryPage')
  1651. )}
  1652. />
  1653. </Route>
  1654. <Route path={`${MODULE_BASE_URLS[ModuleName.CACHE]}/`}>
  1655. <IndexRoute
  1656. component={make(
  1657. () => import('sentry/views/insights/cache/views/cacheLandingPage')
  1658. )}
  1659. />
  1660. </Route>
  1661. <Route path={`${MODULE_BASE_URLS[ModuleName.QUEUE]}/`}>
  1662. <IndexRoute
  1663. component={make(
  1664. () => import('sentry/views/insights/queues/views/queuesLandingPage')
  1665. )}
  1666. />
  1667. <Route
  1668. path="destination/"
  1669. component={make(
  1670. () => import('sentry/views/insights/queues/views/destinationSummaryPage')
  1671. )}
  1672. />
  1673. </Route>
  1674. </Route>
  1675. <Route path={`${MOBILE_LANDING_SUB_PATH}/`}>
  1676. <IndexRoute
  1677. component={make(
  1678. () => import('sentry/views/insights/pages/mobile/mobileOverviewPage')
  1679. )}
  1680. />
  1681. {transactionSummaryRoutes}
  1682. <Route
  1683. path="trace/:traceSlug/"
  1684. component={make(() => import('sentry/views/performance/traceDetails'))}
  1685. />
  1686. <Route
  1687. path="trends/"
  1688. component={make(() => import('sentry/views/performance/trends'))}
  1689. />
  1690. <Route path={`${MODULE_BASE_URLS[ModuleName.MOBILE_SCREENS]}/`}>
  1691. <IndexRoute
  1692. component={make(
  1693. () =>
  1694. import('sentry/views/insights/mobile/screens/views/screensLandingPage')
  1695. )}
  1696. />
  1697. <Route
  1698. path="details/"
  1699. component={make(
  1700. () => import('sentry/views/insights/mobile/screens/views/screenDetailsPage')
  1701. )}
  1702. />
  1703. </Route>
  1704. <Route path={`${MODULE_BASE_URLS[ModuleName.SCREEN_RENDERING]}/`}>
  1705. <IndexRoute
  1706. component={make(
  1707. () =>
  1708. import(
  1709. 'sentry/views/insights/mobile/screenRendering/screenRenderingLandingPage'
  1710. )
  1711. )}
  1712. />
  1713. <Route
  1714. path={`${SUMMARY_PAGE_BASE_URL}/`}
  1715. component={make(
  1716. () =>
  1717. import(
  1718. 'sentry/views/insights/mobile/screenRendering/screenRenderingSummaryPage'
  1719. )
  1720. )}
  1721. />
  1722. </Route>
  1723. <Route path={`${MODULE_BASE_URLS[ModuleName.APP_START]}/`}>
  1724. <IndexRoute
  1725. component={make(
  1726. () =>
  1727. import(
  1728. 'sentry/views/insights/mobile/appStarts/views/appStartsLandingPage'
  1729. )
  1730. )}
  1731. />
  1732. <Route
  1733. path="spans/"
  1734. component={make(
  1735. () =>
  1736. import('sentry/views/insights/mobile/appStarts/views/screenSummaryPage')
  1737. )}
  1738. />
  1739. </Route>
  1740. <Route path={`${MODULE_BASE_URLS[ModuleName.MOBILE_UI]}/`}>
  1741. <IndexRoute
  1742. component={make(
  1743. () => import('sentry/views/insights/mobile/ui/views/uiLandingPage')
  1744. )}
  1745. />
  1746. <Route
  1747. path="spans/"
  1748. component={make(
  1749. () => import('sentry/views/insights/mobile/ui/views/screenSummaryPage')
  1750. )}
  1751. />
  1752. </Route>
  1753. <Route path={`${MODULE_BASE_URLS[ModuleName.SCREEN_LOAD]}/`}>
  1754. <IndexRoute
  1755. component={make(
  1756. () =>
  1757. import(
  1758. 'sentry/views/insights/mobile/screenload/views/screenloadLandingPage'
  1759. )
  1760. )}
  1761. />
  1762. <Route
  1763. path="spans/"
  1764. component={make(
  1765. () =>
  1766. import(
  1767. 'sentry/views/insights/mobile/screenload/views/screenLoadSpansPage'
  1768. )
  1769. )}
  1770. />
  1771. </Route>
  1772. </Route>
  1773. <Route path={`${AI_LANDING_SUB_PATH}/`}>
  1774. <IndexRoute
  1775. component={make(() => import('sentry/views/insights/pages/ai/aiOverviewPage'))}
  1776. />
  1777. {transactionSummaryRoutes}
  1778. <Route
  1779. path="trace/:traceSlug/"
  1780. component={make(() => import('sentry/views/performance/traceDetails'))}
  1781. />
  1782. <Route
  1783. path="trends/"
  1784. component={make(() => import('sentry/views/performance/trends'))}
  1785. />
  1786. <Route path={`${MODULE_BASE_URLS[ModuleName.AI]}/`}>
  1787. <IndexRoute
  1788. component={make(
  1789. () =>
  1790. import(
  1791. 'sentry/views/insights/llmMonitoring/views/llmMonitoringLandingPage'
  1792. )
  1793. )}
  1794. />
  1795. <Route
  1796. path="pipeline-type/:groupId/"
  1797. component={make(
  1798. () =>
  1799. import(
  1800. 'sentry/views/insights/llmMonitoring/views/llmMonitoringDetailsPage'
  1801. )
  1802. )}
  1803. />
  1804. </Route>
  1805. </Route>
  1806. </Route>
  1807. );
  1808. const performanceRoutes = (
  1809. <Route
  1810. path="/performance/"
  1811. component={make(() => import('sentry/views/performance'))}
  1812. withOrgPath
  1813. >
  1814. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1815. <Route
  1816. path="trends/"
  1817. component={make(() => import('sentry/views/performance/trends'))}
  1818. />
  1819. {transactionSummaryRoutes}
  1820. <Route
  1821. path="vitaldetail/"
  1822. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1823. />
  1824. <Route
  1825. path="trace/:traceSlug/"
  1826. component={make(() => import('sentry/views/performance/traceDetails'))}
  1827. />
  1828. {insightsRedirects}
  1829. <Redirect
  1830. from="browser/resources"
  1831. to={`/${INSIGHTS_BASE_URL}/${MODULE_BASE_URLS[ModuleName.RESOURCE]}/`}
  1832. />
  1833. <Redirect
  1834. from="browser/assets"
  1835. to={`/${INSIGHTS_BASE_URL}/${MODULE_BASE_URLS[ModuleName.RESOURCE]}/`}
  1836. />
  1837. <Redirect
  1838. from="browser/pageloads"
  1839. to={`/${INSIGHTS_BASE_URL}/${MODULE_BASE_URLS[ModuleName.VITAL]}/`}
  1840. />
  1841. <Route
  1842. path=":eventSlug/"
  1843. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1844. />
  1845. </Route>
  1846. );
  1847. const tracesRoutes = (
  1848. <Route
  1849. path="/traces/"
  1850. component={make(() => import('sentry/views/traces'))}
  1851. withOrgPath
  1852. >
  1853. <IndexRoute component={make(() => import('sentry/views/traces/content'))} />
  1854. </Route>
  1855. );
  1856. const userFeedbackRoutes = (
  1857. <Route
  1858. path="/user-feedback/"
  1859. component={make(() => import('sentry/views/userFeedback'))}
  1860. withOrgPath
  1861. />
  1862. );
  1863. const feedbackv2Routes = (
  1864. <Route
  1865. path="/feedback/"
  1866. component={make(() => import('sentry/views/feedback/index'))}
  1867. withOrgPath
  1868. >
  1869. <IndexRoute
  1870. component={make(() => import('sentry/views/feedback/feedbackListPage'))}
  1871. />
  1872. </Route>
  1873. );
  1874. const issueListRoutes = (
  1875. <Route path="/issues" component={errorHandler(IssueListContainer)} withOrgPath>
  1876. <IndexRoute component={errorHandler(IssueListOverview)} />
  1877. <Route path="searches/:searchId/" component={errorHandler(IssueListOverview)} />
  1878. </Route>
  1879. );
  1880. // Once org issues is complete, these routes can be nested under
  1881. // /organizations/:orgId/issues
  1882. const issueTabs = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1883. const hoc = forCustomerDomain ? withDomainRequired : x => x;
  1884. return (
  1885. <Fragment>
  1886. <IndexRoute
  1887. component={hoc(
  1888. make(
  1889. () =>
  1890. import('sentry/views/issueDetails/groupEventDetails/groupEventDetails'),
  1891. <GroupEventDetailsLoading />
  1892. )
  1893. )}
  1894. />
  1895. <Route
  1896. path={TabPaths[Tab.REPLAYS]}
  1897. component={hoc(make(() => import('sentry/views/issueDetails/groupReplays')))}
  1898. />
  1899. <Route
  1900. path={TabPaths[Tab.ACTIVITY]}
  1901. component={hoc(make(() => import('sentry/views/issueDetails/groupActivity')))}
  1902. />
  1903. <Route
  1904. path={TabPaths[Tab.EVENTS]}
  1905. component={hoc(make(() => import('sentry/views/issueDetails/groupEvents')))}
  1906. />
  1907. <Route
  1908. path={TabPaths[Tab.TAGS]}
  1909. component={hoc(
  1910. make(() => import('sentry/views/issueDetails/groupTags/groupTagsTab'))
  1911. )}
  1912. />
  1913. <Route
  1914. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1915. component={make(() => import('sentry/views/issueDetails/groupTagValues'))}
  1916. />
  1917. <Route
  1918. path={TabPaths[Tab.USER_FEEDBACK]}
  1919. component={hoc(
  1920. make(() => import('sentry/views/issueDetails/groupUserFeedback'))
  1921. )}
  1922. />
  1923. <Route
  1924. path={TabPaths[Tab.ATTACHMENTS]}
  1925. component={hoc(
  1926. make(() => import('sentry/views/issueDetails/groupEventAttachments'))
  1927. )}
  1928. />
  1929. <Route
  1930. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1931. component={hoc(
  1932. make(
  1933. () =>
  1934. import(
  1935. 'sentry/views/issueDetails/groupSimilarIssues/groupSimilarIssuesTab'
  1936. )
  1937. )
  1938. )}
  1939. />
  1940. <Route
  1941. path={TabPaths[Tab.MERGED]}
  1942. component={hoc(
  1943. make(() => import('sentry/views/issueDetails/groupMerged/groupMergedTab'))
  1944. )}
  1945. />
  1946. </Fragment>
  1947. );
  1948. };
  1949. const issueDetailsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => (
  1950. <Fragment>
  1951. {issueTabs({forCustomerDomain})}
  1952. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  1953. {issueTabs({forCustomerDomain})}
  1954. </Route>
  1955. </Fragment>
  1956. );
  1957. const issueDetailsRoutes = (
  1958. <Fragment>
  1959. <Route
  1960. path="/organizations/:orgId/issues/:groupId/"
  1961. component={withDomainRedirect(
  1962. make(() => import('sentry/views/issueDetails/groupDetails'))
  1963. )}
  1964. key="org-issues-group-id"
  1965. >
  1966. {issueDetailsChildRoutes({forCustomerDomain: false})}
  1967. </Route>
  1968. {USING_CUSTOMER_DOMAIN && (
  1969. <Route
  1970. path="/issues/:groupId/"
  1971. component={withDomainRequired(
  1972. make(() => import('sentry/views/issueDetails/groupDetails'))
  1973. )}
  1974. key="orgless-issues-group-id-route"
  1975. >
  1976. {issueDetailsChildRoutes({forCustomerDomain: true})}
  1977. </Route>
  1978. )}
  1979. </Fragment>
  1980. );
  1981. // These are the "manage" pages. For sentry.io, these are _different_ from
  1982. // the SaaS admin routes in getsentry.
  1983. const adminManageRoutes = (
  1984. <Route
  1985. path="/manage/"
  1986. component={make(() => import('sentry/views/admin/adminLayout'))}
  1987. >
  1988. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1989. <Route
  1990. path="buffer/"
  1991. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1992. />
  1993. <Route
  1994. path="relays/"
  1995. component={make(() => import('sentry/views/admin/adminRelays'))}
  1996. />
  1997. <Route
  1998. path="organizations/"
  1999. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  2000. />
  2001. <Route
  2002. path="projects/"
  2003. component={make(() => import('sentry/views/admin/adminProjects'))}
  2004. />
  2005. <Route
  2006. path="queue/"
  2007. component={make(() => import('sentry/views/admin/adminQueue'))}
  2008. />
  2009. <Route
  2010. path="quotas/"
  2011. component={make(() => import('sentry/views/admin/adminQuotas'))}
  2012. />
  2013. <Route
  2014. path="settings/"
  2015. component={make(() => import('sentry/views/admin/adminSettings'))}
  2016. />
  2017. <Route path="users/">
  2018. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  2019. <Route
  2020. path=":id"
  2021. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  2022. />
  2023. </Route>
  2024. <Route
  2025. path="status/mail/"
  2026. component={make(() => import('sentry/views/admin/adminMail'))}
  2027. />
  2028. <Route
  2029. path="status/environment/"
  2030. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  2031. />
  2032. <Route
  2033. path="status/packages/"
  2034. component={make(() => import('sentry/views/admin/adminPackages'))}
  2035. />
  2036. <Route
  2037. path="status/warnings/"
  2038. component={make(() => import('sentry/views/admin/adminWarnings'))}
  2039. />
  2040. </Route>
  2041. );
  2042. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  2043. // me why we need the OrganizationRoot root container.
  2044. const legacyOrganizationRootRoutes = (
  2045. <Route component={errorHandler(OrganizationRoot)}>
  2046. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  2047. <Route path="/organizations/:orgId/">
  2048. {hook('routes:legacy-organization-redirects')}
  2049. <IndexRedirect to="issues/" />
  2050. <Redirect from="teams/" to="/settings/:orgId/teams/" />
  2051. <Redirect from="teams/your-teams/" to="/settings/:orgId/teams/" />
  2052. <Redirect from="teams/all-teams/" to="/settings/:orgId/teams/" />
  2053. <Redirect from="teams/:teamId/" to="/settings/:orgId/teams/:teamId/" />
  2054. <Redirect
  2055. from="teams/:teamId/members/"
  2056. to="/settings/:orgId/teams/:teamId/members/"
  2057. />
  2058. <Redirect
  2059. from="teams/:teamId/projects/"
  2060. to="/settings/:orgId/teams/:teamId/projects/"
  2061. />
  2062. <Redirect
  2063. from="teams/:teamId/settings/"
  2064. to="/settings/:orgId/teams/:teamId/settings/"
  2065. />
  2066. <Redirect from="settings/" to="/settings/:orgId/" />
  2067. <Redirect from="api-keys/" to="/settings/:orgId/api-keys/" />
  2068. <Redirect from="api-keys/:apiKey/" to="/settings/:orgId/api-keys/:apiKey/" />
  2069. <Redirect from="members/" to="/settings/:orgId/members/" />
  2070. <Redirect from="members/:memberId/" to="/settings/:orgId/members/:memberId/" />
  2071. <Redirect from="rate-limits/" to="/settings/:orgId/rate-limits/" />
  2072. <Redirect from="repos/" to="/settings/:orgId/repos/" />
  2073. </Route>
  2074. </Route>
  2075. );
  2076. const gettingStartedRoutes = (
  2077. <Fragment>
  2078. {USING_CUSTOMER_DOMAIN && (
  2079. <Fragment>
  2080. <Redirect
  2081. from="/getting-started/:projectId/"
  2082. to="/projects/:projectId/getting-started/"
  2083. />
  2084. <Redirect
  2085. from="/getting-started/:projectId/:platform/"
  2086. to="/projects/:projectId/getting-started/"
  2087. />
  2088. </Fragment>
  2089. )}
  2090. <Redirect
  2091. from="/:orgId/:projectId/getting-started/"
  2092. to="/organizations/:orgId/projects/:projectId/getting-started/"
  2093. />
  2094. <Redirect
  2095. from="/:orgId/:projectId/getting-started/:platform/"
  2096. to="/organizations/:orgId/projects/:projectId/getting-started/"
  2097. />
  2098. </Fragment>
  2099. );
  2100. const profilingRoutes = (
  2101. <Route
  2102. path="/profiling/"
  2103. component={make(() => import('sentry/views/profiling'))}
  2104. withOrgPath
  2105. >
  2106. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  2107. <Route
  2108. path="summary/:projectId/"
  2109. component={make(() => import('sentry/views/profiling/profileSummary'))}
  2110. />
  2111. <Route
  2112. path="profile/:projectId/differential-flamegraph/"
  2113. component={make(() => import('sentry/views/profiling/differentialFlamegraph'))}
  2114. />
  2115. <Route
  2116. path="profile/:projectId/"
  2117. component={make(() => import('sentry/views/profiling/continuousProfileProvider'))}
  2118. >
  2119. <Route
  2120. path="flamegraph/"
  2121. component={make(
  2122. () => import('sentry/views/profiling/continuousProfileFlamegraph')
  2123. )}
  2124. />
  2125. </Route>
  2126. <Route
  2127. path="profile/:projectId/:eventId/"
  2128. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  2129. >
  2130. <Route
  2131. path="flamegraph/"
  2132. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  2133. />
  2134. </Route>
  2135. </Route>
  2136. );
  2137. const metricsRoutes = (
  2138. <Fragment>
  2139. <Route
  2140. path="/metrics/"
  2141. component={make(() => import('sentry/views/metrics'))}
  2142. withOrgPath
  2143. >
  2144. <IndexRoute component={make(() => import('sentry/views/metrics/metrics'))} />
  2145. </Route>
  2146. {/* TODO(ddm): fade this out */}
  2147. <Redirect from="/ddm/" to="/metrics/" />
  2148. </Fragment>
  2149. );
  2150. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  2151. // canonical URLs.
  2152. //
  2153. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  2154. // or do these need to be nested into the OrganizationLayout tree?
  2155. const legacyOrgRedirects = (
  2156. <Route path="/:orgId/:projectId/">
  2157. <IndexRoute
  2158. component={errorHandler(
  2159. redirectDeprecatedProjectRoute(
  2160. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2161. )
  2162. )}
  2163. />
  2164. <Route
  2165. path="issues/"
  2166. component={errorHandler(
  2167. redirectDeprecatedProjectRoute(
  2168. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2169. )
  2170. )}
  2171. />
  2172. <Route
  2173. path="dashboard/"
  2174. component={errorHandler(
  2175. redirectDeprecatedProjectRoute(
  2176. ({orgId, projectId}) =>
  2177. `/organizations/${orgId}/dashboards/?project=${projectId}`
  2178. )
  2179. )}
  2180. />
  2181. <Route
  2182. path="user-feedback/"
  2183. component={errorHandler(
  2184. redirectDeprecatedProjectRoute(
  2185. ({orgId, projectId}) =>
  2186. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  2187. )
  2188. )}
  2189. />
  2190. <Route
  2191. path="releases/"
  2192. component={errorHandler(
  2193. redirectDeprecatedProjectRoute(
  2194. ({orgId, projectId}) =>
  2195. `/organizations/${orgId}/releases/?project=${projectId}`
  2196. )
  2197. )}
  2198. />
  2199. <Route
  2200. path="releases/:version/"
  2201. component={errorHandler(
  2202. redirectDeprecatedProjectRoute(
  2203. ({orgId, projectId, router}) =>
  2204. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  2205. )
  2206. )}
  2207. />
  2208. <Route
  2209. path="releases/:version/new-events/"
  2210. component={errorHandler(
  2211. redirectDeprecatedProjectRoute(
  2212. ({orgId, projectId, router}) =>
  2213. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  2214. )
  2215. )}
  2216. />
  2217. <Route
  2218. path="releases/:version/all-events/"
  2219. component={errorHandler(
  2220. redirectDeprecatedProjectRoute(
  2221. ({orgId, projectId, router}) =>
  2222. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  2223. )
  2224. )}
  2225. />
  2226. <Route
  2227. path="releases/:version/commits/"
  2228. component={errorHandler(
  2229. redirectDeprecatedProjectRoute(
  2230. ({orgId, projectId, router}) =>
  2231. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  2232. )
  2233. )}
  2234. />
  2235. </Route>
  2236. );
  2237. const organizationRoutes = (
  2238. <Route component={errorHandler(OrganizationLayout)}>
  2239. {settingsRoutes}
  2240. {projectsRoutes}
  2241. {dashboardRoutes}
  2242. {userFeedbackRoutes}
  2243. {feedbackv2Routes}
  2244. {issueListRoutes}
  2245. {issueDetailsRoutes}
  2246. {alertRoutes}
  2247. {cronsRoutes}
  2248. {replayRoutes}
  2249. {releasesRoutes}
  2250. {statsRoutes}
  2251. {discoverRoutes}
  2252. {performanceRoutes}
  2253. {domainViewRoutes}
  2254. {tracesRoutes}
  2255. {llmMonitoringRedirects}
  2256. {profilingRoutes}
  2257. {metricsRoutes}
  2258. {gettingStartedRoutes}
  2259. {adminManageRoutes}
  2260. {legacyOrganizationRootRoutes}
  2261. {legacyOrgRedirects}
  2262. </Route>
  2263. );
  2264. const legacyRedirectRoutes = (
  2265. <Route path="/:orgId/">
  2266. <IndexRedirect to="/organizations/:orgId/" />
  2267. <Route path=":projectId/settings/">
  2268. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2269. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2270. <Redirect
  2271. from="alerts/rules/"
  2272. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2273. />
  2274. <Redirect
  2275. from="alerts/rules/new/"
  2276. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2277. />
  2278. <Redirect
  2279. from="alerts/rules/:ruleId/"
  2280. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2281. />
  2282. <Redirect
  2283. from="environments/"
  2284. to="/settings/:orgId/projects/:projectId/environments/"
  2285. />
  2286. <Redirect
  2287. from="environments/hidden/"
  2288. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2289. />
  2290. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2291. <Redirect
  2292. from="issue-tracking/"
  2293. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2294. />
  2295. <Redirect
  2296. from="release-tracking/"
  2297. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2298. />
  2299. <Redirect
  2300. from="ownership/"
  2301. to="/settings/:orgId/projects/:projectId/ownership/"
  2302. />
  2303. <Redirect
  2304. from="data-forwarding/"
  2305. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2306. />
  2307. <Redirect
  2308. from="debug-symbols/"
  2309. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2310. />
  2311. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2312. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2313. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2314. <Redirect
  2315. from="keys/:keyId/"
  2316. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2317. />
  2318. <Redirect
  2319. from="user-feedback/"
  2320. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2321. />
  2322. <Redirect
  2323. from="security-headers/"
  2324. to="/settings/:orgId/projects/:projectId/security-headers/"
  2325. />
  2326. <Redirect
  2327. from="security-headers/csp/"
  2328. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2329. />
  2330. <Redirect
  2331. from="security-headers/expect-ct/"
  2332. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2333. />
  2334. <Redirect
  2335. from="security-headers/hpkp/"
  2336. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2337. />
  2338. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2339. <Redirect
  2340. from="plugins/:pluginId/"
  2341. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2342. />
  2343. <Redirect
  2344. from="integrations/:providerKey/"
  2345. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2346. />
  2347. </Route>
  2348. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2349. <Redirect
  2350. from=":projectId/issues/:groupId/"
  2351. to="/organizations/:orgId/issues/:groupId/"
  2352. />
  2353. <Redirect
  2354. from=":projectId/issues/:groupId/events/"
  2355. to="/organizations/:orgId/issues/:groupId/events/"
  2356. />
  2357. <Redirect
  2358. from=":projectId/issues/:groupId/events/:eventId/"
  2359. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2360. />
  2361. <Redirect
  2362. from=":projectId/issues/:groupId/tags/"
  2363. to="/organizations/:orgId/issues/:groupId/tags/"
  2364. />
  2365. <Redirect
  2366. from=":projectId/issues/:groupId/tags/:tagKey/"
  2367. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2368. />
  2369. <Redirect
  2370. from=":projectId/issues/:groupId/feedback/"
  2371. to="/organizations/:orgId/issues/:groupId/feedback/"
  2372. />
  2373. <Redirect
  2374. from=":projectId/issues/:groupId/similar/"
  2375. to="/organizations/:orgId/issues/:groupId/similar/"
  2376. />
  2377. <Redirect
  2378. from=":projectId/issues/:groupId/merged/"
  2379. to="/organizations/:orgId/issues/:groupId/merged/"
  2380. />
  2381. <Route
  2382. path=":projectId/events/:eventId/"
  2383. component={errorHandler(ProjectEventRedirect)}
  2384. />
  2385. </Route>
  2386. );
  2387. const appRoutes = (
  2388. <Route>
  2389. {experimentalSpaRoutes}
  2390. <Route path="/" component={errorHandler(App)}>
  2391. {rootRoutes}
  2392. {organizationRoutes}
  2393. {legacyRedirectRoutes}
  2394. <Route path="*" component={errorHandler(RouteNotFound)} />
  2395. </Route>
  2396. </Route>
  2397. );
  2398. return appRoutes;
  2399. }
  2400. // We load routes both when initializing the SDK (for routing integrations) and
  2401. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2402. export const routes = memoize(buildRoutes);
  2403. // Exported for use in tests.
  2404. export {buildRoutes};
  2405. function NoOp({children}: {children: JSX.Element}) {
  2406. return children;
  2407. }