routes.tsx 72 KB

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